Package com.ebay.erl.mobius.core.collection

Examples of com.ebay.erl.mobius.core.collection.BigTupleList


      String inName  = this.inputs[i].getInputColumnName();
      t.insert(outName, tuple.get(inName));
    }
   
    if( this.temp==null )
      this.temp = new BigTupleList(new Tuple(), this.reporter);
   
    this.temp.add(t);
  }
View Full Code Here


  @Override
  public void reset()
  {
    super.reset();
    if( this.temp==null )
      this.temp = new BigTupleList(this.reporter);
    this.temp.clear();
  }
View Full Code Here

 
 
  @Override
  public BigTupleList getResult()
  {
    BigTupleList result = new BigTupleList(this.reporter);
   
    Tuple[] tuples = this.maxHeap.toArray(new Tuple[this.maxHeap.size()]);
    Arrays.sort(tuples, this.getComparator());
   
    for( int i=tuples.length-1;i>=0;i-- )
    {
      Tuple currentTuple = tuples[i];
      Tuple t = new Tuple();
      for( int j=0;j<this.getOutputSchema().length;j++ )   
      {
        String inName  = this.inputs[j].getInputColumnName();
        String outName  = this.getOutputSchema()[j];
       
        t.insert(outName, currentTuple.get(inName));
      }
      result.add(t);
    }
    return result;
  }
View Full Code Here

   
    // the <code>this.comparator</code> can still be
    // empty here if user doesn't specify a customized
    // comparator, if that's the case, BigTupleList
    // will use the default comparator.
    return new BigTupleList(this.comparator, this.reporter);
  }
View Full Code Here

  }
 
 
  protected BigTupleList newBigTupleList()
  {
    return new BigTupleList(this.reporter);
  }
View Full Code Here

   */
  protected final void output(Tuple t)
  {
    if( this.result==null )
    {
      this.result = new BigTupleList(this.reporter);
    }
   
    // only select the values in the output schema,
    // preventing user put some K-V that doesn't belong
    // to the specified output schema, which might overwrite
View Full Code Here

  {
    if( this.result==null || this.result.size()==0 )
    {
      if( emptyResult==null )
      {
        emptyResult = new BigTupleList(this.reporter);
        Tuple empty = new Tuple();
        for( String aColumn:this.getOutputSchema() )
        {
          empty.putNull(aColumn);
        }
View Full Code Here

        aComputedColumn.reset();
        aComputedColumn.consume(Tuple.immutable(record));
       
        if ( aComputedColumn.getResult()!=null && aComputedColumn.getResult().size()>0 )
        {
          BigTupleList computedResult = aComputedColumn.getResult();
          if( computedResult.size()<5000 )
          {
            // use in memory cross product
            Iterable<Tuple>[] allValues = new Iterable[2];
            allValues[0] = rows_to_be_output;
            allValues[1] = aComputedColumn.getResult();
View Full Code Here

          Tuple aRow = valuesFromLastDataset.next();
          this.rememberTuple(_lastDatasetID, aRow, reporter);
        }
       
        Iterable<Tuple> preCrossProduct = Util.crossProduct(conf, reporter, this.valuesForAllDatasets.values().toArray(new BigTupleList[0]));
        BigTupleList btl = new BigTupleList(reporter);
        for( Tuple aRow:preCrossProduct )
        {
          this.computeExtendFunctions(aRow, btl, this.multiDatasetExtendFunction);
          this.computeGroupFunctions(aRow, this.multiDatasetGroupFunction);
        }
       
        if( btl.size()>0 )
          toBeCrossProduct.add(btl);
        for(GroupFunction fun:this.multiDatasetGroupFunction )
          toBeCrossProduct.add(fun.getResult());
       
        valuesFromLastDataset = this.valuesForAllDatasets.get(_lastDatasetID).iterator();
      }
      else
      {
        if( this.multiDatasetExtendFunction.size()>0 )
        {
          BigTupleList btl = new BigTupleList(reporter);
          this.computeExtendFunctions(null, btl, this.multiDatasetExtendFunction);
          toBeCrossProduct.add(btl);
        }
        for(GroupFunction fun:this.multiDatasetGroupFunction )
          toBeCrossProduct.add(fun.getNoMatchResult(nullReplacement));
      }
    }
    // finished the computation of multi-dataset functions, start
    // to compute the projectable funcitons results for last
    // dataset
    //
    // first compute the cross product of all other functions
    Iterable<Tuple> others = null;
    if( toBeCrossProduct.size()>0 )
    {
      Iterable<Tuple>[] array = new Iterable[toBeCrossProduct.size()];
      for( int i=0;i<toBeCrossProduct.size();i++ )
      {
        array[i] = toBeCrossProduct.get(i);
      }
     
      others = Util.crossProduct(conf, reporter, array);
    }
   
    if( valuesFromLastDataset==null )
    {// outer-join, so <code>others</code> is always not null.
      List<BigTupleList> nullResult = new ArrayList<BigTupleList>();
     
      if( this.singleDatasetExtendFunction.get(_lastDatasetID)!=null )
      {
        BigTupleList btl = new BigTupleList(reporter);
        this.computeExtendFunctions(null, btl, this.singleDatasetExtendFunction.get(_lastDatasetID));
        nullResult.add(btl);
      }
      if( this.singleDatasetGroupFunction.get(_lastDatasetID)!=null )
      {
View Full Code Here

    }
  }
 
 
  private void rememberTuple(Byte datasetID, Tuple aTuple, Reporter reporter){
    BigTupleList tuples = null;
    if( (tuples=this.valuesForAllDatasets.get(datasetID))==null )
    {
      tuples = new BigTupleList(reporter);
      this.valuesForAllDatasets.put(datasetID, tuples);
    }
    tuples.add(aTuple);
  }
View Full Code Here

TOP

Related Classes of com.ebay.erl.mobius.core.collection.BigTupleList

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.