Java Code Examples for org.apache.pig.impl.logicalLayer.FrontendException

The following examples show how to use org.apache.pig.impl.logicalLayer.FrontendException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spork   Source File: PreprocessorContext.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This method generates parameter value by running specified command
 *
 * @param key - parameter name
 * @param val - string containing command to be executed
 */
public  void processShellCmd(String key, String val, Boolean overwrite)  throws ParameterSubstitutionException, FrontendException {
    if (pigContext != null) {
        BlackAndWhitelistFilter filter = new BlackAndWhitelistFilter(pigContext);
        filter.validate(PigCommandFilter.Command.SH);
    }

    if (param_val.containsKey(key)) {
        if (param_source.get(key).equals(val) || !overwrite) {
            return;
        } else {
            log.warn("Warning : Multiple values found for " + key
                    + ". Using value " + val);
        }
    }

    param_source.put(key, val);

    val = val.substring(1, val.length()-1); //to remove the backticks
    String sub_val = substitute(val);
    sub_val = executeShellCommand(sub_val);
    param_val.put(key, sub_val);
}
 
Example 2
Source Project: spork   Source File: TestMultiStorageCompression.java    License: Apache License 2.0 6 votes vote down vote up
private void runQuery(String outputPath, String compressionType)
      throws Exception, ExecException, IOException, FrontendException {

   // create a data file
   String filename = TestHelper.createTempFile(data, "");
   PigServer pig = new PigServer(LOCAL);
   filename = filename.replace("\\", "\\\\");
   patternString = patternString.replace("\\", "\\\\");
   String query = "A = LOAD '" + Util.encodeEscape(filename)
         + "' USING PigStorage(',') as (a,b,c);";

   String query2 = "STORE A INTO '" + Util.encodeEscape(outputPath)
         + "' USING org.apache.pig.piggybank.storage.MultiStorage" + "('"
         + Util.encodeEscape(outputPath) + "','0', '" + compressionType + "', '\\t');";

   // Run Pig
   pig.setBatchOn();
   pig.registerQuery(query);
   pig.registerQuery(query2);

   pig.executeBatch();
}
 
Example 3
Source Project: parquet-mr   Source File: TupleReadSupport.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param fileSchema the parquet schema from the file
 * @param keyValueMetaData the extra meta data from the files
 * @return the pig schema according to the file
 */
static Schema getPigSchemaFromMultipleFiles(MessageType fileSchema, Map<String, Set<String>> keyValueMetaData) {
  Set<String> pigSchemas = PigMetaData.getPigSchemas(keyValueMetaData);
  if (pigSchemas == null) {
    return pigSchemaConverter.convert(fileSchema);
  }
  Schema mergedPigSchema = null;
  for (String pigSchemaString : pigSchemas) {
    try {
      mergedPigSchema = union(mergedPigSchema, parsePigSchema(pigSchemaString));
    } catch (FrontendException e) {
      throw new ParquetDecodingException("can not merge " + pigSchemaString + " into " + mergedPigSchema, e);
    }
  }
  return mergedPigSchema;
}
 
Example 4
Source Project: spork   Source File: TestPigStorage.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testPigStorageNoSchema() throws Exception {
    //if the schema file does not exist, and '-schema' option is used
    // it should result in an error
    pigContext.connect();
    String query = "a = LOAD '" + datadir + "originput' using PigStorage('\\t', '-schema') " +
    "as (f1:chararray, f2:int);";
    try{
        pig.registerQuery(query);
        pig.dumpSchema("a");
    }catch(FrontendException ex){
        assertEquals(ex.toString(), 1000, ex.getErrorCode());
        return;
    }
    fail("no exception caught");
}
 
Example 5
Source Project: datafu   Source File: EmptyBagToNullFields.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Schema outputSchema(Schema input)
{
  try
  {
    if (input.size() != 1)
    {
      throw new RuntimeException("Expected only a single field as input");
    }
    
    if (input.getField(0).type != DataType.BAG)
    {
      throw new RuntimeException("Expected a BAG as input, but found " + DataType.findTypeName(input.getField(0).type));
    }
    
    // get the size of the tuple within the bag
    int innerTupleSize = input.getField(0).schema.getField(0).schema.getFields().size();
    getInstanceProperties().put("tuplesize", innerTupleSize);
  }
  catch (FrontendException e)
  {
    throw new RuntimeException(e);
  }
  return input;
}
 
