Package org.apache.flink.test.recordJobs.util

Examples of org.apache.flink.test.recordJobs.util.Tuple.addAttribute()


   
    /* pice = extendedprice * (1 - discount): */
    float price = Float.parseFloat(inputTuple.getStringValueAt(5)) * (1 - Float.parseFloat(inputTuple.getStringValueAt(6)));
    /* Project (orderkey | partkey, suppkey, linenumber, quantity, extendedprice, discount, tax, ...) to (partkey, suppkey, quantity): */
    inputTuple.project((0 << 0) | (1 << 1) | (1 << 2) | (0 << 3) | (1 << 4));
    inputTuple.addAttribute("" + price);
    record.setField(1, inputTuple);
    out.collect(record);
  }

}
View Full Code Here


    Tuple lineItem = value2.getField(1, Tuple.class);
   
    /* (partkey, suppkey) from lineItem: */
    IntPair newKey = new IntPair(new IntValue(Integer.parseInt(lineItem.getStringValueAt(0))), new IntValue(Integer.parseInt(lineItem.getStringValueAt(1))));
    Tuple newValue = new Tuple();
    newValue.addAttribute(year.toString()); // year
    newValue.addAttribute(lineItem.getStringValueAt(2)); // quantity
    newValue.addAttribute(lineItem.getStringValueAt(3)); // price
   
    value1.setField(0, newKey);
    value1.setField(1, newValue);
View Full Code Here

   
    /* (partkey, suppkey) from lineItem: */
    IntPair newKey = new IntPair(new IntValue(Integer.parseInt(lineItem.getStringValueAt(0))), new IntValue(Integer.parseInt(lineItem.getStringValueAt(1))));
    Tuple newValue = new Tuple();
    newValue.addAttribute(year.toString()); // year
    newValue.addAttribute(lineItem.getStringValueAt(2)); // quantity
    newValue.addAttribute(lineItem.getStringValueAt(3)); // price
   
    value1.setField(0, newKey);
    value1.setField(1, newValue);
    out.collect(value1);
View Full Code Here

    /* (partkey, suppkey) from lineItem: */
    IntPair newKey = new IntPair(new IntValue(Integer.parseInt(lineItem.getStringValueAt(0))), new IntValue(Integer.parseInt(lineItem.getStringValueAt(1))));
    Tuple newValue = new Tuple();
    newValue.addAttribute(year.toString()); // year
    newValue.addAttribute(lineItem.getStringValueAt(2)); // quantity
    newValue.addAttribute(lineItem.getStringValueAt(3)); // price
   
    value1.setField(0, newKey);
    value1.setField(1, newValue);
    out.collect(value1);
   
View Full Code Here

 
  @Test
  public void testToString() {
    Tuple t = new Tuple();

    t.addAttribute("Hello world!");
    Assert.assertTrue(t.toString().equals("Hello world!|"));
    t.addAttribute("2ndValue");
    Assert.assertTrue(t.toString().equals("Hello world!|2ndValue|"));
   
    byte[] ba = "attr1|attr2|3|4|attr5|thisdoesnotbelongtothetuple".getBytes();
View Full Code Here

  public void testToString() {
    Tuple t = new Tuple();

    t.addAttribute("Hello world!");
    Assert.assertTrue(t.toString().equals("Hello world!|"));
    t.addAttribute("2ndValue");
    Assert.assertTrue(t.toString().equals("Hello world!|2ndValue|"));
   
    byte[] ba = "attr1|attr2|3|4|attr5|thisdoesnotbelongtothetuple".getBytes();
    int[] of2 = {0,6,12,14,16,22};
    t = new Tuple(ba, of2, 5);
View Full Code Here

    Tuple t1 = new Tuple();
   
    t1.addAttribute("1");
    t1.addAttribute("2");
    t1.addAttribute("112315412");
    t1.addAttribute(Integer.MAX_VALUE+"");
    t1.addAttribute("-1");
    t1.addAttribute(Integer.MIN_VALUE+"");
   
    // check identical values
    Assert.assertTrue(t1.compareIntAttribute(t1, 0, 0) == 0);
View Full Code Here

  public void shouldNoThrowExceptionOnTooShortTuple() throws Exception, InterruptedException
  {
    LineItemFilter out = new LineItemFilter();
   
    Tuple input = new Tuple();
    input.addAttribute("" +1);
    input.addAttribute("" + 155190);
    input.addAttribute("" + 7706);
    input.addAttribute("" + 1);
    input.addAttribute("" + 17);
    input.addAttribute("" + 21168.23);
View Full Code Here

   
    t1.addAttribute("1");
    t1.addAttribute("2");
    t1.addAttribute("112315412");
    t1.addAttribute(Integer.MAX_VALUE+"");
    t1.addAttribute("-1");
    t1.addAttribute(Integer.MIN_VALUE+"");
   
    // check identical values
    Assert.assertTrue(t1.compareIntAttribute(t1, 0, 0) == 0);
    Assert.assertTrue(t1.compareIntAttribute(t1, 1, 1) == 0);
View Full Code Here

  {
    LineItemFilter out = new LineItemFilter();
   
    Tuple input = new Tuple();
    input.addAttribute("" +1);
    input.addAttribute("" + 155190);
    input.addAttribute("" + 7706);
    input.addAttribute("" + 1);
    input.addAttribute("" + 17);
    input.addAttribute("" + 21168.23);
    input.addAttribute("" + 0.04);
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.