Package org.apache.pig.newplan.logical.expression

Examples of org.apache.pig.newplan.logical.expression.LogicalExpression


     * that can be generated using this expression plan
     * @param exprPlan ExpressionPlan which generates this field
     * @return
     */
    private LogicalFieldSchema getPlanSchema( LogicalExpressionPlan exprPlan ) throws FrontendException {
        LogicalExpression sourceExp = (LogicalExpression) exprPlan.getSources().get(0);
        LogicalFieldSchema planSchema = null;
        planSchema = sourceExp.getFieldSchema().deepCopy();
        planSchema.uid = -1;
        return planSchema;
    }
View Full Code Here


       
        schema = new LogicalSchema();
        outputPlanSchemas = new ArrayList<LogicalSchema>();
       
        for(int i=0; i<outputPlans.size(); i++) {
            LogicalExpression exp = (LogicalExpression)outputPlans.get(i).getSources().get(0);
           
            LogicalSchema mUserDefinedSchemaCopy = null;
            if (mUserDefinedSchema!=null && mUserDefinedSchema.get(i)!=null) {
                mUserDefinedSchemaCopy = new LogicalSchema();
                for (LogicalSchema.LogicalFieldSchema fs : mUserDefinedSchema.get(i).getFields()) {
                    mUserDefinedSchemaCopy.addField(fs.deepCopy());
                }
            }
           
            LogicalFieldSchema fieldSchema = null;
           
            LogicalSchema expSchema = null;
           
            if (exp.getFieldSchema()!=null) {
           
                fieldSchema = exp.getFieldSchema().deepCopy();
               
                expSchema = new LogicalSchema();
                if (fieldSchema.type != DataType.TUPLE && fieldSchema.type != DataType.BAG) {
                    // if type is primitive, just add to schema
                    if (fieldSchema!=null)
View Full Code Here

            List<LogicalExpressionPlan> expPlans = gen.getOutputPlans();
           
            List<Long> uidSeen = new ArrayList<Long>();
           
            for (LogicalExpressionPlan expPlan : expPlans) {
                LogicalExpression exp = (LogicalExpression)expPlan.getSources().get(0);
                if (exp.getFieldSchema()!=null) {
                    long uid = exp.getFieldSchema().uid;
                    if (uidSeen.contains(uid)) {
                        expPlansToInsertIdentity.add(expPlan);
                    }
                    else {
                        uidSeen.add(uid);
View Full Code Here

        }

        @Override
        public void transform(OperatorPlan matched) throws FrontendException {
            for (LogicalExpressionPlan expPlan : expPlansToInsertIdentity) {
                LogicalExpression oldRoot = (LogicalExpression)expPlan.getSources().get(0);
                UserFuncExpression userFuncExpression = new UserFuncExpression(expPlan, new FuncSpec(IdentityColumn.class.getName()));
                expPlan.connect(userFuncExpression, oldRoot);
            }
            expPlansToInsertIdentity.clear();
        }
View Full Code Here

             for(int i=0; i<ll.size(); i++) {
                 if (!gen.getFlattenFlags()[i]) {
                     continue;
                 }
                 LogicalExpressionPlan exp = ll.get(i);
                 LogicalExpression sink = (LogicalExpression)exp.getSources().get(0);
                 if (sink.getFieldSchema().type!=DataType.TUPLE && sink.getFieldSchema().type!=DataType.BAG)
                     continue;
                 List<Operator> srcs = exp.getSinks();
                 for (Operator src : srcs) {
                     if (!(src instanceof ProjectExpression))
                         continue;
View Full Code Here

                if( predecessor instanceof LOCogroup ) {
                    for( ProjectExpression projExpr : projExprs ) {
                        // Need to merge filter condition and cogroup by expression;
                        LogicalExpressionPlan plan = ((LOCogroup) predecessor).getExpressionPlans().get( inputIndex ).iterator().next();
                        LogicalExpressionPlan copy = plan.deepCopy();
                        LogicalExpression root = (LogicalExpression)copy.getSinks().get( 0 );
                        List<Operator> predecessors = fPlan.getPredecessors( projExpr );
                        if( predecessors == null || predecessors.size() == 0 ) {
                            fPlan.remove( projExpr );
                            fPlan.add( root );
                        } else {
View Full Code Here

  private boolean filterRemovable = false;

  @Override
  public void visit() throws FrontendException {
    // we will visit the leaf and it will recursively walk the plan
    LogicalExpression leaf = (LogicalExpression)plan.getSources().get( 0 );
    // if the leaf is a unary operator it should be a FilterFunc in
    // which case we don't try to extract partition filter conditions
    if(leaf instanceof BinaryExpression) {
      BinaryExpression binExpr = (BinaryExpression)leaf;
      visit( binExpr );
View Full Code Here

    if( !( childExpr instanceof BinaryExpression ) ) {
      throwException();
    }
    // child's lhs operand
    LogicalExpression leftChild =
      ((BinaryExpression)childExpr).getLhs();
    // child's rhs operand
    LogicalExpression rightChild =
      ((BinaryExpression)childExpr).getRhs();

    plan.disconnect( childExpr, leftChild );
    plan.disconnect( childExpr, rightChild );
View Full Code Here

            List<LogicalExpressionPlan> exprs = gen.getOutputPlans();
            for( int i = 0; i < exprs.size(); i++ ) {
                LogicalExpressionPlan expr = exprs.get( i );
                if( gen.getFlattenFlags()[i] )
                    continue;
                LogicalExpression e = (LogicalExpression)expr.getSources().get( 0 );
                uids.add( e.getFieldSchema().uid );
            }
           
            return uids;
        }
View Full Code Here

           
            @Override
            public void visit(UserFuncExpression userFunc) throws FrontendException {
                List<Operator> succs = userFunc.getPlan().getSuccessors(userFunc);
                if (succs==null) return;
                LogicalExpression succ = (LogicalExpression)succs.get(0);
                if (succ.getFieldSchema()!=null && succ.getFieldSchema().type==DataType.MAP)
                    fullMapUids.add(succ.getFieldSchema().uid);
            }
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.logical.expression.LogicalExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.