use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestStructuredColumnMismatchResolver method testResolveArray.
@Test
public void testResolveArray() {
ArrayColumnChecksum checksum1 = new ArrayColumnChecksum(binary(0xa), binary(0xb), 1);
ArrayColumnChecksum checksum2 = new ArrayColumnChecksum(binary(0x1a), binary(0xb), 1);
ArrayColumnChecksum checksum3 = new ArrayColumnChecksum(binary(0xa), binary(0x1b), 1);
ArrayColumnChecksum checksum4 = new ArrayColumnChecksum(binary(0xa), binary(0xb), 2);
// resolved
assertResolved(createMismatchedColumn(new ArrayType(DOUBLE), checksum1, checksum2));
assertResolved(createMismatchedColumn(new ArrayType(REAL), checksum1, checksum2));
assertResolved(createMismatchedColumn(new ArrayType(new ArrayType(DOUBLE)), checksum1, checksum2));
// not resolved, contains no floating point types
assertNotResolved(createMismatchedColumn(new ArrayType(INTEGER), checksum1, checksum2));
assertNotResolved(createMismatchedColumn(new ArrayType(new ArrayType(INTEGER)), checksum1, checksum2));
// not resolved, cardinality mismatches
assertNotResolved(createMismatchedColumn(new ArrayType(DOUBLE), checksum1, checksum3));
assertNotResolved(createMismatchedColumn(new ArrayType(DOUBLE), checksum1, checksum4));
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestDictionaryColumnWriter method verifyIntegerInList.
@Test
public void verifyIntegerInList() throws IOException {
List<List<Integer>> values = new ArrayList<>();
for (int i = 0; i < 50_000; i++) {
int childSize = i % 5;
if (childSize == 4) {
values.add(null);
} else {
List<Integer> childList = new ArrayList<>();
for (int j = 0; j < childSize; j++) {
childList.add(i + j);
}
values.add(childList);
}
}
DirectConversionTester directConversionTester = new DirectConversionTester();
Type listType = new ArrayType(INTEGER);
testDictionary(listType, DWRF, true, true, directConversionTester, values);
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestDictionaryColumnWriter method verifyStringInList.
@Test
public void verifyStringInList() throws IOException {
List<List<String>> values = new ArrayList<>();
for (int i = 0; i < 50_000; i++) {
int childSize = i % 5;
if (childSize == 4) {
values.add(null);
} else {
List<String> childList = new ArrayList<>();
for (int j = 0; j < childSize; j++) {
childList.add(Integer.toString(i + j));
}
values.add(childList);
}
}
DirectConversionTester directConversionTester = new DirectConversionTester();
Type listType = new ArrayType(VARCHAR);
testDictionary(listType, DWRF, true, true, directConversionTester, values);
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestAvroDecoder method testArrayDecodedAsArray.
@Test
public void testArrayDecodedAsArray() throws Exception {
DecoderTestColumnHandle row = new DecoderTestColumnHandle(0, "row", new ArrayType(BIGINT), "array_field", null, null, false, false, false);
Map<DecoderColumnHandle, FieldValueProvider> decodedRow = buildAndDecodeColumn(row, "array_field", "{\"type\": \"array\", \"items\": \"long\"}", ImmutableList.of(114L, 136L));
checkArrayValue(decodedRow, row, new long[] { 114, 136 });
}
use of com.facebook.presto.common.type.ArrayType in project presto by prestodb.
the class TestAvroDecoder method testArrayWithNulls.
@Test
public void testArrayWithNulls() throws Exception {
DecoderTestColumnHandle row = new DecoderTestColumnHandle(0, "row", new ArrayType(BIGINT), "array_field", null, null, false, false, false);
List<Long> values = new ArrayList<>();
values.add(null);
Map<DecoderColumnHandle, FieldValueProvider> decodedRow = buildAndDecodeColumn(row, "array_field", "{\"type\": \"array\", \"items\": \"null\"}", values);
checkArrayItemIsNull(decodedRow, row, new long[] { 0 });
}
Aggregations