Package org.apache.pig.data

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));
    bag1.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));
    bag1.add(tupColl2);
    tuple.set(0, bag1);

    collRecord1.set(0, 1);
    collRecord1.set(1, "record1_string1");
    tupColl2_1.set(0, collRecord1);
    tupColl2_1.set(1, "hello1");
    bag2.add(tupColl2_1);

    collRecord2.set(0, 2);
    collRecord2.set(1, "record2_string1");
    tupColl2_2.set(0, collRecord2);
    tupColl2_2.set(1, "hello2");
    bag2.add(tupColl2_2);
    tuple.set(1, bag2);

    TypesUtils.resetTuple(tupColl3_1);
    TypesUtils.resetTuple(tupColl3_2);
    tupColl3_1.set(0, 1);
    tupColl3_1.set(1, true);
    tupColl3_2.set(0, 2);
    tupColl3_2.set(1, false);
    bag3_1.add(tupColl3_1);
    bag3_1.add(tupColl3_2);
    bag3.addAll(bag3_1);

    tupColl3_3.set(0, 3);
    tupColl3_3.set(1, true);
    tupColl3_4.set(0, 4);
    tupColl3_4.set(1, false);
    bag3_2.add(tupColl3_3);
    bag3_2.add(tupColl3_4);
    bag3.addAll(bag3_2);
    tuple.set(2, bag3);

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

    row++;

    bag1.clear();
    bag2.clear();
    bag3.clear();
    bag3_1.clear();
    bag3_2.clear();
    TypesUtils.resetTuple(tupColl1);
    TypesUtils.resetTuple(tupColl2);
    TypesUtils.resetTuple(tupColl2_1);
    TypesUtils.resetTuple(tupColl2_2);
    TypesUtils.resetTuple(collRecord1);
    TypesUtils.resetTuple(collRecord2);
    TypesUtils.resetTuple(tupColl3_1);
    TypesUtils.resetTuple(tupColl3_2);
    TypesUtils.resetTuple(tupColl3_3);
    TypesUtils.resetTuple(tupColl3_4);

    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));
    bag1.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));
    bag1.add(tupColl2);
    tuple.set(0, bag1);

    collRecord1.set(0, 3);
    collRecord1.set(1, "record1_string2");
View Full Code Here


    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
    tuple.set(6, 1); // int
    tuple.set(7, 1); // int
    tuple.set(8, 1); // int
    tuple.set(9, 1); // int
    tuple.set(10, 1); // int
    tuple.set(11, 1); // int

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

    // insert data in row 2
    row++;
    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
    tuple.set(6, 2); // int
    tuple.set(7, 2); // int
    tuple.set(8, 2); // int
    tuple.set(9, 2); // int
    tuple.set(10, 2); // int
View Full Code Here

    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

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

    // insert data in row 2
    row++;
    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
    inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
        .getBytes()), tuple);

    // finish building table, closing out the inserter, writer, writer1
    inserter.close();
View Full Code Here

    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
    tuple.set(6, 1); // int
    tuple.set(7, 1); // int
    tuple.set(8, 1); // int
    tuple.set(9, 1); // int
    tuple.set(10, 1); // int
    tuple.set(11, 1); // int

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

    // insert data in row 2
    row++;
    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
    tuple.set(6, 2); // int
    tuple.set(7, 2); // int
    tuple.set(8, 2); // int
    tuple.set(9, 2); // int
    tuple.set(10, 2); // int
View Full Code Here

    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(0, bagColl);

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

    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(0, bagColl);
    inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
        .getBytes()), tuple);
