当前位置: 首页>>代码示例>>Java>>正文


Java FrontendException.printStackTrace方法代码示例

本文整理汇总了Java中org.apache.pig.impl.logicalLayer.FrontendException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java FrontendException.printStackTrace方法的具体用法?Java FrontendException.printStackTrace怎么用?Java FrontendException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pig.impl.logicalLayer.FrontendException的用法示例。


在下文中一共展示了FrontendException.printStackTrace方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: coltypeFromFieldSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
public static ColumnType coltypeFromFieldSchema(String colName, FieldSchema colSchema)
{
    ColumnType t = new ColumnType();
    t.setName(colName);
    t.setType(convertoRCFTypeName(DataType.findTypeName(colSchema.type)));
    if (colSchema.schema != null)
    {
        try
        {
            t.setColumnSchema(convertToBlockSchema(colSchema.schema));
        }
        catch (FrontendException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    return t;
}
 
开发者ID:linkedin,项目名称:Cubert,代码行数:20,代码来源:SchemaUtils.java

示例2: outputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema outputSchema(Schema input)
{
	try {
		if (!(input.size() == 2 || input.size() == 3))
		{
			throw new RuntimeException("Expected input to have two or three fields");
		}

		if (input.getField(1).type != DataType.INTEGER ) {
			throw new RuntimeException("Expected an INT as second input, got: "+input.getField(1).type);
		}

		return new Schema(input.getField(0).schema);
	}

	catch (FrontendException e) {
		e.printStackTrace();
		throw new RuntimeException(e);
	}
}
 
开发者ID:apache,项目名称:incubator-datafu,代码行数:22,代码来源:TupleFromBag.java

示例3: outputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema outputSchema(Schema input) {
  try {
    Schema.FieldSchema inputFieldSchema = input.getField(0);

    if (inputFieldSchema.type != DataType.BAG) {
      throw new RuntimeException("Expected a BAG as input");
    }
    
    return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input),
                                             inputFieldSchema.schema, DataType.BAG));    
  } catch (FrontendException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:incubator-datafu,代码行数:17,代码来源:ReservoirSample.java

示例4: testBlockErrMessage

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test
public void testBlockErrMessage() throws Throwable {
    PigServer server = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
    PigContext context = server.getPigContext();

    String script = "A = load 'inputdata' using PigStorage() as ( curr_searchQuery );\n" +
    		"B = foreach A { domain = CONCAT(curr_searchQuery,\"^www\\.\");\n" +
    		"        generate domain; };\n";
    ByteArrayInputStream cmd = new ByteArrayInputStream(script.getBytes());
    InputStreamReader reader = new InputStreamReader(cmd);

    Grunt grunt = new Grunt(new BufferedReader(reader), context);

    try {
        grunt.exec();
    } catch(FrontendException e) {
        e.printStackTrace();
        assertTrue(e.getMessage().contains("Error during parsing. <line 2, column 49>  Unexpected character '\"'"));
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:21,代码来源:TestGrunt.java

示例5: testValidationFailure

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test
public void testValidationFailure() throws Exception{
    String input[] = new String[] { "some data" };
    String outputFileName = "test-output.txt";
    boolean sawException = false;
    try {
        Util.createInputFile(pig.getPigContext(),outputFileName, input);
        String query = "a = load '" + inputFileName + "' as (c:chararray, " +
                       "i:int,d:double);" +
                       "store a into '" + outputFileName + "' using PigStorage();";
        Util.buildLp( pig, query );
    } catch (InvocationTargetException e){
        FrontendException pve = (FrontendException)e.getCause();
        pve.printStackTrace();
        // Since output file is present, validation should fail
        // and throw this exception
        assertEquals(6000,pve.getErrorCode());
        assertEquals(PigException.REMOTE_ENVIRONMENT, pve.getErrorSource());
        assertTrue(pve.getCause() instanceof IOException);
        sawException = true;
    } finally {
        assertTrue(sawException);
        Util.deleteFile(pig.getPigContext(), outputFileName);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:26,代码来源:TestStore.java

示例6: testBlockErrMessage

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test
public void testBlockErrMessage() throws Throwable {
    PigServer server = new PigServer(cluster.getExecType(), cluster.getProperties());
    PigContext context = server.getPigContext();

    String script = "A = load 'inputdata' using PigStorage() as ( curr_searchQuery );\n" +
            "B = foreach A { domain = CONCAT(curr_searchQuery,\"^www\\.\");\n" +
            "        generate domain; };\n";
    ByteArrayInputStream cmd = new ByteArrayInputStream(script.getBytes());
    InputStreamReader reader = new InputStreamReader(cmd);

    Grunt grunt = new Grunt(new BufferedReader(reader), context);

    try {
        grunt.exec();
    } catch(FrontendException e) {
        e.printStackTrace();
        assertTrue(e.getMessage().contains("Error during parsing. <line 2, column 49>  Unexpected character '\"'"));
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:21,代码来源:TestGrunt.java

示例7: local

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Test
public void local() {
    PigServer pigServer = pigConfiguration.local();
    try {
        pigServer.printAliases();
    } catch (FrontendException e) {
        e.printStackTrace();
    }
    System.out.println(pigServer);
}
 
开发者ID:mumuhadoop,项目名称:mumu-pig,代码行数:11,代码来源:MumuPigConfigurationTest.java

示例8: outputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema outputSchema(Schema input) {
  try {
    if (!(input.size() == 2 || input.size() == 3))
    {
      throw new RuntimeException("Expected input to have two or three fields");
    }
    
    Schema.FieldSchema inputFieldSchema = input.getField(0);

    if (inputFieldSchema.type != DataType.BAG) {
      throw new RuntimeException("Expected a BAG as first input, got: "+inputFieldSchema.type);
    }
    
    if (input.getField(1).type != DataType.INTEGER) {
      throw new RuntimeException("Expected an INT as second input, got: "+input.getField(1).type);
    }      
    
    if (input.size() == 3 && !(input.getField(2).type == DataType.INTEGER || input.getField(2).type == DataType.LONG)) {
      throw new RuntimeException("Expected an INT or LONG as second input, got: "+input.getField(2).type);
    }
    
    return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input),
                                             inputFieldSchema.schema, DataType.BAG));    
  } catch (FrontendException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:incubator-datafu,代码行数:30,代码来源:WeightedSample.java

示例9: outputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema outputSchema(Schema inputSchema) {
	try {
		if ((inputSchema == null) || ((inputSchema.size() != 1) && (inputSchema.size() != 2))) {
			throw new RuntimeException("Expecting 2 inputs, found: " + 
					((inputSchema == null) ? 0 : inputSchema.size()));
		}

		FieldSchema inputFieldSchema = inputSchema.getField(0);
		if (inputFieldSchema.type != DataType.BAG) {
			throw new RuntimeException("Expecting a bag of tuples: {()}, found data type: " + 
					DataType.findTypeName(inputFieldSchema.type));
		}

		// first field in the bag schema
		FieldSchema firstFieldSchema = inputFieldSchema.schema.getField(0);
		if ((firstFieldSchema == null) || (firstFieldSchema.schema == null)
				|| firstFieldSchema.schema.size() < 1) {
			throw new RuntimeException("Expecting a bag and a delimeter, found: " + inputSchema);
		}

		if (firstFieldSchema.type != DataType.TUPLE) {
			throw new RuntimeException("Expecting a bag and a delimeter, found: " + inputSchema);
		}
		
		if (inputSchema.size() == 2) {
			FieldSchema secondInputFieldSchema = inputSchema.getField(1);

			if (secondInputFieldSchema.type != DataType.CHARARRAY) {
				throw new RuntimeException("Expecting a bag and a delimeter, found: " + inputSchema);
			}
		}

		return new Schema(new Schema.FieldSchema(null, DataType.CHARARRAY));
	} catch (FrontendException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:40,代码来源:BagToString.java

示例10: outputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema outputSchema(Schema inputSchema) {
	try {
		if ((inputSchema == null) || inputSchema.size() != 1) {
			throw new RuntimeException("Expecting 1 input, found " + 
					((inputSchema == null) ? 0 : inputSchema.size()));
		}

		Schema.FieldSchema inputFieldSchema = inputSchema.getField(0);
		if (inputFieldSchema.type != DataType.BAG) {
			throw new RuntimeException("Expecting a bag of tuples: {()}");
		}

		// first field in the bag schema
		Schema.FieldSchema firstFieldSchema = inputFieldSchema.schema.getField(0);
		if ((firstFieldSchema == null) || (firstFieldSchema.schema == null)
				|| firstFieldSchema.schema.size() < 1) {
			throw new RuntimeException("Expecting a bag of tuples: {()}, found: " + inputSchema);
		}

		if (firstFieldSchema.type != DataType.TUPLE) {
			throw new RuntimeException("Expecting a bag of tuples: {()}, found: " + inputSchema);
		}

		// now for output schema
		Schema tupleOutputSchema = new Schema();
		for (int i = 0; i < firstFieldSchema.schema.size(); ++i) {
			tupleOutputSchema.add(firstFieldSchema.schema.getField(i));
		}
		return new Schema(new Schema.FieldSchema(getSchemaName(this
				.getClass().getName().toLowerCase(), inputSchema), tupleOutputSchema,
				DataType.TUPLE));
	} catch (FrontendException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:38,代码来源:BagToTuple.java

示例11: getOutputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema getOutputSchema(Schema input)
{
  ArrayList<String> bagNames = new ArrayList<String>(input.size() / 2);
  Map<String, String> bagNameToJoinPrefix = new HashMap<String, String>(input.size() / 2);
  Map<String, Integer> bagNameToSize = new HashMap<String, Integer>(input.size() / 2);
  Schema outputSchema = null;
  Schema bagSchema = new Schema();
  try {
    int i = 0;
    // all even fields should be bags, odd fields are key names
    String bagName = null;
    String tupleName = null;
    for (FieldSchema outerField : input.getFields()) {
      if (i++ % 2 == 1)
        continue;
      bagName = outerField.alias;
      bagNames.add(bagName);
      if (bagName == null)
        bagName = "null";
      if (outerField.schema == null)
        throw new RuntimeException("Expected input format of (bag, 'field') pairs. "
            +"Did not receive a bag at index: "+i+", alias: "+bagName+". "
            +"Instead received type: "+DataType.findTypeName(outerField.type)+" in schema:"+input.toString());
      FieldSchema tupleField = outerField.schema.getField(0);
      tupleName = tupleField.alias;
      bagNameToJoinPrefix.put(bagName, getPrefixedAliasName(outerField.alias, tupleName));
      if (tupleField.schema == null) {
        log.error(String.format("could not get schema for inner tuple %s in bag %s", tupleName, bagName));
      } else {
        bagNameToSize.put(bagName, tupleField.schema.size());
        for (FieldSchema innerField : tupleField.schema.getFields()) {
          String innerFieldName = innerField.alias;
          if (innerFieldName == null)
            innerFieldName = "null";
          String outputFieldName = bagName + "::" + innerFieldName;
          if (innerField.schema != null) {
              bagSchema.add(new FieldSchema(outputFieldName, innerField.schema, innerField.type));
          } else {
              bagSchema.add(new FieldSchema(outputFieldName, innerField.type));
          }
        }
      }
    }
    outputSchema = new Schema(new Schema.FieldSchema(
              getSchemaName(this.getClass().getName().toLowerCase(), input),
              bagSchema,
              DataType.BAG));
    log.debug("output schema: "+outputSchema.toString());
  } catch (FrontendException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
  Properties properties = getInstanceProperties();
  properties.put(BAG_NAMES_PROPERTY, bagNames);
  properties.put(BAG_NAME_TO_JOIN_PREFIX_PROPERTY, bagNameToJoinPrefix);
  properties.put(BAG_NAME_TO_SIZE_PROPERTY, bagNameToSize);
  return outputSchema;
}
 
开发者ID:apache,项目名称:incubator-datafu,代码行数:60,代码来源:BagJoin.java

示例12: outputSchema

import org.apache.pig.impl.logicalLayer.FrontendException; //导入方法依赖的package包/类
@Override
public Schema outputSchema(Schema input) {
  try {
    Schema.FieldSchema inputFieldSchema = input.getField(0);

    if (inputFieldSchema.type != DataType.BAG) {
      throw new RuntimeException("Expected a BAG as input");
    }
    
    Schema inputBagSchema = inputFieldSchema.schema;
    
    if (inputBagSchema.getField(0).type != DataType.TUPLE)
    {
        throw new RuntimeException(String.format("Expected input bag to contain a TUPLE, but instead found %s",
                                               DataType.findTypeName(inputBagSchema.getField(0).type)));
    }
    
    Schema tupleSchema = inputBagSchema.getField(0).schema;
    
    if(tupleSchema == null) {
        throw new RuntimeException("The tuple of input bag has no schema");
    }
    
    List<Schema.FieldSchema> fieldSchemaList = tupleSchema.getFields();
    
    if(fieldSchemaList == null || fieldSchemaList.size() <= Math.max(0, this.weightIdx)) {
        throw new RuntimeException("The field schema of the input tuple is null " +
        		                   "or the tuple size is no more than the weight field index: "
                                   + this.weightIdx);
    }
    
    if(fieldSchemaList.get(this.weightIdx).type != DataType.INTEGER &&
       fieldSchemaList.get(this.weightIdx).type != DataType.LONG &&
       fieldSchemaList.get(this.weightIdx).type != DataType.FLOAT &&
       fieldSchemaList.get(this.weightIdx).type != DataType.DOUBLE)
    {
        String[] expectedTypes = new String[] {DataType.findTypeName(DataType.INTEGER),
                                               DataType.findTypeName(DataType.LONG),
                                               DataType.findTypeName(DataType.FLOAT),
                                               DataType.findTypeName(DataType.DOUBLE)};
        throw new RuntimeException("Expect the type of the weight field of the input tuple to be of (" +
                java.util.Arrays.toString(expectedTypes) + "), but instead found (" + 
                DataType.findTypeName(fieldSchemaList.get(this.weightIdx).type) + "), weight field: " + 
                this.weightIdx);
    } 
    
    return new Schema(new Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(), input),
                                             inputFieldSchema.schema, DataType.BAG));    
  } catch (FrontendException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:incubator-datafu,代码行数:54,代码来源:WeightedReservoirSample.java


注:本文中的org.apache.pig.impl.logicalLayer.FrontendException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。