Package org.apache.pig.data

Examples of org.apache.pig.data.DataBag.cardinality()


                //newData = new DataBag();
              newData = BagFactory.getInstance().newDefaultBag();
                newBaseData.put(load, newData);
            }
           
            int newDataBoundary = newData.cardinality();
           
            for(Iterator<Tuple> it = newData.iterator(); it.hasNext();) {
              ((ExampleTuple)it.next()).makeSynthetic();
            }
            // append oldData to newData
View Full Code Here


                inputConstraint.copyFrom(inputConst);
                if (inputConstraint != null) inputConstraints.add(inputConstraint);
            }
           
            // if necessary, insert a negative example (i.e. a tuple that does not pass the filter)
            if (outputData.cardinality() == inputData.cardinality()) {     // all tuples pass the filter; generate one input that will not pass the filter
                ExampleTuple inputConstraint = new ExampleTuple();
                Tuple inputConst = GenerateMatchingTuple(inputSchema, new NotCond(filterCond));
                //inputConstraint.copyFrom(inputConst);
                if (inputConst != null) {
                  inputConstraint.copyFrom(inputConst);
View Full Code Here

        if(overallRealness) {
          bag = exampleData.get(e.getKey());
        } else {
          bag = exampleData.get(op);
        }
        noTuples += bag.cardinality();
        for(Iterator<Tuple> it = bag.iterator(); it.hasNext();) {
          if(((ExampleTuple)it.next()).isSynthetic()) noSynthetic++;
        }
        if(!overallRealness) break;
View Full Code Here

    static float getConciseness(LogicalOperator op, Map<LogicalOperator, DataBag> exampleData, Map<LogicalOperator, Collection<IdentityHashSet<Tuple>>> OperatorToEqClasses, boolean overallConciseness) {
      DataBag bag = exampleData.get(op);

      int noEqCl = OperatorToEqClasses.get(op).size();
      int noTuples = bag.cardinality();
     
     
      float conciseness = 100*((float)noEqCl / (float)noTuples);
      if(!overallConciseness) {
     
View Full Code Here

        for(Map.Entry<LogicalOperator, Collection<IdentityHashSet<Tuple>>> e : OperatorToEqClasses.entrySet()) {
          //if(e.getKey() instanceof LORead) continue;
          noOperators++; //we need to keep a track of these and not use OperatorToEqClasses.size() as LORead shouldn't be considered a operator
          bag = exampleData.get(e.getKey());
     
          noTuples = bag.cardinality();
          noEqCl = e.getValue().size();
          float concise = 100*((float)noEqCl / (float)noTuples);
          concise = (concise > 100) ? 100 : concise;
          conciseness += concise;
        }
View Full Code Here

                isAcceptable = (group.getBagField(1).cardinality() >= 2);
            } else {                      // for co-group, need a group with at least one tuple from each input relation
                isAcceptable = true;
                for (int field = 1; field < group.arity(); field++) {
                    DataBag bag = group.getBagField(field);
                    if (bag.cardinality() == 0) {
                        isAcceptable = false;
                        break;
                    }
                }
            }
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.