Examples of ExampleTuple


Examples of org.apache.pig.pen.util.ExampleTuple

            } else
                out.append(in);
        }
       
        if(lineageTracer != null) {
            ExampleTuple tOut = new ExampleTuple();
            tOut.reference(out);
        }
        return out;
    }
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

                // input
                // constraints
                for (Iterator<Tuple> it = outputConstraints.iterator(); it
                        .hasNext();) {
                    Tuple outputConstraint = it.next();
                    ExampleTuple inputConstraint = GenerateMatchingTuple(
                            outputConstraint, filterCond, false);
                    if (inputConstraint != null)
                        inputConstraints.add(inputConstraint);
                }
            } else if (outputData.size() == 0) { // no output constraints, but
                // output is empty; generate
                // one input that will pass the
                // filter
                ExampleTuple inputConstraint = GenerateMatchingTuple(filter
                        .getSchema(), filterCond, false);

                if (inputConstraint != null)
                    inputConstraints.add(inputConstraint);
            }

            // if necessary, insert a negative example (i.e. a tuple that does
            // not pass the filter)
            if (outputData.size() == inputData.size()) { // all tuples pass the
                // filter; generate one
                // input that will not
                // pass the filter

                ExampleTuple inputConstraint = GenerateMatchingTuple(filter
                        .getSchema(), filterCond, true);
                if (inputConstraint != null)
                    inputConstraints.add(inputConstraint);

            }
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

                throw new RuntimeException(
                        "Internal error: incorrect number of fields in constraint tuple.");

            Tuple inputT = TupleFactory.getInstance().newTuple(
                    outputConstraint.size());
            ExampleTuple inputTuple = new ExampleTuple(inputT);

            try {
                for (int i = 0; i < inputTuple.size(); i++) {
                    Object d = outputConstraint.get(i);
                    if (d == null)
                        d = exampleTuple.get(i);
                    inputTuple.set(i, d);
                }
            } catch (ExecException e) {
                log
                        .error("Error visiting Load during Augmentation phase of Example Generator! "
                                + e.getMessage());
                throw new VisitorException(
                        "Error visiting Load during Augmentation phase of Example Generator! "
                                + e.getMessage());

            }
            if (!inputTuple.equals(exampleTuple))
                inputTuple.synthetic = true;

            newInputData.add(inputTuple);
        }
    }
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

    Tuple BackPropConstraint(Tuple outputConstraint, List<Integer> cols,
            Schema inputSchema, boolean cast) throws ExecException {
        Tuple inputConst = TupleFactory.getInstance().newTuple(
                inputSchema.getFields().size());

        Tuple inputConstraint = new ExampleTuple(inputConst);

        for (int outCol = 0; outCol < outputConstraint.size(); outCol++) {
            int inCol = cols.get(outCol);
            Object outVal = outputConstraint.get(outCol);
            Object inVal = inputConstraint.get(inCol);

            if (inVal == null && outVal != null) {
                // inputConstraint.set(inCol, outVal);
                inputConstraint.set(inCol, (cast) ? new DataByteArray(outVal
                        .toString().getBytes()) : outVal);

            } else {
                if (outVal != null) {
                    // unable to back-propagate, due to conflicting column
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

    //

    ExampleTuple GenerateMatchingTuple(Tuple constraint, LogicalPlan predicate,
            boolean invert) throws ExecException {
        Tuple t = TupleFactory.getInstance().newTuple(constraint.size());
        ExampleTuple tOut = new ExampleTuple(t);
        for (int i = 0; i < t.size(); i++)
            tOut.set(i, constraint.get(i));

        GenerateMatchingTupleHelper(tOut, (ExpressionOperator) predicate
                .getLeaves().get(0), invert);
        tOut.synthetic = true;
        return tOut;
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

 
  output.set(0, smallestTuple.get(1));
  for(int i = 1; i < size + 1; i++) {
      output.set(i, BagFactory.getInstance().newDefaultBag());
  }
  ExampleTuple tOut = null;
  if(lineageTracer != null) {
      tOut = new ExampleTuple(output);
      lineageTracer.insert(tOut);
  }
 
  boolean loop = true;
 
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

        && res.returnStatus != POStatus.STATUS_NULL)
    return res;

      if (res.result != null && (Boolean) res.result == true) {
    if(lineageTracer != null) {
        ExampleTuple tIn = (ExampleTuple) inp.result;
        lineageTracer.insert(tIn);
        lineageTracer.union(tIn, tIn);
    }
    return inp;
      }
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

            }

        }
       
        if(lineageTracer != null) {
            ExampleTuple tOut = new ExampleTuple();
            tOut.reference(out);
            lineageTracer.insert(tOut);
            for(int i = 0; i < data.length; i++) {
                lineageTracer.union(tOut, data[i]);
            }
            return tOut;
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

                    && res.returnStatus != POStatus.STATUS_NULL)
                return res;

            if (res.result != null && (Boolean) res.result == true) {
          if(lineageTracer != null) {
              ExampleTuple tIn = (ExampleTuple) inp.result;
              lineageTracer.insert(tIn);
              lineageTracer.union(tIn, tIn);
          }
                return inp;
            }
View Full Code Here

Examples of org.apache.pig.pen.util.ExampleTuple

        if(processingPlan){
            while(true) {
                res = processPlan();
                if(res.returnStatus==POStatus.STATUS_OK) {
                    if(lineageTracer !=  null && res.result != null) {
                  ExampleTuple tOut = new ExampleTuple((Tuple) res.result);
                  tOut.synthetic = tIn.synthetic;
                  lineageTracer.insert(tOut);
                  lineageTracer.union(tOut, tIn);
                  res.result = tOut;
                    }
                    return res;
                }
                if(res.returnStatus==POStatus.STATUS_EOP) {
                    processingPlan = false;
                    for(PhysicalPlan plan : inputPlans)
                        plan.detachInput();
                    return res;
                }
                if(res.returnStatus==POStatus.STATUS_ERR) {
                    return res;
                }
                if(res.returnStatus==POStatus.STATUS_NULL) {
                    continue;
                }
            }
        }
        //The nested plan processing is done or is
        //yet to begin. So process the input and start
        //nested plan processing on the input tuple
        //read
        while (true) {
           
            // we know that input has been attached
            attachInputToPlans(input);
            detachInput();
            res = processPlan();
           
            processingPlan = true;

            if(lineageTracer != null && res.result != null) {
          //we check for res.result since that can also be null in the case of flatten
          tIn = (ExampleTuple) input;
          ExampleTuple tOut = new ExampleTuple((Tuple) res.result);
          tOut.synthetic = tIn.synthetic;
          lineageTracer.insert(tOut);
          lineageTracer.union(tOut, tIn);
          res.result = tOut;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.