本文整理汇总了Java中com.facebook.presto.spi.type.BigintType.BIGINT属性的典型用法代码示例。如果您正苦于以下问题:Java BigintType.BIGINT属性的具体用法?Java BigintType.BIGINT怎么用?Java BigintType.BIGINT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.facebook.presto.spi.type.BigintType
的用法示例。
在下文中一共展示了BigintType.BIGINT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStringNumber
@Test
public void testStringNumber()
throws Exception
{
byte[] json = "{\"a_number\":481516,\"a_string\":\"2342\"}".getBytes(StandardCharsets.UTF_8);
JsonKinesisRowDecoder rowDecoder = new JsonKinesisRowDecoder(PROVIDER.get());
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", VarcharType.VARCHAR, "a_number", null, null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", BigintType.BIGINT, "a_number", null, null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", VarcharType.VARCHAR, "a_string", null, null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", null, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(json, providers, columns, buildMap(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
DecoderTestUtil.checkValue(providers, row1, "481516");
DecoderTestUtil.checkValue(providers, row2, 481516);
DecoderTestUtil.checkValue(providers, row3, "2342");
DecoderTestUtil.checkValue(providers, row4, 2342);
}
示例2: testNonExistent
@Test
public void testNonExistent()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonRowDecoder rowDecoder = new JsonRowDecoder(PROVIDER.get());
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", VarcharType.VARCHAR, "very/deep/varchar", null, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", BigintType.BIGINT, "no_bigint", null, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", DoubleType.DOUBLE, "double/is_missing", null, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BooleanType.BOOLEAN, "hello", null, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(json, null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
checkIsNull(providers, row1);
checkIsNull(providers, row2);
checkIsNull(providers, row3);
checkIsNull(providers, row4);
}
示例3: testStringNumber
@Test
public void testStringNumber()
throws Exception
{
byte[] json = "{\"a_number\":481516,\"a_string\":\"2342\"}".getBytes(StandardCharsets.UTF_8);
JsonRowDecoder rowDecoder = new JsonRowDecoder(PROVIDER.get());
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", VarcharType.VARCHAR, "a_number", null, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", BigintType.BIGINT, "a_number", null, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", VarcharType.VARCHAR, "a_string", null, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", null, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(json, null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
checkValue(providers, row1, "481516");
checkValue(providers, row2, 481516);
checkValue(providers, row3, "2342");
checkValue(providers, row4, 2342);
}
示例4: testNulls
@Test
public void testNulls()
{
String csv = ",,,";
CsvRowDecoder rowDecoder = new CsvRowDecoder();
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", VarcharType.VARCHAR, "0", null, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", BigintType.BIGINT, "1", null, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", DoubleType.DOUBLE, "2", null, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BooleanType.BOOLEAN, "3", null, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(csv.getBytes(StandardCharsets.UTF_8), null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
checkValue(providers, row1, "");
checkValue(providers, row2, 0);
checkValue(providers, row3, 0.0d);
checkValue(providers, row4, false);
}
示例5: testNonExistent
@Test
public void testNonExistent()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonKinesisRowDecoder rowDecoder = new JsonKinesisRowDecoder(PROVIDER.get());
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", VarcharType.VARCHAR, "very/deep/varchar", null, null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", BigintType.BIGINT, "no_bigint", null, null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", DoubleType.DOUBLE, "double/is_missing", null, null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BooleanType.BOOLEAN, "hello", null, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(json, providers, columns, buildMap(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
DecoderTestUtil.checkIsNull(providers, row1);
DecoderTestUtil.checkIsNull(providers, row2);
DecoderTestUtil.checkIsNull(providers, row3);
DecoderTestUtil.checkIsNull(providers, row4);
}
示例6: testSimple
@Test
public void testSimple()
{
ByteBuffer buf = ByteBuffer.allocate(100);
buf.putLong(4815162342L); // 0 - 7
buf.putInt(12345678); // 8 - 11
buf.putShort((short) 4567); // 12 - 13
buf.put((byte) 123); // 14
buf.put("Ich bin zwei Oeltanks".getBytes(StandardCharsets.UTF_8)); // 15+
byte[] row = new byte[buf.position()];
System.arraycopy(buf.array(), 0, row, 0, buf.position());
RawKinesisRowDecoder rowDecoder = new RawKinesisRowDecoder();
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", BigintType.BIGINT, "0", "LONG", null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", BigintType.BIGINT, "8", "INT", null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", BigintType.BIGINT, "12", "SHORT", null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BigintType.BIGINT, "14", "BYTE", null, false, false);
KinesisColumnHandle row5 = new KinesisColumnHandle("", 4, "row5", VarcharType.VARCHAR, "15", null, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(row, providers, columns, buildMap(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
DecoderTestUtil.checkValue(providers, row1, 4815162342L);
DecoderTestUtil.checkValue(providers, row2, 12345678);
DecoderTestUtil.checkValue(providers, row3, 4567);
DecoderTestUtil.checkValue(providers, row4, 123);
DecoderTestUtil.checkValue(providers, row5, "Ich bin zwei Oeltanks");
}
示例7: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonKinesisRowDecoder rowDecoder = new JsonKinesisRowDecoder(PROVIDER.get());
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", ISO8601JsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", ISO8601JsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row5 = new KinesisColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", ISO8601JsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row6 = new KinesisColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", ISO8601JsonKinesisFieldDecoder.NAME, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(json, providers, columns, buildMap(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
// sanity checks
DecoderTestUtil.checkIsNull(providers, row1);
DecoderTestUtil.checkIsNull(providers, row2);
DecoderTestUtil.checkIsNull(providers, row3);
DecoderTestUtil.checkIsNull(providers, row4);
DecoderTestUtil.checkIsNull(providers, row5);
DecoderTestUtil.checkIsNull(providers, row6);
}
示例8: testSimple
@Test
public void testSimple()
throws Exception
{
byte[] json = ByteStreams.toByteArray(TestJsonDecoder.class.getResourceAsStream("/decoder/json/message.json"));
JsonRowDecoder rowDecoder = new JsonRowDecoder(PROVIDER.get());
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", VarcharType.VARCHAR, "source", null, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", VarcharType.VARCHAR, "user/screen_name", null, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", BigintType.BIGINT, "id", null, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BigintType.BIGINT, "user/statuses_count", null, null, false, false, false);
DecoderTestColumnHandle row5 = new DecoderTestColumnHandle("", 4, "row5", BooleanType.BOOLEAN, "user/geo_enabled", null, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(json, null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
checkValue(providers, row1, "<a href=\"http://twitterfeed.com\" rel=\"nofollow\">twitterfeed</a>");
checkValue(providers, row2, "EKentuckyNews");
checkValue(providers, row3, 493857959588286460L);
checkValue(providers, row4, 7630);
checkValue(providers, row5, true);
}
示例9: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonRowDecoder rowDecoder = new JsonRowDecoder(PROVIDER.get());
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", DEFAULT_FIELD_DECODER_NAME, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", DEFAULT_FIELD_DECODER_NAME, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", SecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", SecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row5 = new DecoderTestColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", SecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row6 = new DecoderTestColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", SecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(json, null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
// sanity checks
checkIsNull(providers, row1);
checkIsNull(providers, row2);
checkIsNull(providers, row3);
checkIsNull(providers, row4);
checkIsNull(providers, row5);
checkIsNull(providers, row6);
}
示例10: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonRowDecoder rowDecoder = new JsonRowDecoder(PROVIDER.get());
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", DEFAULT_FIELD_DECODER_NAME, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", DEFAULT_FIELD_DECODER_NAME, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", MillisecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", MillisecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row5 = new DecoderTestColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", MillisecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row6 = new DecoderTestColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", MillisecondsSinceEpochJsonFieldDecoder.NAME, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(json, null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
// sanity checks
checkIsNull(providers, row1);
checkIsNull(providers, row2);
checkIsNull(providers, row3);
checkIsNull(providers, row4);
checkIsNull(providers, row5);
checkIsNull(providers, row6);
}
示例11: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonKinesisRowDecoder rowDecoder = new JsonKinesisRowDecoder(PROVIDER.get());
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", SecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", SecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row5 = new KinesisColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", SecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row6 = new KinesisColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", SecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(json, providers, columns, buildMap(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
// sanity checks
DecoderTestUtil.checkIsNull(providers, row1);
DecoderTestUtil.checkIsNull(providers, row2);
DecoderTestUtil.checkIsNull(providers, row3);
DecoderTestUtil.checkIsNull(providers, row4);
DecoderTestUtil.checkIsNull(providers, row5);
DecoderTestUtil.checkIsNull(providers, row6);
}
示例12: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonRowDecoder rowDecoder = new JsonRowDecoder(PROVIDER.get());
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", DEFAULT_FIELD_DECODER_NAME, null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", DEFAULT_FIELD_DECODER_NAME, null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", RFC2822JsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", RFC2822JsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row5 = new DecoderTestColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", RFC2822JsonFieldDecoder.NAME, null, false, false, false);
DecoderTestColumnHandle row6 = new DecoderTestColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", RFC2822JsonFieldDecoder.NAME, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(json, null, providers, columns, map(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
// sanity checks
checkIsNull(providers, row1);
checkIsNull(providers, row2);
checkIsNull(providers, row3);
checkIsNull(providers, row4);
checkIsNull(providers, row5);
checkIsNull(providers, row6);
}
示例13: testSimple
@Test
public void testSimple()
{
ByteBuffer buf = ByteBuffer.allocate(100);
buf.putLong(4815162342L); // 0 - 7
buf.putInt(12345678); // 8 - 11
buf.putShort((short) 4567); // 12 - 13
buf.put((byte) 123); // 14
buf.put("Ich bin zwei Oeltanks".getBytes(StandardCharsets.UTF_8)); // 15+
byte[] row = new byte[buf.position()];
System.arraycopy(buf.array(), 0, row, 0, buf.position());
RawRowDecoder rowDecoder = new RawRowDecoder();
DecoderTestColumnHandle row1 = new DecoderTestColumnHandle("", 0, "row1", BigintType.BIGINT, "0", "LONG", null, false, false, false);
DecoderTestColumnHandle row2 = new DecoderTestColumnHandle("", 1, "row2", BigintType.BIGINT, "8", "INT", null, false, false, false);
DecoderTestColumnHandle row3 = new DecoderTestColumnHandle("", 2, "row3", BigintType.BIGINT, "12", "SHORT", null, false, false, false);
DecoderTestColumnHandle row4 = new DecoderTestColumnHandle("", 3, "row4", BigintType.BIGINT, "14", "BYTE", null, false, false, false);
DecoderTestColumnHandle row5 = new DecoderTestColumnHandle("", 4, "row5", VarcharType.VARCHAR, "15", null, null, false, false, false);
List<DecoderColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5);
Set<FieldValueProvider> providers = new HashSet<>();
boolean corrupt = rowDecoder.decodeRow(row, null, providers, columns, buildMap(columns));
assertFalse(corrupt);
assertEquals(providers.size(), columns.size());
checkValue(providers, row1, 4815162342L);
checkValue(providers, row2, 12345678);
checkValue(providers, row3, 4567);
checkValue(providers, row4, 123);
checkValue(providers, row5, "Ich bin zwei Oeltanks");
}
示例14: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonKinesisRowDecoder rowDecoder = new JsonKinesisRowDecoder(PROVIDER.get());
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", MillisecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", MillisecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row5 = new KinesisColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", MillisecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row6 = new KinesisColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", MillisecondsSinceEpochJsonKinesisFieldDecoder.NAME, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(json, providers, columns, buildMap(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
// sanity checks
DecoderTestUtil.checkIsNull(providers, row1);
DecoderTestUtil.checkIsNull(providers, row2);
DecoderTestUtil.checkIsNull(providers, row3);
DecoderTestUtil.checkIsNull(providers, row4);
DecoderTestUtil.checkIsNull(providers, row5);
DecoderTestUtil.checkIsNull(providers, row6);
}
开发者ID:qubole,项目名称:presto-kinesis,代码行数:32,代码来源:TestMillisecondsSinceEpochJsonKinesisFieldDecoder.java
示例15: testNullValues
@Test
public void testNullValues()
throws Exception
{
byte[] json = "{}".getBytes(StandardCharsets.UTF_8);
JsonKinesisRowDecoder rowDecoder = new JsonKinesisRowDecoder(PROVIDER.get());
KinesisColumnHandle row1 = new KinesisColumnHandle("", 0, "row1", BigintType.BIGINT, "a_number", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row2 = new KinesisColumnHandle("", 1, "row2", VarcharType.VARCHAR, "a_string", KinesisFieldDecoder.DEFAULT_FIELD_DECODER_NAME, null, false, false);
KinesisColumnHandle row3 = new KinesisColumnHandle("", 2, "row3", BigintType.BIGINT, "a_number", RFC2822JsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row4 = new KinesisColumnHandle("", 3, "row4", BigintType.BIGINT, "a_string", RFC2822JsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row5 = new KinesisColumnHandle("", 4, "row5", VarcharType.VARCHAR, "a_number", RFC2822JsonKinesisFieldDecoder.NAME, null, false, false);
KinesisColumnHandle row6 = new KinesisColumnHandle("", 5, "row6", VarcharType.VARCHAR, "a_string", RFC2822JsonKinesisFieldDecoder.NAME, null, false, false);
List<KinesisColumnHandle> columns = ImmutableList.of(row1, row2, row3, row4, row5, row6);
Set<KinesisFieldValueProvider> providers = new HashSet<>();
boolean valid = rowDecoder.decodeRow(json, providers, columns, map(columns));
assertTrue(valid);
assertEquals(providers.size(), columns.size());
// sanity checks
checkIsNull(providers, row1);
checkIsNull(providers, row2);
checkIsNull(providers, row3);
checkIsNull(providers, row4);
checkIsNull(providers, row5);
checkIsNull(providers, row6);
}