Package org.apache.pig.data

Examples of org.apache.pig.data.DataByteArray


            Tuple column = (Tuple) t.get(1);
            Assert.assertEquals(column.get(1), "ascii");
            column = (Tuple) t.get(2);
            Assert.assertEquals(column.get(1), false);
            column = (Tuple) t.get(3);
            Assert.assertEquals(column.get(1), new DataByteArray(Hex.hexToBytes("DEADBEEF")));
            column = (Tuple) t.get(4);
            Assert.assertEquals(column.get(1), 1296705900000L);
            column = (Tuple) t.get(5);
            Assert.assertEquals(column.get(1), "23.345");
            column = (Tuple) t.get(6);
            Assert.assertEquals(column.get(1), 2.7182818284590451d);
            column = (Tuple) t.get(7);
            Assert.assertEquals(column.get(1), 23.45f);
            column = (Tuple) t.get(8);
            Assert.assertEquals(column.get(1), "127.0.0.1");
            column = (Tuple) t.get(9);
            Assert.assertEquals(column.get(1), 23);
            column = (Tuple) t.get(10);
            Assert.assertEquals(column.get(1), 12345);
            column = (Tuple) t.get(11);
            Assert.assertEquals(column.get(1), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f77").array())));
            column = (Tuple) t.get(12);
            Assert.assertEquals(column.get(1), 12345678L);
            column = (Tuple) t.get(13);
            Assert.assertEquals(column.get(1), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f7f").array())));
            column = (Tuple) t.get(14);
            Assert.assertEquals(column.get(1), "hello");
            column = (Tuple) t.get(15);
            Assert.assertEquals(column.get(1), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440000").array())));
        }

        pig.registerQuery("cc_rows = LOAD 'cassandra://thriftKs/CC?" + defaultParameters + "' USING CassandraStorage();");

        //(chuck,{(kick,3)})
View Full Code Here


        if (it.hasNext()) {
            Tuple t = it.next();
            Assert.assertEquals(t.get(0), 1);
            Assert.assertEquals(t.get(1), "ascii");
            Assert.assertEquals(t.get(2), 12345678L);
            Assert.assertEquals(t.get(3), new DataByteArray(Hex.hexToBytes("23446c6c6f")));
            Assert.assertEquals(t.get(4), false);
            Assert.assertEquals(t.get(5), "23.4567");
            Assert.assertEquals(t.get(6), 12345678.12345678d);
            Assert.assertEquals(t.get(7), 123.12f);
            Assert.assertEquals(t.get(8), "127.0.0.1");
            Assert.assertEquals(t.get(9), 123);
            Assert.assertEquals(t.get(10), "text");
            Assert.assertEquals(t.get(11), 1296705900000L);
            Assert.assertEquals(t.get(12), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f7f").array())));
            Assert.assertEquals(t.get(13), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440000").array())));
            Assert.assertEquals(t.get(14), "varchar");
            Assert.assertEquals(t.get(15), 123);
        }
       
        pig.registerQuery("cc_rows = LOAD 'cql://cql3ks/countertable?" + defaultParameters + "' USING CqlStorage();");
View Full Code Here

            Assert.assertEquals(innerTuple.get(1), "ascii2");
            innerTuple = (Tuple) t.get(2);
            Assert.assertEquals(innerTuple.get(0), 12345678L);
            Assert.assertEquals(innerTuple.get(1), 12345679L);
            innerTuple = (Tuple) t.get(3);
            Assert.assertEquals(innerTuple.get(0), new DataByteArray(Hex.hexToBytes("68656c6c6e")));
            Assert.assertEquals(innerTuple.get(1), new DataByteArray(Hex.hexToBytes("68656c6c6f")));
            innerTuple = (Tuple) t.get(4);
            Assert.assertEquals(innerTuple.get(0), false);
            Assert.assertEquals(innerTuple.get(1), true);
            innerTuple = (Tuple) t.get(5);
            Assert.assertEquals(innerTuple.get(0), "23.4567");
            Assert.assertEquals(innerTuple.get(1), "23.4568");
            innerTuple = (Tuple) t.get(6);
            Assert.assertEquals(innerTuple.get(0), 12345678.12345678d);
            Assert.assertEquals(innerTuple.get(1), 12345678.12345679d);
            innerTuple = (Tuple) t.get(7);
            Assert.assertEquals(innerTuple.get(0), 123.12f);
            Assert.assertEquals(innerTuple.get(1), 123.13f);
            innerTuple = (Tuple) t.get(8);
            Assert.assertEquals(innerTuple.get(0), "127.0.0.1");
            Assert.assertEquals(innerTuple.get(1), "127.0.0.2");
            innerTuple = (Tuple) t.get(9);
            Assert.assertEquals(innerTuple.get(0), 123);
            Assert.assertEquals(innerTuple.get(1), 124);
            innerTuple = (Tuple) t.get(10);
            Assert.assertEquals(innerTuple.get(0), "text1");
            Assert.assertEquals(innerTuple.get(1), "text2");
            innerTuple = (Tuple) t.get(11);
            Assert.assertEquals(innerTuple.get(0), 1296705900000L);
            Assert.assertEquals(innerTuple.get(1), 1296792300000L);
            innerTuple = (Tuple) t.get(12);
            Assert.assertEquals(innerTuple.get(0), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f77").array())));
            Assert.assertEquals(innerTuple.get(1), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f7f").array())));
            innerTuple = (Tuple) t.get(13);
            Assert.assertEquals(innerTuple.get(0), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440000").array())));
            Assert.assertEquals(innerTuple.get(1), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440001").array())));
            innerTuple = (Tuple) t.get(14);
            Assert.assertEquals(innerTuple.get(0), "varchar1");
            Assert.assertEquals(innerTuple.get(1), "varchar2")
            innerTuple = (Tuple) t.get(15);
            Assert.assertEquals(innerTuple.get(0), 123);
View Full Code Here

            Assert.assertEquals(innerTuple.get(0), "ascii2");
            innerTuple = (Tuple) t.get(2);
            Assert.assertEquals(innerTuple.get(1), 12345678L);
            Assert.assertEquals(innerTuple.get(0), 12345679L);
            innerTuple = (Tuple) t.get(3);
            Assert.assertEquals(innerTuple.get(1), new DataByteArray(Hex.hexToBytes("68656c6c6f")));
            Assert.assertEquals(innerTuple.get(0), new DataByteArray(Hex.hexToBytes("68656c6c6e")));
            innerTuple = (Tuple) t.get(4);
            Assert.assertEquals(innerTuple.get(1), false);
            Assert.assertEquals(innerTuple.get(0), true);
            innerTuple = (Tuple) t.get(5);
            Assert.assertEquals(innerTuple.get(1), "23.4567");
            Assert.assertEquals(innerTuple.get(0), "23.4568");
            innerTuple = (Tuple) t.get(6);
            Assert.assertEquals(innerTuple.get(1), 12345678.12345678d);
            Assert.assertEquals(innerTuple.get(0), 12345678.12345679d);
            innerTuple = (Tuple) t.get(7);
            Assert.assertEquals(innerTuple.get(1), 123.12f);
            Assert.assertEquals(innerTuple.get(0), 123.13f);
            innerTuple = (Tuple) t.get(8);
            Assert.assertEquals(innerTuple.get(1), "127.0.0.1");
            Assert.assertEquals(innerTuple.get(0), "127.0.0.2");
            innerTuple = (Tuple) t.get(9);
            Assert.assertEquals(innerTuple.get(1), 123);
            Assert.assertEquals(innerTuple.get(0), 124);
            innerTuple = (Tuple) t.get(10);
            Assert.assertEquals(innerTuple.get(1), "text1");
            Assert.assertEquals(innerTuple.get(0), "text2");
            innerTuple = (Tuple) t.get(11);
            Assert.assertEquals(innerTuple.get(1), 1296705900000L);
            Assert.assertEquals(innerTuple.get(0), 1296792300000L);
            innerTuple = (Tuple) t.get(12);
            Assert.assertEquals(innerTuple.get(1), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f7f").array())));
            Assert.assertEquals(innerTuple.get(0), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f77").array())));
            innerTuple = (Tuple) t.get(13);
            Assert.assertEquals(innerTuple.get(1), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440000").array())));
            Assert.assertEquals(innerTuple.get(0), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440001").array())));
            innerTuple = (Tuple) t.get(14);
            Assert.assertEquals(innerTuple.get(1), "varchar1");
            Assert.assertEquals(innerTuple.get(0), "varchar2")
            innerTuple = (Tuple) t.get(15);
            Assert.assertEquals(innerTuple.get(1), 123);
View Full Code Here

            Assert.assertEquals(innerTuple.get(1), "ascii2");
            innerTuple = (Tuple) ((Tuple) t.get(2)).get(0);
            Assert.assertEquals(innerTuple.get(0), 12345678L);
            Assert.assertEquals(innerTuple.get(1), 12345679L);
            innerTuple = (Tuple) ((Tuple) t.get(3)).get(0);
            Assert.assertEquals(innerTuple.get(0), new DataByteArray(Hex.hexToBytes("68656c6c6f")));
            Assert.assertEquals(innerTuple.get(1), new DataByteArray(Hex.hexToBytes("68656c6c6e")));
            innerTuple = (Tuple) ((Tuple) t.get(4)).get(0);
            Assert.assertEquals(innerTuple.get(0), false);
            Assert.assertEquals(innerTuple.get(1), true);
            innerTuple = (Tuple) ((Tuple) t.get(5)).get(0);
            Assert.assertEquals(innerTuple.get(0), "23.4567");
            Assert.assertEquals(innerTuple.get(1), "23.4568");
            innerTuple = (Tuple) ((Tuple) t.get(6)).get(0);
            Assert.assertEquals(innerTuple.get(0), 12345678.12345678d);
            Assert.assertEquals(innerTuple.get(1), 12345678.12345679d);
            innerTuple = (Tuple) ((Tuple) t.get(7)).get(0);
            Assert.assertEquals(innerTuple.get(0), 123.12f);
            Assert.assertEquals(innerTuple.get(1), 123.13f);
            innerTuple = (Tuple) ((Tuple) t.get(8)).get(0);
            Assert.assertEquals(innerTuple.get(0), "127.0.0.1");
            Assert.assertEquals(innerTuple.get(1), "127.0.0.2");
            innerTuple = (Tuple) ((Tuple) t.get(9)).get(0);
            Assert.assertEquals(innerTuple.get(0), 123);
            Assert.assertEquals(innerTuple.get(1), 124);
            innerTuple = (Tuple) ((Tuple) t.get(10)).get(0);
            Assert.assertEquals(innerTuple.get(0), "text1");
            Assert.assertEquals(innerTuple.get(1), "text2");
            innerTuple = (Tuple) ((Tuple) t.get(11)).get(0);
            Assert.assertEquals(innerTuple.get(0), 1296705900000L);
            Assert.assertEquals(innerTuple.get(1), 1296792300000L);
            innerTuple = (Tuple) ((Tuple) t.get(12)).get(0);
            Assert.assertEquals(innerTuple.get(0), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f7f").array())));
            Assert.assertEquals(innerTuple.get(1), new DataByteArray((TimeUUIDType.instance.fromString("e23f450f-53a6-11e2-7f7f-7f7f7f7f7f77").array())));
            innerTuple = (Tuple) ((Tuple) t.get(13)).get(0);
            Assert.assertEquals(innerTuple.get(0), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440000").array())));
            Assert.assertEquals(innerTuple.get(1), new DataByteArray((UUIDType.instance.fromString("550e8400-e29b-41d4-a716-446655440001").array())));
            innerTuple = (Tuple) ((Tuple) t.get(14)).get(0);
            Assert.assertEquals(innerTuple.get(0), "varchar1");
            Assert.assertEquals(innerTuple.get(1), "varchar2")
            innerTuple = (Tuple) ((Tuple) t.get(15)).get(0);
            Assert.assertEquals(innerTuple.get(0), 123);
View Full Code Here

    }

    @Test
    public void testNamedByteArray() {
        String expected = "{\"name\":\"Ynl0ZSBhcnJheQ==\"}";
        assertThat(pigTypeToJson(createTuple(new DataByteArray("byte array".getBytes()), createSchema("name:bytearray"))), is(expected));
    }
View Full Code Here

    }

    @Test
    public void testAnonByteArray() {
        String expected = "{\"val_0\":\"Ynl0ZSBhcnJheQ==\"}";
        assertThat(pigTypeToJson(createTuple(new DataByteArray("byte array".getBytes()), createSchema("bytearray"))),
                is(expected));
    }
View Full Code Here

        return TupleFactory.getInstance().newTupleNoCopy(value);
    }

    @Override
    protected Object binaryValue(byte[] value) {
        return new DataByteArray(value);
    }
View Full Code Here

    }

    @Test
    public void testByteArray() {
        String expected = "{\"name\":\"Ynl0ZSBhcnJheQ==\"}";
        assertThat(pigTypeToJson(createTuple(new DataByteArray("byte array".getBytes()), createSchema("name:bytearray"))), is(expected));
    }
View Full Code Here

      rval = TimeUUIDUtils.getTimeUUID(time);
    } else {
      rval = TimeUUIDUtils.getUniqueTimeUUIDinMillis();
    }
   
    return new DataByteArray(TimeUUIDUtils.asByteArray(rval));
  }
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.