Examples of DataByteArray


Examples of org.apache.pig.data.DataByteArray

    testOrderPreserveUnion(inputTables, "e,c,a,b,d,f,m1,source_table");
   
    // Verify union table
    ArrayList<ArrayList<Object>> resultTable = new ArrayList<ArrayList<Object>>();
   
    addResultRow(resultTable, "Apple"1003L1001100.0f50e+2new DataByteArray("Apple"),  m1,    0);
    addResultRow(resultTable, "Hadoop"1000L100228.0f50e+2new DataByteArray("Hadoop"),m1,    0);
    addResultRow(resultTable, "Pig"1000L100150.0f50e+2new DataByteArray("Pig"),  m1,    0);
    addResultRow(resultTable, "Zebra"1001L5,    -3.25f51e+2new DataByteArray("Zebra"),  m1,    0);
   
    addResultRow(resultTable, "apple"1001L1001101.0f50e+2new DataByteArray("apple"),  m1,    0);
    addResultRow(resultTable, "beige"1006L200033.0f52e+2new DataByteArray("beige"),  m2,    1);
    addResultRow(resultTable, "brown"1001L100153.0f52e+2new DataByteArray("brown"),  m2,    1);
    addResultRow(resultTable, "gray"1008L100150.0f52e+2new DataByteArray("gray"),  m2,    1);
   
    addResultRow(resultTable, "green"1004L15,    56.0f50e+2new DataByteArray("green"),  m2,    1);
    addResultRow(resultTable, "hadoop"1002L10000.0f52e+2new DataByteArray("hadoop"),m1,    0);
    addResultRow(resultTable, "orange"1002L,  -1,    -99.0f51e+2new DataByteArray("orange"),m2,    1);
    addResultRow(resultTable, "pig"1001L100152.0f50e+2new DataByteArray("pig"),  m1,    0);
   
    addResultRow(resultTable, "purple"1001L1001102.0f52e+2new DataByteArray("purple"),m2,    1);
    addResultRow(resultTable, "string0",1000L,  null,  3.25f53e+2new DataByteArray("orange"),null,  2);
    addResultRow(resultTable, "string0",1001L,  null,  3.26f51e+2new DataByteArray("purple"),null,  2);
    addResultRow(resultTable, "string1",1000L,  null,  3.25f50e+2new DataByteArray("blue"),  null,  2);
   
    addResultRow(resultTable, "string1",1001L,  null,  3.25f51e+2new DataByteArray("green"),  null,  2);
    addResultRow(resultTable, "string1",1001L,  null,  3.24f53e+2new DataByteArray("yellow"),null,  2);
    addResultRow(resultTable, "string2",1001L,  null,  3.28f51e+2new DataByteArray("white"),  null,  2);
    addResultRow(resultTable, "white"1003L1001100.0f55e+2new DataByteArray("white"),  m2,    1);
   
    addResultRow(resultTable, "zebra"1000L,  -1,    3.25f50e+2new DataByteArray("zebra"),  m1,    0);
   
    // Verify union table
    Iterator<Tuple> it = pigServer.openIterator("records1");
    int numbRows = verifyTable(resultTable, 0, it);
   
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

    testOrderPreserveUnion(inputTables, "b,a,source_table,c,d,f,m1,e");
   
    // Verify union table
    ArrayList<ArrayList<Object>> resultTable = new ArrayList<ArrayList<Object>>();
   
    addResultRow(resultTable,  100.0f100101003L50e+2new DataByteArray("Apple"),  m1,  "Apple");
    addResultRow(resultTable,  28.0f100201000L50e+2new DataByteArray("Hadoop"),m1,  "Hadoop");
    addResultRow(resultTable,  50.0f100101000L50e+2new DataByteArray("Pig"),  m1,  "Pig");
    addResultRow(resultTable,  -3.25f5,    01001L51e+2new DataByteArray("Zebra"),  m1,  "Zebra");
   
    addResultRow(resultTable,  101.0f100101001L50e+2new DataByteArray("apple"),  m1,  "apple");
    addResultRow(resultTable,  33.0f200011006L52e+2new DataByteArray("beige"),  m2,  "beige");
    addResultRow(resultTable,  53.0f100111001L52e+2new DataByteArray("brown"),  m2,  "brown");
    addResultRow(resultTable,  50.0f100111008L52e+2new DataByteArray("gray"),  m2,  "gray");
   
    addResultRow(resultTable,  56.0f15,    11004L50e+2new DataByteArray("green"),  m2,  "green");
    addResultRow(resultTable,  0.0f100001002L52e+2new DataByteArray("hadoop"),m1,  "hadoop");
    addResultRow(resultTable,  -99.0f,  -1,    11002L51e+2new DataByteArray("orange"),m2,  "orange");
    addResultRow(resultTable,  52.0f100101001L50e+2new DataByteArray("pig"),  m1,  "pig");
   
    addResultRow(resultTable,  102.0f100111001L52e+2new DataByteArray("purple"),m2,  "purple");
    addResultRow(resultTable,  3.26f,  null,  21001L51e+2new DataByteArray("purple"),null,"string0");
    addResultRow(resultTable,  3.25f,  null,  21000L53e+2new DataByteArray("orange"),null,"string0");
    addResultRow(resultTable,  3.25f,  null,  21001L51e+2new DataByteArray("green"),  null,"string1");
   
    addResultRow(resultTable,  3.25f,  null,  21000L50e+2new DataByteArray("blue"),  null,"string1");
    addResultRow(resultTable,  3.24f,  null,  21001L53e+2new DataByteArray("yellow"),null,"string1");
    addResultRow(resultTable,  3.28f,  null,  21001L51e+2new DataByteArray("white"),  null,"string2");
    addResultRow(resultTable,  100.0f100111003L55e+2new DataByteArray("white"),  m2,  "white");
   
    addResultRow(resultTable,  3.25f,  -1,    01000L50e+2new DataByteArray("zebra"),  m1,  "zebra");
   
    // Verify union table
    Iterator<Tuple> it = pigServer.openIterator("records1");
    int numbRows = verifyTable(resultTable, 7, it);
   
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

    testOrderPreserveUnion(inputTables, "e,source_table,b,c,int1,f,m1");
   
    // Verify union table
    ArrayList<ArrayList<Object>> resultTable = new ArrayList<ArrayList<Object>>();
   
    addResultRow(resultTable, "Apple"0100.0f1003L,  null,  new DataByteArray("Apple"),  m1);
    addResultRow(resultTable, "Hadoop"028.0f1000L,  null,  new DataByteArray("Hadoop"),m1);
    addResultRow(resultTable, "Pig"050.0f1000L,  null,  new DataByteArray("Pig"),  m1);
    addResultRow(resultTable, "Zebra"0,  -3.25f1001L,  null,  new DataByteArray("Zebra"),  m1);
   
    addResultRow(resultTable, "apple"0101.0f1001L,  null,  new DataByteArray("apple"),  m1);
    addResultRow(resultTable, "beige"133.0f1006L,  null,  new DataByteArray("beige"),  m2);
    addResultRow(resultTable, "brown"153.0f1001L,  null,  new DataByteArray("brown"),  m2);
    addResultRow(resultTable, "gray"150.0f1008L,  null,  new DataByteArray("gray"),  m2);
   
    addResultRow(resultTable, "green"156.0f1004L,  null,  new DataByteArray("green"),  m2);
    addResultRow(resultTable, "hadoop"00.0f1002L,  null,  new DataByteArray("hadoop"),m1);
    addResultRow(resultTable, "orange"1,  -99.0f1002L,  null,  new DataByteArray("orange"),m2);
    addResultRow(resultTable, "pig"052.0f1001L,  null,  new DataByteArray("pig"),  m1);
   
    addResultRow(resultTable, "purple"1102.0f1001L,  null,  new DataByteArray("purple"),m2);
    addResultRow(resultTable, "string0",23.26f1001L100new DataByteArray("purple"),null);
    addResultRow(resultTable, "string0",23.25f1000L100new DataByteArray("orange"),null);
    addResultRow(resultTable, "string1",23.25f1001L100new DataByteArray("green"),null);
   
    addResultRow(resultTable, "string1",23.25f1000L100new DataByteArray("blue"),null);
    addResultRow(resultTable, "string1",23.24f1001L100new DataByteArray("yellow"),null);
    addResultRow(resultTable, "string2",23.28f1001L100new DataByteArray("white"),null);
    addResultRow(resultTable, "white"1100.0f1003L,  null,  new DataByteArray("white"),  m2);
   
    addResultRow(resultTable, "zebra"03.25f1000L,  null,  new DataByteArray("zebra"),  m1);
   
    // Verify union table
    Iterator<Tuple> it = pigServer.openIterator("records1");
    int numbRows = verifyTable(resultTable, 0, it);
   
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

    testOrderPreserveUnion(inputTables, "source_table,b,c,int1,f,m1")// sort key e not in projection
   
    // Verify union table
    ArrayList<ArrayList<Object>> resultTable = new ArrayList<ArrayList<Object>>();
   
    addResultRow(resultTable, 0100.0f1003L,  null,  new DataByteArray("Apple"),  m1);
    addResultRow(resultTable, 028.0f1000L,  null,  new DataByteArray("Hadoop"),m1);
    addResultRow(resultTable, 050.0f1000L,  null,  new DataByteArray("Pig"),  m1);
    addResultRow(resultTable, 0,  -3.25f1001L,  null,  new DataByteArray("Zebra"),  m1);
   
    addResultRow(resultTable, 0101.0f1001L,  null,  new DataByteArray("apple"),  m1);
    addResultRow(resultTable, 133.0f1006L,  null,  new DataByteArray("beige"),  m2);
    addResultRow(resultTable, 153.0f1001L,  null,  new DataByteArray("brown"),  m2);
    addResultRow(resultTable, 150.0f1008L,  null,  new DataByteArray("gray"),  m2);
   
    addResultRow(resultTable, 156.0f1004L,  null,  new DataByteArray("green"),  m2);
    addResultRow(resultTable, 00.0f1002L,  null,  new DataByteArray("hadoop"),m1);
    addResultRow(resultTable, 1,  -99.0f1002L,  null,  new DataByteArray("orange"),m2);
    addResultRow(resultTable, 052.0f1001L,  null,  new DataByteArray("pig"),  m1);
   
    addResultRow(resultTable, 1102.0f1001L,  null,  new DataByteArray("purple"),m2);
    addResultRow(resultTable, 1100.0f1003L,  null,  new DataByteArray("white"),  m2);
    addResultRow(resultTable, 03.25f1000L,  null,  new DataByteArray("zebra"),  m1);
   
    // Verify union table
    Iterator<Tuple> it = pigServer.openIterator("records1");
    int numbRows = verifyTable(resultTable, 4, it);
   
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

    tupColl1.set(0, 3.1415926);
    tupColl1.set(1, 1.6);
    abs1[0] = 11;
    abs1[1] = 12;
    abs1[2] = 13;
    tupColl1.set(2, new DataByteArray(abs1));
    bagColl.add(tupColl1);
    tupColl2.set(0, 123.456789);
    tupColl2.set(1, 100);
    abs2[0] = 21;
    abs2[1] = 22;
    abs2[2] = 23;
    abs2[3] = 24;
    tupColl2.set(2, new DataByteArray(abs2));
    bagColl.add(tupColl2);
    tuple.set(3, bagColl);

    int row = 0;
    inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

    tuple.set(0, true); // bool
    tuple.set(1, 1); // int
    tuple.set(2, 1001L); // long
    tuple.set(3, 1.1); // float
    tuple.set(4, "hello world 1"); // string
    tuple.set(5, new DataByteArray("hello byte 1")); // byte

    // r1:record(f1:int, f2:long
    tupRecord1.set(0, 1);
    tupRecord1.set(1, 1001L);
    tuple.set(6, tupRecord1);

    // r2:record(r3:record(f3:float, f4))
    tupRecord2.set(0, tupRecord3);
    tupRecord3.set(0, 1.3);
    tupRecord3.set(1, new DataByteArray("r3 row 1 byte array "));
    tuple.set(7, tupRecord2);

    // m1:map(string)
    Map<String, String> m1 = new HashMap<String, String>();
    m1.put("a", "A");
    m1.put("b", "B");
    m1.put("c", "C");
    tuple.set(8, m1);

    // m2:map(map(int))
    HashMap<String, Map> m2 = new HashMap<String, Map>();
    Map<String, Integer> m3 = new HashMap<String, Integer>();
    m3.put("m311", 311);
    m3.put("m321", 321);
    m3.put("m331", 331);
    Map<String, Integer> m4 = new HashMap<String, Integer>();
    m4.put("m411", 411);
    m4.put("m421", 421);
    m4.put("m431", 431);
    m2.put("x", m3);
    m2.put("y", m4);
    tuple.set(9, m2);

    // c:collection(f13:double, f14:float, f15:bytes)
    DataBag bagColl = TypesUtils.createBag();
    Schema schColl = schema.getColumn(10).getSchema();
    Tuple tupColl1 = TypesUtils.createTuple(schColl);
    Tuple tupColl2 = TypesUtils.createTuple(schColl);
    byte[] abs1 = new byte[3];
    byte[] abs2 = new byte[4];
    tupColl1.set(0, 3.1415926);
    tupColl1.set(1, 1.6);
    abs1[0] = 11;
    abs1[1] = 12;
    abs1[2] = 13;
    tupColl1.set(2, new DataByteArray(abs1));
    bagColl.add(tupColl1);
    tupColl2.set(0, 123.456789);
    tupColl2.set(1, 100);
    abs2[0] = 21;
    abs2[1] = 22;
    abs2[2] = 23;
    abs2[3] = 24;
    tupColl2.set(2, new DataByteArray(abs2));
    bagColl.add(tupColl2);
    tuple.set(10, bagColl);

    // set s7 to s23
    for (int i = 7; i <= 23; i++) {
      tuple.set(i + 4, "s" + "i" + ", line1");
    }

    int row = 0;
    inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
        .getBytes()), tuple);

    // row 2
    row++;
    TypesUtils.resetTuple(tuple);
    TypesUtils.resetTuple(tupRecord1);
    TypesUtils.resetTuple(tupRecord2);
    TypesUtils.resetTuple(tupRecord3);
    m1.clear();
    m2.clear();
    m3.clear();
    m4.clear();
    tuple.set(0, false);
    tuple.set(1, 2); // int
    tuple.set(2, 1002L); // long
    tuple.set(3, 3.1); // float
    tuple.set(4, "hello world 2"); // string
    tuple.set(5, new DataByteArray("hello byte 2")); // byte

    // r1:record(f1:int, f2:long
    tupRecord1.set(0, 2);
    tupRecord1.set(1, 1002L);
    tuple.set(6, tupRecord1);

    // r2:record(r3:record(f3:float, f4))
    tupRecord2.set(0, tupRecord3);
    tupRecord3.set(0, 2.3);
    tupRecord3.set(1, new DataByteArray("r3 row2  byte array"));
    tuple.set(7, tupRecord2);

    // m1:map(string)
    m1.put("a2", "A2");
    m1.put("b2", "B2");
    m1.put("c2", "C2");
    tuple.set(8, m1);

    // m2:map(map(int))
    m3.put("m321", 321);
    m3.put("m322", 322);
    m3.put("m323", 323);
    m2.put("z", m3);
    tuple.set(9, m2);

    // c:collection(f13:double, f14:float, f15:bytes)
    bagColl.clear();
    TypesUtils.resetTuple(tupColl1);
    TypesUtils.resetTuple(tupColl2);
    tupColl1.set(0, 7654.321);
    tupColl1.set(1, 0.0001);
    abs1[0] = 31;
    abs1[1] = 32;
    abs1[2] = 33;
    tupColl1.set(2, new DataByteArray(abs1));
    bagColl.add(tupColl1);
    tupColl2.set(0, 0.123456789);
    tupColl2.set(1, 0.3333);
    abs2[0] = 41;
    abs2[1] = 42;
    abs2[2] = 43;
    abs2[3] = 44;
    tupColl2.set(2, new DataByteArray(abs2));
    bagColl.add(tupColl2);
    tuple.set(10, bagColl);
    // set s7 to s23
    for (int i = 7; i <= 23; i++) {
      tuple.set(i + 4, "s" + "i" + ", line2");
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

            tuple.set(0, 100);
            tuple.set(1, 100.1f);
            tuple.set(2, 100L);
            tuple.set(3, 50e+2);
            tuple.set(4, "something");
            tuple.set(5, new DataByteArray("something"));
 
          }
          // the middle + 1 row of the table, the smallest row
          else if (i == 0 && b == (numsBatch / 2)) {
            tuple.set(0, -100);
            tuple.set(1, -100.1f);
            tuple.set(2, -100L);
            tuple.set(3, -50e+2);
            tuple.set(4, "so");
            tuple.set(5, new DataByteArray("so"));
 
          }
 
          else {
            Float f = 1.1f;
            long l = 11;
            double d = 1.1;
            tuple.set(0, b);
            tuple.set(1, f);
            tuple.set(2, l);
            tuple.set(3, d);
            tuple.set(4, "some");
            tuple.set(5, new DataByteArray("some"));
          }
 
          // insert record
          tupRecord1.set(0, "" + b);
          tupRecord1.set(1, "" + b);
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

            tuple.set(7, 100);
            tuple.set(6, 100.1f);
            tuple.set(5, 100L);
            tuple.set(4, 50e+2);
            tuple.set(3, "something");
            tuple.set(2, new DataByteArray("something"));

          }
          // the middle +1 row of the table, the smallest row
          else if (i == 0 && b == (numsBatch / 2)) {
            tuple.set(7, -100);
            tuple.set(6, -100.1f);
            tuple.set(5, -100L);
            tuple.set(4, -50e+2);
            tuple.set(3, "so");
            tuple.set(2, new DataByteArray("so"));

          }

          else {
            Float f = 2.1f;
            long l = 12;
            double d = 2.1;
            tuple.set(7, b*2);
            tuple.set(6, f);
            tuple.set(5, l);
            tuple.set(4, d);
            tuple.set(3, "somee");
            tuple.set(2, new DataByteArray("somee"));
          }

          // insert record
          tupRecord1.set(0, "" + b);
          tupRecord1.set(1, "" + b);
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

    Map<String, String> m1 = new HashMap<String, String>();
    m1.put("a","m1-a");
    m1.put("b","m1-b");
   
    Object[][] table1 = {
      {5,    -3.25f1001L51e+2"Zebra"new DataByteArray("Zebra"),    m1},
      {-13.25f1000L50e+2"zebra"new DataByteArray("zebra"),    m1},
      {1001100.0f1000L50e+2"apple"new DataByteArray("apple"),    m1},
      {100228.0f1000L50e+2"hadoop"new DataByteArray("hadoop"),  m1},
      {10000.0f1002L52e+2"apple"new DataByteArray("apple"),    m1} };
   
    // Create table1
    createTable(pathTable1, STR_SCHEMA1, STR_STORAGE1, table1);
   
    // Create table2 data
    Map<String, String> m2 = new HashMap<String, String>();
    m2.put("a","m2-a");
    m2.put("b","m2-b");
   
    Object[][] table2 = {
      {1556.0f1004L50e+2"green"new DataByteArray("green"),    m2},
      {-1,  -99.0f1008L51e+2"orange"new DataByteArray("orange"),  m2},
      {10010.0f1000L55e+2"white"new DataByteArray("white"),    m2},
      {1001,  -88.0f1001L52e+2"brown"new DataByteArray("brown"),    m2},
      {200033.0f1002L52e+2"beige"new DataByteArray("beige"),    m2} };
   
    // Create table2
    createTable(pathTable2, STR_SCHEMA1, STR_STORAGE1, table2);
   
    // Create table3 data
View Full Code Here

Examples of org.apache.pig.data.DataByteArray

      matcher = matcher.reset(line);
      ArrayList<DataByteArray> list = new ArrayList<DataByteArray>();
      if (matcher.find()) {
        tryNext=false;
        for (int i = 1; i <= matcher.groupCount(); i++) {
          list.add(new DataByteArray(matcher.group(i)));
        }
        return mTupleFactory.newTuple(list)
      }
    }
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.