本文整理汇总了Java中org.apache.pig.impl.logicalLayer.FrontendException类的典型用法代码示例。如果您正苦于以下问题:Java FrontendException类的具体用法?Java FrontendException怎么用?Java FrontendException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FrontendException类属于org.apache.pig.impl.logicalLayer包,在下文中一共展示了FrontendException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pushProjection
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Override
public RequiredFieldResponse pushProjection(RequiredFieldList requiredFieldList) throws FrontendException {
if (requiredFieldList == null)
return null;
if (!useDefaultSchema && requiredFieldList.getFields() != null)
{
requiredFields = new boolean[fields.length];
for (RequiredField f : requiredFieldList.getFields()) {
requiredFields[f.getIndex()] = true;
}
UDFContext udfc = UDFContext.getUDFContext();
Properties p = udfc.getUDFProperties(this.getClass(), new String[]{ udfContextSignature });
try {
p.setProperty(REQUIRED_FIELDS_SIGNATURE, ObjectSerializer.serialize(requiredFields));
} catch (Exception e) {
throw new RuntimeException("Cannot serialize requiredFields for pushProjection");
}
}
return new RequiredFieldResponse(true);
}
示例2: buildElNinoInputSchema
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
private Schema buildElNinoInputSchema() throws FrontendException {
// Build Field Schema
List<FieldSchema> fieldSchemas = new ArrayList<FieldSchema>();
fieldSchemas.add(new Schema.FieldSchema("buoy_day_ID", DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("buoy" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("day" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("latitude" , DataType.DOUBLE ));
fieldSchemas.add(new Schema.FieldSchema("longitude" , DataType.DOUBLE ));
fieldSchemas.add(new Schema.FieldSchema("zon_winds" , DataType.DOUBLE ));
fieldSchemas.add(new Schema.FieldSchema("mer_winds" , DataType.DOUBLE ));
fieldSchemas.add(new Schema.FieldSchema("humidity" , DataType.DOUBLE ));
fieldSchemas.add(new Schema.FieldSchema("airtemp" , DataType.DOUBLE ));
fieldSchemas.add(new Schema.FieldSchema("s_s_temp" , DataType.DOUBLE ));
return new Schema(fieldSchemas);
}
示例3: buildAuditInputSchema
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
private Schema buildAuditInputSchema() throws FrontendException {
// Build Field Schema
List<FieldSchema> fieldSchemas = new ArrayList<FieldSchema>();
fieldSchemas.add(new Schema.FieldSchema("id" , DataType.LONG));
fieldSchemas.add(new Schema.FieldSchema("age" , DataType.INTEGER));
fieldSchemas.add(new Schema.FieldSchema("employment" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("education" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("marital" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("occupation" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("income" , DataType.DOUBLE));
fieldSchemas.add(new Schema.FieldSchema("gender" , DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("deductions" , DataType.DOUBLE));
fieldSchemas.add(new Schema.FieldSchema("hours" , DataType.INTEGER));
fieldSchemas.add(new Schema.FieldSchema("ignore_accounts", DataType.CHARARRAY));
fieldSchemas.add(new Schema.FieldSchema("risk_adjustment", DataType.INTEGER));
fieldSchemas.add(new Schema.FieldSchema("target_adjusted", DataType.INTEGER));
return new Schema(fieldSchemas);
}
示例4: outputSchema
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
/**
* The output is a Sketch Result Tuple Schema.
*/
@Override
public Schema outputSchema(final Schema input) {
if (input != null) {
try {
final Schema tupleSchema = new Schema();
tupleSchema.add(new Schema.FieldSchema("Estimate", DataType.DOUBLE));
tupleSchema.add(new Schema.FieldSchema("UpperBound", DataType.DOUBLE));
tupleSchema.add(new Schema.FieldSchema("LowerBound", DataType.DOUBLE));
return new Schema(new Schema.FieldSchema(getSchemaName(this
.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
}
catch (final FrontendException e) {
// fall through
}
}
return null;
}
示例5: outputSchema
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
/**
* The output consists of two longs, or 128 bits, plus the result of the modulo division if
* specified.
*/
@Override
public Schema outputSchema(final Schema input) {
if (input != null) {
try {
final Schema tupleSchema = new Schema();
tupleSchema.add(new Schema.FieldSchema("Hash0", DataType.LONG));
tupleSchema.add(new Schema.FieldSchema("Hash1", DataType.LONG));
tupleSchema.add(new Schema.FieldSchema("ModuloResult", DataType.INTEGER));
return new Schema(new Schema.FieldSchema(getSchemaName(this
.getClass().getName().toLowerCase(), input), tupleSchema, DataType.TUPLE));
}
catch (final FrontendException e) {
//fall through
}
}
return null;
}
示例6: outputSchema
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Override
public Schema outputSchema(final Schema input) {
try {
if (input == null || input.size() == 0
|| input.getField(0).type != DataType.BYTEARRAY) {
throw new IllegalArgumentException("Input to GetVarOptSamples must be a DataByteArray: "
+ (input == null ? "null" : input.toString()));
}
final Schema weightedSampleSchema = new Schema();
weightedSampleSchema.add(new Schema.FieldSchema(WEIGHT_ALIAS, DataType.DOUBLE));
weightedSampleSchema.add(new Schema.FieldSchema(RECORD_ALIAS, DataType.TUPLE));
return new Schema(new Schema.FieldSchema(getSchemaName(this
.getClass().getName().toLowerCase(), input), weightedSampleSchema, DataType.BAG));
} catch (final FrontendException e) {
throw new RuntimeException(e);
}
}
示例7: degenerateSchemaTest
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Test
public void degenerateSchemaTest() throws FrontendException {
final ReservoirUnion ru = new ReservoirUnion("5");
Schema output = ru.outputSchema(null);
assertNull(output);
output = ru.outputSchema(new Schema());
assertNull(output);
final Schema tupleSchema = new Schema();
tupleSchema.add(new Schema.FieldSchema("field1", DataType.CHARARRAY));
tupleSchema.add(new Schema.FieldSchema("field2", DataType.INTEGER));
final Schema recordSchema = new Schema();
recordSchema.add(new Schema.FieldSchema("record", tupleSchema, DataType.TUPLE));
output = ru.outputSchema(new Schema());
assertNull(output);
}
示例8: deepCopy
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Override
public LogicalExpression deepCopy(LogicalExpressionPlan lgExpPlan) throws FrontendException {
List<Integer> columnsCopy = new ArrayList<Integer>(this.getBagColumns());
DereferenceExpression copy = new DereferenceExpression(
lgExpPlan,
columnsCopy);
List<Object> rawColumnsCopy = new ArrayList<Object>( this.rawColumns );
copy.setRawColumns( rawColumnsCopy );
// Only one input is expected.
LogicalExpression input = (LogicalExpression) plan.getSuccessors( this ).get( 0 );
LogicalExpression inputCopy = input.deepCopy( lgExpPlan );
lgExpPlan.add( inputCopy );
lgExpPlan.connect( copy, inputCopy );
copy.setLocation( new SourceLocation( location ) );
return copy;
}
示例9: testRemove5
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Test
public void testRemove5() throws FrontendException {
// has multiple outputs
SillyPlan plan = new SillyPlan();
Operator load1 = new SillyOperator("load1", plan);
Operator split1 = new SillyOperator("split1", plan);
Operator split2 = new SillyOperator("split2", plan);
Operator filter1 = new SillyOperator("filter1", plan);
Operator filter2 = new SillyOperator("filter2", plan);
plan.add(load1);
plan.add(split1);
plan.add(filter1);
plan.add(filter2);
plan.connect(load1, split1);
plan.connect(split1, split2);
plan.connect(split2, filter1);
plan.connect(split2, filter2);
plan.removeAndReconnect(split2);
List<Operator> succs = plan.getSuccessors(split1);
assertEquals(2, succs.size());
assertTrue(succs.contains(filter1));
assertTrue(succs.contains(filter2));
}
示例10: createDummyRelOpWithAlias
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
/**
* @return a dummy logical relational operator
*/
private LogicalRelationalOperator createDummyRelOpWithAlias() {
class DummyRelOp extends LogicalRelationalOperator{
DummyRelOp(){
super("dummy", new LogicalPlan());
this.alias = "dummy";
}
@Override
public LogicalSchema getSchema() throws FrontendException {
return null;
}
@Override
public void accept(PlanVisitor v) throws FrontendException {
}
@Override
public boolean isEqual(Operator operator) throws FrontendException {
return false;
}
}
return new DummyRelOp();
}
示例11: setName
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
/**
* This method sets the name of a RubySchema to the name given. It's important to note that
* if the RubySchema represents anything other than a tuple, databag, or map then an error
* will be thrown.
*
* @param name a String to set the name of the encapsulated Schema object
*/
private void setName(String name) {
Schema.FieldSchema fs;
try {
fs = internalSchema.getField(0);
} catch (FrontendException e) {
throw new RuntimeException("Error getting field from schema: " + internalSchema, e);
}
byte type = fs.type;
if (type == DataType.TUPLE || type == DataType.BAG || type == DataType.MAP) {
fs.alias = name;
} else {
throw new RuntimeException("setName cannot be set on Schema: " + internalSchema);
}
}
示例12: deepCopy
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Override
public LogicalExpression deepCopy(LogicalExpressionPlan lgExpPlan) throws FrontendException {
ProjectExpression copy = new ProjectExpression(
lgExpPlan,
this.getInputNum(),
this.getColNum(),
this.getAttachedRelationalOp());
copy.setLocation( new SourceLocation( location ) );
copy.alias = alias;
copy.isRangeProject = this.isRangeProject;
copy.startCol = this.startCol;
copy.endCol = this.endCol;
copy.startAlias = this.startAlias;
copy.endAlias = this.endAlias;
return copy;
}
示例13: testLoadEqualityDifferentFuncSpecCtorArgs
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
@Test
public void testLoadEqualityDifferentFuncSpecCtorArgs() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema aschema1 = new LogicalSchema();
aschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad load1 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "y" })), aschema1, lp,
conf);
lp.add(load1);
LOLoad load2 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "z" })), aschema1, lp,
conf);
lp.add(load2);
assertFalse(load1.isEqual(load2));
}
示例14: disconnect
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
/**
* Disconnect two operators in the plan.
* @param from Operator edge is coming from
* @param to Operator edge is going to
* @return pair of positions, indicating the position in the from and
* to arrays.
* @throws FrontendException if the two operators aren't connected.
*/
public Pair<Integer, Integer> disconnect(Operator from,
Operator to) throws FrontendException {
Pair<Operator, Integer> f = fromEdges.removeWithPosition(from, to);
if (f == null) {
throw new FrontendException("Attempt to disconnect operators " +
from.getName() + " and " + to.getName() +
" which are not connected.", 2219);
}
Pair<Operator, Integer> t = toEdges.removeWithPosition(to, from);
if (t == null) {
throw new FrontendException("Plan in inconssistent state " +
from.getName() + " and " + to.getName() +
" connected in fromEdges but not toEdges.", 2220);
}
markDirty();
return new Pair<Integer, Integer>(f.second, t.second);
}
示例15: getProjectExpList
import org.apache.pig.impl.logicalLayer.FrontendException; //导入依赖的package包/类
private List<LogicalExpression> getProjectExpList(List<LogicalExpressionPlan> lexpPlanList,
LogicalRelationalOperator lro) throws FrontendException {
List<LogicalExpression> leList = new ArrayList<LogicalExpression>();
for (int i = 0; i < lexpPlanList.size(); i++) {
LogicalExpressionPlan lexp = lexpPlanList.get(i);
LogicalExpression lex = (LogicalExpression) lexp.getSources().get(0);
Iterator<Operator> opers = lexp.getOperators();
// ProjExpr are initially attached to CubeOp. So re-attach it to
// specified operator
while (opers.hasNext()) {
Operator oper = opers.next();
try {
((ProjectExpression) oper).setAttachedRelationalOp(lro);
} catch (ClassCastException cce) {
throw new FrontendException("Column project expected.", cce);
}
}
leList.add(lex);
}
return leList;
}