Example 6
Source Project: spork   Source File: TypeCheckingExpVisitor.java    License: Apache License 2.0 6 votes vote down vote up
private void insertCastsForUDF(UserFuncExpression func, Schema fromSch, Schema toSch, SchemaType toSchType)
throws FrontendException {
    List<FieldSchema> fsLst = fromSch.getFields();
    List<FieldSchema> tsLst = toSch.getFields();
    List<LogicalExpression> args = func.getArguments();
    int i=-1;
    for (FieldSchema fFSch : fsLst) {
        ++i;
        //if we get to the vararg field (if defined) : take it repeatedly
        FieldSchema tFSch = ((toSchType == SchemaType.VARARG) && i >= tsLst.size()) ? 
                tsLst.get(tsLst.size() - 1) : tsLst.get(i);
        if (fFSch.type == tFSch.type) {
            continue;
        }
        insertCast(func, Util.translateFieldSchema(tFSch), args.get(i));
    }
}
 
Example 7
Source Project: spork   Source File: ColumnPruneHelper.java    License: Apache License 2.0 6 votes vote down vote up
private void collectUids(LogicalRelationalOperator currentOp, LogicalExpressionPlan exp, Set<Long> uids) throws FrontendException {
    List<Operator> ll = exp.getSinks();
    for(Operator op: ll) {
        if (op instanceof ProjectExpression) {
            if (!((ProjectExpression)op).isRangeOrStarProject()) {
                long uid = ((ProjectExpression)op).getFieldSchema().uid;
                uids.add(uid);
            } else {
                LogicalRelationalOperator ref = ((ProjectExpression)op).findReferent();
                LogicalSchema s = ref.getSchema();
                if (s == null) {
                    throw new SchemaNotDefinedException("Schema not defined for " + ref.getAlias());
                }
                for(LogicalFieldSchema f: s.getFields()) {
                    uids.add(f.uid);
                }
            }
        }
    }
}
 
Example 8
Source Project: spork   Source File: TestStore.java    License: Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 9
Source Project: datafu   Source File: TupleFromBag.java    License: Apache License 2.0 6 votes vote down vote up
@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);
	}
}
 
Example 10
Source Project: spork   Source File: TypeCheckingRelVisitor.java    License: Apache License 2.0 6 votes vote down vote up
/***
 * Return concatenated of all fields from all input operators
 * If one of the inputs have no schema then we cannot construct
 * the output schema.
 * @param cs
 * @throws VisitorException
 */
public void visit(LOCross cs) throws VisitorException {
    cs.resetSchema();

    try {
        // Compute the schema
        cs.getSchema() ;
    }
    catch (FrontendException fe) {
        int errCode = 1055;
        String msg = "Problem while reading"
            + " schemas from inputs of Cross" ;
        msgCollector.collect(msg, MessageType.Error) ;
        throwTypeCheckerException(cs, msg, errCode, PigException.INPUT, fe) ;
    }
}
 
Example 11
Source Project: spork   Source File: TypeCheckingRelVisitor.java    License: Apache License 2.0 6 votes vote down vote up
/***
 *  LODistinct, output schema should be the same as input
 * @param op
 * @throws VisitorException
 */

@Override
public void visit(LODistinct op) throws VisitorException {
    op.resetSchema();

    try {
        // Compute the schema
        op.getSchema() ;
    }
    catch (FrontendException fe) {
        int errCode = 1055;
        String msg = "Problem while reading"
            + " schemas from inputs of Distinct" ;
        msgCollector.collect(msg, MessageType.Error) ;
        throwTypeCheckerException(op, msg, errCode, PigException.INPUT, fe) ;
    }
}
 
