Package com.ebay.erl.mobius.core.model

Examples of com.ebay.erl.mobius.core.model.Tuple


    for( int i=size-1;i>=0;i-- )
    {
      int count = (int)(Math.random()*1000);
      counts[i] = count;
     
      Tuple t = new Tuple();
      t.put("COUNTS", count);
      t.put("ID", "ID_"+i);
     
      topFunction.consume(t);
    }
   
    Arrays.sort(counts);
   
    // the counts is sorted in ascending order, so
    // topK element is in the tail of the "counts"
    // array.
    int k = 0;
    for( Tuple t: topFunction.getResult() )
    {
      assertEquals(counts[k++], t.getInt("TOP_COUNTS"));
    }
   
   
   
    //////////////////////////////////////////////////////////////
    // serialize Top and deserialize it back, then test
    //////////////////////////////////////////////////////////////
    topFunction = (Top)SerializableUtil.deserializeFromBase64(SerializableUtil.serializeToBase64(topFunction), null);
    topFunction.reset();
    for( int i=size-1;i>=0;i-- )
    {
      int count = (int)(Math.random()*1000);
      counts[i] = count;
     
      Tuple t = new Tuple();
      t.put("COUNTS", count);
      t.put("ID", "ID_"+i);
     
      topFunction.consume(t);
    }
    Arrays.sort(counts);
   
    k = 0;
    for( Tuple t: topFunction.getResult() )
    {
      assertEquals(counts[k++], t.getInt("TOP_COUNTS"));
    }
  }
View Full Code Here


    {
      if( inserted>500000)
        break;
     
      String[] data = nl.split("\t");
      Tuple t = new Tuple();
      for( int i=0;i<10;i++)
      {
        t.put("C"+i, data[i]);
      }
      lst.add(t);
      inserted++;
      if( inserted%50000==0)
      {
View Full Code Here

   
    BigTupleList btl = new BigTupleList(null);
   
    while( (newLine=br.readLine())!=null ){
      String[] data = newLine.split("\t");
      Tuple t = new Tuple();
      for( int i=0;i<10;i++)
        t.put("T"+i, data[i]);
     
      btl.add(t);
      counts++;
     
      if( counts==MAX ){
View Full Code Here

   
    BigTupleList result = (BigTupleList)Util.crossProduct(null, null, ds1, ds2, ds3);
   
    Assert.assertEquals(30, result.size());
   
    Tuple first = new Tuple();
    first
      .put("a", "A_1")
      .put("aa", "AA_1")
      .put("B", "B_1")
      .put("bb", "BB_1")
      .put("cc", "CC_1")
      .put("X", "X_1");
   
    Tuple last = new Tuple();
    last
      .put("a", "A_2")
      .put("aa", "AA_3")
      .put("B", "B_2")
      .put("bb", "BB_3")
      .put("cc", "CC_3")
View Full Code Here

  protected List<Tuple> generate(int rows, String... keys)
  {
    List<Tuple> result = new ArrayList<Tuple>();
    for( int i=0;i<rows;i++ )
    {
      Tuple t = new Tuple();
      for(String aKey:keys)
      {
        t.put(aKey, aKey+"_"+(i+1));
      }
      result.add(t);
    }
    return result;
  }
View Full Code Here

   
    TreeMap<String, String> m = new TreeMap<String, String>();
    m.put("K", "V");
   
   
    Tuple t = new Tuple();
    t.put(Byte.class.getName(), (byte)0x0F);   
    t.put(Short.class.getName(), (short)1);
    t.put(Integer.class.getName(), (int)2);
    t.put(Long.class.getName(), 3L);
    t.put(Float.class.getName(), 4.1F);
    t.put(Double.class.getName(), 5.1D);
   
    t.put(Boolean.class.getName(), false);
   
    t.put(String.class.getName(), "string");
    t.put(java.sql.Date.class.getName(), java.sql.Date.valueOf("2011-01-01"));
    t.put(java.sql.Timestamp.class.getName(), java.sql.Timestamp.valueOf("2012-01-01 13:05:01"));
    t.put(java.sql.Time.class.getName(), java.sql.Time.valueOf("13:05:01"));
   
    // test numbers
    testNumber(Byte.class.getName(), (byte)0x0F, t);
    testNumber(Short.class.getName(), (short)1, t);
    testNumber(Integer.class.getName(), (int)2, t);
View Full Code Here

  {
    if( noMatchResult==null )
    {
      noMatchResult = new BigTupleList(this.reporter);
     
      Tuple nullRow = new Tuple();
      for( String aColumn:this.getOutputSchema() )
      {
        if( nullReplacement==null )
        {
          nullRow.putNull(aColumn);
        }
        else
        {
          nullRow.insert(aColumn, nullReplacement);
        }
      }
      noMatchResult.add(Tuple.immutable(nullRow));
      this.noMatchResult = BigTupleList.immutable(this.noMatchResult);
    }
View Full Code Here

   * {@link Tuple} with more than one column.
   */
  @Override
  protected Tuple getComputedResult()
  {
    Tuple record = new Tuple();
    record.insert(this.getOutputSchema()[0], this.aggregateResult);
    return record;
  }
View Full Code Here

TOP

Related Classes of com.ebay.erl.mobius.core.model.Tuple

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.