View Full Code Here

    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

    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

    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

    m1 = new HashMap<String, String>();
    m1.put("a","m1-a");
    m1.put("b","m1-b");
   
    table1 = new Object[][]{
      {5,    -3.25f1001L51e+2"Zebra"new DataByteArray("Zebra"),    m1},
      {-13.25f1000L50e+2"zebra"new DataByteArray("zebra"),    m1},
      {1001100.0f1003L50e+2"Apple"new DataByteArray("Apple"),    m1},
      {1001101.0f1001L50e+2"apple"new DataByteArray("apple"),    m1},
      {1001101.0f1001L50e+2"apple"new DataByteArray("apple"),    m1},
      {100150.0f1000L50e+2"Pig",    new DataByteArray("Pig"),    m1},
      {100152.0f1001L50e+2"pig",    new DataByteArray("pig"),    m1},
      {100228.0f1000L50e+2"Hadoop"new DataByteArray("Hadoop"),  m1},
      {10000.0f1002L52e+2"hadoop"new DataByteArray("hadoop"),  m1} };
   
    // Create table1
    createTable(pathTable1, STR_SCHEMA1, STR_STORAGE1, table1);
   
    // Create table2 data
    m2 = new HashMap<String, String>();
    m2.put("a","m2-a");
    m2.put("b","m2-b");
   
    table2 = new Object[][] {
      {1556.0f1004L50e+2"green"new DataByteArray("green"),    m2},
      {-1,  -99.0f1002L51e+2"orange"new DataByteArray("orange"),  m2},
      {1001100.0f1003L55e+2"white"new DataByteArray("white"),    m2},
      {1001102.0f1001L52e+2"purple"new DataByteArray("purple"),  m2},
      {100150.0f1008L52e+2"gray",    new DataByteArray("gray"),    m2},
      {100153.0f1001L52e+2"brown"new DataByteArray("brown"),    m2},
      {200033.0f1006L52e+2"beige"new DataByteArray("beige"),    m2} };
   
    // Create table2
    createTable(pathTable2, STR_SCHEMA1, STR_STORAGE1, table2);
  }
View Full Code Here

    // Verify union table
    HashMap<Integer, ArrayList<ArrayList<Object>>> resultTable
        = new HashMap<Integer, ArrayList<ArrayList<Object>>>();
   
    ArrayList<ArrayList<Object>> rows = new ArrayList<ArrayList<Object>>();
    addResultRow(rows, -1,   3.25f1000L50e+2"zebra"new DataByteArray("zebra"), m1);
    addResultRow(rows,  5,    -3.25f, 1001L51e+2"Zebra"new DataByteArray("Zebra"), m1)
    addResultRow(rows, 1000, 0.0f, 1002L52e+2"hadoop", new DataByteArray("hadoop"),m1);
    addResultRow(rows, 1001, 100.0f, 1003L50e+2"Apple"new DataByteArray("Apple"), m1);
    addResultRow(rows, 1001, 101.0f, 1001L50e+2"apple"new DataByteArray("apple"), m1);
    addResultRow(rows, 1001, 101.0f, 1001L50e+2"apple"new DataByteArray("apple"), m1);
    addResultRow(rows, 1001, 50.0f1000L50e+2"Pig",    new DataByteArray("Pig"), m1);
    addResultRow(rows, 1001, 52.0f1001L50e+2"pig",    new DataByteArray("pig"), m1);
    addResultRow(rows, 1002, 28.0f1000L50e+2"Hadoop", new DataByteArray("Hadoop"),m1);
    resultTable.put(0, rows);
   
    rows = new ArrayList<ArrayList<Object>>();
    addResultRow(rows, -1,   -99.0f, 1002L51e+2"orange", new DataByteArray("orange"),m2);
    addResultRow(rows, 15,   56.0f1004L50e+2"green"new DataByteArray("green"), m2);
    addResultRow(rows, 1001, 100.0f, 1003L55e+2"white"new DataByteArray("white"), m2);
    addResultRow(rows, 1001, 102.0f, 1001L52e+2"purple", new DataByteArray("purple"),m2);
    addResultRow(rows, 1001, 50.0f1008L52e+2"gray",   new DataByteArray("gray"),  m2);
    addResultRow(rows, 1001, 53.0f1001L52e+2"brown"new DataByteArray("brown"), m2);
    addResultRow(rows, 2000, 33.0f1006L52e+2"beige"new DataByteArray("beige"), m2);
    resultTable.put(1, rows);
   
    // Verify union table
    Iterator<Tuple> it = pigServer.openIterator("records1");
    int numbRows = verifyTable(resultTable, 0, 7, it);
View Full Code Here

TOP

Related Classes of org.apache.pig.data.DataByteArray

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.