Package org.apache.pig.newplan.logical.relational.LogicalSchema

Examples of org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema


                // add a logical schema for dimensions that are pushed from
                // predecessor of cube/rollup
                if (oper instanceof ProjectExpression) {
                    LogicalSchema output = new LogicalSchema();
                    output.addField(new LogicalFieldSchema(
                        ((ProjectExpression) oper).getColAlias(), null, DataType.NULL));
                    genOutputSchema.add(output);
                } else if (oper instanceof UserFuncExpression) {
                    // add logical schema for dimensions specified in
                    // cube/rollup operator
                    LogicalSchema output = new LogicalSchema();
                    for (Operator op : ((UserFuncExpression) oper).getPlan().getSinks()) {
                        output.addField(new LogicalFieldSchema(((ProjectExpression) op)
                                .getFieldSchema()));
                    }
                    genOutputSchema.add(output);
                }
View Full Code Here


                            projExpr.setAttachedRelationalOp( op );
                        }
                    }
                }
                LogicalExpression root = (LogicalExpression)planCopy.getSources().get( 0 );// get the root of the plan
                LogicalFieldSchema schema;
                try {
                    schema = root.getFieldSchema();
                    if (schema.alias == null) {
                        schema.alias = colAlias;
                    }
View Full Code Here

            // No cached uid. Allocate one, and locate and cache all inputs.
            if (uid==-1) {
                uid = LogicalExpression.getNextUid();
                for (LogicalSchema inputSchema : inputSchemas) {
                    long inputUid;
                    LogicalFieldSchema matchedInputFieldSchema;
                  if (onSchema) {
                      matchedInputFieldSchema = inputSchema.getFieldSubNameMatch(mergedSchema.getField(i).alias);
                        if (matchedInputFieldSchema!=null) {
                            inputUid = matchedInputFieldSchema.uid;
                            uidMapping.add(new Pair<Long, Long>(uid, inputUid));
View Full Code Here

            if(schema.size() == 0)
                return null;
            funcSpec = uid2LoadFuncMap.get(schema.getField(0).uid);
            if(funcSpec != null) {
                for(int i=1; i<schema.size(); i++){
                    LogicalFieldSchema fs = schema.getField(i);
                    if(! haveIdenticalCasters(funcSpec,
                            uid2LoadFuncMap.get(fs.uid))){
                        //all uid are not associated with same func spec, there is no
                        // single func spec that represents all the fields
                        funcSpec = null;
View Full Code Here

                + split;
            throw new VisitorException(split, msg,2261, PigException.BUG) ;
        }

        for(int i=0; i<inputSch.size(); i++){
            LogicalFieldSchema inField = inputSch.getField(i);
            LogicalFieldSchema outField = outSchema.getField(i);
            if(uid2LoadFuncMap.get(inField.uid) != null){
                addUidLoadFuncToMap(outField.uid, uid2LoadFuncMap.get(inField.uid));
            }
        }
       
View Full Code Here

                return;
        }
       
        //if same non null load func is associated with all fieldschemas
        // asssociate that with the uid of outFS
        LogicalFieldSchema inpFS1 = inputFieldSchemas.get(0);
        FuncSpec funcSpec1 = uid2LoadFuncMap.get(inpFS1.uid);
        boolean allInnerSchemaMatch = false;
        if(funcSpec1 != null){
            boolean allMatch = true;
            allInnerSchemaMatch = true;
View Full Code Here

                        //see if there is a load function associated with the store
                        FuncSpec funcSpec = rel2InputFuncMap.get(inputStore);
                        addUidLoadFuncToMap(outputUid, funcSpec);
                    }else{
                        //find input uid and corresponding load func
                        LogicalFieldSchema fs = sch.getField(inputColNum);
                        FuncSpec funcSpec = uid2LoadFuncMap.get(fs.uid);
                        addUidLoadFuncToMap(outputUid, funcSpec);
                    }
                }
            }
View Full Code Here

          if(args != null && args.size() > 0 ){
              int pos = (Integer)((ConstantExpression)args.get(0)).getValue();
              LogicalRelationalOperator inp = (LogicalRelationalOperator)implicitReferencedOperator;
 
              if( inp.getSchema() != null){
                  LogicalFieldSchema inpFs = inp.getSchema().getField(pos);
                  fieldSchema = new LogicalFieldSchema(inpFs);
                  //  fieldSchema.alias = "ReadScalars_" + fieldSchema.alias;
              }else{
                  fieldSchema = new LogicalFieldSchema(null, null, DataType.BYTEARRAY);
              }
              return fieldSchema;
          }else{
              //predecessors haven't been setup, return null
              return null;
View Full Code Here

   
    public LogicalFieldSchema getFieldSchema() throws FrontendException {
        if (fieldSchema!=null)
            return fieldSchema;
        LogicalExpression successor = (LogicalExpression)plan.getSuccessors(this).get(0);
        LogicalFieldSchema predFS = successor.getFieldSchema();
        if (predFS!=null) {
            if (predFS.type==DataType.MAP && predFS.schema!=null) {
                return (predFS.schema.getField(0));
            }
            else {
View Full Code Here

        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;
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema

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.