Example 12
Source Project: spork   Source File: ProjStarInUdfExpander.java    License: Apache License 2.0 6 votes vote down vote up
protected ProjExpanderForForeach(
        OperatorPlan p, 
        LOGenerate loGen, 
        Map<Integer, LogicalRelationalOperator> oldPos2Rel,
        Map<ProjectExpression, LogicalRelationalOperator> proj2InpRel,
        LOForEach foreach,
        List<LOInnerLoad> expandedInLoads
)
throws FrontendException {
    super(p, new ReverseDependencyOrderWalker(p));
    this.loGen = loGen;
    this.innerRelPlan = (LogicalPlan) loGen.getPlan();
    this.oldPos2Rel = oldPos2Rel;
    this.proj2InpRel = proj2InpRel;
    this.foreach = foreach;
    this.expandedInLoads = expandedInLoads;
    
}
 
Example 13
Source Project: spork   Source File: TestGrunt.java    License: Apache License 2.0 6 votes vote down vote up
@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 '\"'"));
    }
}
 
Example 14
Source Project: spork   Source File: ColumnPruneHelper.java    License: Apache License 2.0 6 votes vote down vote up
private OperatorSubPlan getSubPlan() throws FrontendException {
    OperatorSubPlan p = null;
    if (currentPlan instanceof OperatorSubPlan) {
        p = new OperatorSubPlan(((OperatorSubPlan)currentPlan).getBasePlan());
    } else {
        p = new OperatorSubPlan(currentPlan);
    }
    Iterator<Operator> iter = currentPlan.getOperators();

    while(iter.hasNext()) {
        Operator op = iter.next();
        if (op instanceof LOForEach) {
            addOperator(op, p);
        }
    }

    return p;
}
 
Example 15
Source Project: spork   Source File: ExpToPhyTranslationVisitor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void visit( MapLookupExpression op ) throws FrontendException {
    ExpressionOperator physOp = new POMapLookUp(new OperatorKey(DEFAULT_SCOPE,
            nodeGen.getNextNodeId(DEFAULT_SCOPE)));
    ((POMapLookUp)physOp).setLookUpKey(op.getLookupKey() );
    physOp.setResultType(op.getType());
    physOp.addOriginalLocation(op.getFieldSchema().alias, op.getLocation());
    currentPlan.add(physOp);

    logToPhyMap.put(op, physOp);

    ExpressionOperator from = (ExpressionOperator) logToPhyMap.get(op
            .getMap());
    try {
        currentPlan.connect(from, physOp);
    } catch (PlanException e) {
        int errCode = 2015;
        String msg = "Invalid physical operators in the physical plan" ;
        throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
    }
}
 
Example 16
Source Project: spork   Source File: TestBlackAndWhitelistValidator.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Tests {@link BlackAndWhitelistValidator}. The logical plan generated
 * contains a filter, and the test must throw a {@link FrontendException} as
 * we set "filter" in the blacklist
 * 
 * @throws Exception
 */
@Test
public void testValidator() throws Exception {
    try {
        // disabling filter
        ctx.getProperties().setProperty(PigConfiguration.PIG_BLACKLIST, "filter");

        LogicalPlan plan = generateLogicalPlan("foo", "bar", ctx.getDfs());

        LogicalRelationalNodeValidator executor = new BlackAndWhitelistValidator(ctx, plan);
        executor.validate();
        fail();
    } catch (Exception e) {
        Util.assertExceptionAndMessage(FrontendException.class, e,
                "filter is disabled. ");
    }
}
 
Example 17
Source Project: spork   Source File: JsFunction.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * converts a tuple to javascript object based on a schema
 * @param tuple the tuple to convert
 * @param schema the schema to use for conversion
 * @param depth call depth used for debugging messages
 * @return the resulting javascript object 
 */
@SuppressWarnings("unchecked")
private Scriptable pigTupleToJS(Tuple tuple, Schema schema, int depth) throws FrontendException, ExecException {
    debugConvertPigToJS(depth, "Tuple", tuple, schema);
    Scriptable object = null;
    if (tuple != null) {
        object = jsScriptEngine.jsNewObject(); 

        for (int i = 0; i < schema.size(); i++) {
            FieldSchema field = schema.getField(i);
            Object value;
            if (field.type == DataType.BAG) {
                value = pigBagToJS((DataBag)tuple.get(i), field.schema, depth + 1);
            } else if (field.type == DataType.TUPLE) {
                value = pigTupleToJS((Tuple)tuple.get(i), field.schema, depth + 1);
            } else if (field.type == DataType.MAP) {
                value = pigMapToJS((Map<String, Object>)tuple.get(i), field.schema, depth + 1);
            } else {
                debugConvertPigToJS(depth+1, "value", tuple.get(i), field.schema);
                value = Context.javaToJS(tuple.get(i), jsScriptEngine.getScope());
                debugReturn(depth + 1, value);
            }
            object.put(field.alias, object, value);
        }
    }
    debugReturn(depth, object);
    return object;
}
 
Example 18
Source Project: spork   Source File: GetMonth.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
    List<FuncSpec> funcList = new ArrayList<FuncSpec>();
    funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.DATETIME))));

    return funcList;
}
 
Example 19
Source Project: spork   Source File: LOInnerLoad.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public LogicalSchema getSchema() throws FrontendException {
    if (schema!=null)
        return schema;
    
    if (prj.findReferent().getSchema()!=null && prj.getFieldSchema()!=null) {
        if (prj.getFieldSchema().type==DataType.BAG) {
            sourceIsBag = true;
            alias = prj.getFieldSchema().alias;
            if (prj.getFieldSchema().schema!=null) {
                LogicalFieldSchema tupleSchema = prj.getFieldSchema().schema.getField(0);
                if (tupleSchema!=null && tupleSchema.schema!=null) {
                    schema = new LogicalSchema();
                    for (int i=0;i<tupleSchema.schema.size();i++)
                        schema.addField(tupleSchema.schema.getField(i));
                }
            }
        }
        else {
            schema = new LogicalSchema();
            schema.addField(prj.getFieldSchema());
        }
    } else if (!prj.isRangeOrStarProject()) {
        schema = new LogicalSchema();
        schema.addField(new LogicalFieldSchema(null, null, DataType.BYTEARRAY));
    }
    return schema;
}
 
Example 20
Source Project: spork   Source File: BagToString.java    License: Apache License 2.0 5 votes vote down vote up
@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;
	}
}
 
Example 21
Source Project: spork   Source File: LOSort.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public LogicalSchema getSchema() throws FrontendException {
    if (schema!=null)
        return schema;
    
    LogicalRelationalOperator input = null;
    input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
    
    schema = input.getSchema();
    return schema;
}
 
Example 22
Source Project: spork   Source File: LOFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void accept(PlanVisitor v) throws FrontendException {
    if (!(v instanceof LogicalRelationalNodesVisitor)) {
        throw new FrontendException("Expected LogicalPlanVisitor", 2223);
    }
    ((LogicalRelationalNodesVisitor)v).visit(this);
}
 
Example 23
Source Project: spork   Source File: OptimizeLimitPlanPrinter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void visit(LOLimit loLimit) throws FrontendException {
    appendOp(loLimit) ;
    sb.append(" [limit=\""+loLimit.getLimit()+"\"]");
    sb.append(";\n");
    appendEdges(loLimit);
}
 
Example 24
Source Project: spork   Source File: TestNewPlanOperatorPlan.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testReplace2() throws FrontendException {
    // has multiple outputs
    SillyPlan plan = new SillyPlan();
    Operator load1 = new SillyOperator("load1", plan);
    Operator split1 = new SillyOperator("split1", 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, filter1);
    plan.connect(split1, filter2);

    Operator split2 = new SillyOperator("split2", plan);
    plan.replace(split1, split2);

    List<Operator> preds = plan.getPredecessors(split2);
    assertEquals(1, preds.size());
    assertTrue(preds.contains(load1));

    List<Operator> succs = plan.getSuccessors(split2);
    assertEquals(2, succs.size());
    assertTrue(succs.contains(filter1));
    assertTrue(succs.contains(filter2));
}
 
Example 25
Source Project: spork   Source File: ExpToPhyTranslationVisitor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
    public void visit(ProjectExpression op) throws FrontendException {
        POProject exprOp;
       
        if(op.getAttachedRelationalOp() instanceof LOGenerate && op.getPlan().getSuccessors(op)==null &&
            !(op.findReferent() instanceof LOInnerLoad)) {
            exprOp = new PORelationToExprProject(new OperatorKey(DEFAULT_SCOPE, nodeGen
                .getNextNodeId(DEFAULT_SCOPE)));
         } else {
            exprOp = new POProject(new OperatorKey(DEFAULT_SCOPE, nodeGen
                .getNextNodeId(DEFAULT_SCOPE)));
        }
        
        if (op.getFieldSchema()==null && op.isRangeOrStarProject())
            exprOp.setResultType(DataType.TUPLE);
        else
            exprOp.setResultType(op.getType());
        if(op.isProjectStar()){
            exprOp.setStar(op.isProjectStar());
        }
        else if(op.isRangeProject()){
            if(op.getEndCol() != -1){
                //all other project-range should have been expanded by
                // project-star expander
                throw new AssertionError("project range that is not a " +
                "project-to-end seen in translation to physical plan!");
            }
            exprOp.setProjectToEnd(op.getStartCol());
        }else {
            exprOp.setColumn(op.getColNum());
        }
        // TODO implement this
//        exprOp.setOverloaded(op.getOverloaded());
        logToPhyMap.put(op, exprOp);
        currentPlan.add(exprOp);        
    }
 
Example 26
Source Project: spork   Source File: SIGNUM.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
    List<FuncSpec> funcList = new ArrayList<FuncSpec>();
    funcList.add(new FuncSpec(this.getClass().getName(), new Schema(new Schema.FieldSchema(null, DataType.BYTEARRAY))));
    funcList.add(new FuncSpec(DoubleSignum.class.getName(),  new Schema(new Schema.FieldSchema(null, DataType.DOUBLE))));
    funcList.add(new FuncSpec(FloatSignum.class.getName(),   new Schema(new Schema.FieldSchema(null, DataType.FLOAT))));
    return funcList;
}
 
Example 27
Source Project: spork   Source File: OptimizerUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to determine if the logical expression plan for a Filter contains
 * non-deterministic operations and should therefore be treated extra carefully
 * during optimization.
 *
 * @param filterPlan
 * @return true of the filter plan contains a non-deterministic UDF
 * @throws FrontendException 
 */
public static boolean planHasNonDeterministicUdf(LogicalExpressionPlan filterPlan)
throws FrontendException {
    Iterator<Operator> it = filterPlan.getOperators();
    while( it.hasNext() ) {
        Operator op = it.next();
        if( op instanceof UserFuncExpression ) {
            if(! ((UserFuncExpression)op).isDeterministic() ){
                return true;
            }
        }
    }
    return false;
}
 
Example 28
Source Project: spork   Source File: LORank.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void accept(PlanVisitor v) throws FrontendException {
    if (!(v instanceof LogicalRelationalNodesVisitor)) {
        throw new FrontendException("Expected LogicalPlanVisitor", 2223);
    }
    ((LogicalRelationalNodesVisitor)v).visit(this);
}
 
Example 29
Source Project: spork   Source File: MapLookupExpression.java    License: Apache License 2.0 5 votes vote down vote up
public LogicalExpression getMap() throws FrontendException {
    List<Operator> preds = plan.getSuccessors(this);
    if(preds == null) {
        return null;
    }
    return (LogicalExpression)preds.get(0);
}
 
Example 30
Source Project: spork   Source File: TestUDF.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<FuncSpec> getArgToFuncMapping() throws FrontendException {
    List<FuncSpec> l = new ArrayList<FuncSpec>();
    Schema s1 = new Schema(new Schema.FieldSchema(null,DataType.INTEGER));
    l.add(new FuncSpec(this.getClass().getName(), s1));
    return l;
}