Search in sources :

Example 1 with SqlVarbinary

use of com.facebook.presto.common.type.SqlVarbinary in project presto by prestodb.

the class OrcTester method decodeRecordReaderValue.

private static Object decodeRecordReaderValue(Type type, Object actualValue) {
    if (actualValue instanceof OrcLazyObject) {
        try {
            actualValue = ((OrcLazyObject) actualValue).materialize();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
    if (actualValue instanceof BooleanWritable) {
        actualValue = ((BooleanWritable) actualValue).get();
    } else if (actualValue instanceof ByteWritable) {
        actualValue = ((ByteWritable) actualValue).get();
    } else if (actualValue instanceof BytesWritable) {
        actualValue = new SqlVarbinary(((BytesWritable) actualValue).copyBytes());
    } else if (actualValue instanceof DateWritable) {
        actualValue = new SqlDate(((DateWritable) actualValue).getDays());
    } else if (actualValue instanceof DoubleWritable) {
        actualValue = ((DoubleWritable) actualValue).get();
    } else if (actualValue instanceof FloatWritable) {
        actualValue = ((FloatWritable) actualValue).get();
    } else if (actualValue instanceof IntWritable) {
        actualValue = ((IntWritable) actualValue).get();
    } else if (actualValue instanceof HiveCharWritable) {
        actualValue = ((HiveCharWritable) actualValue).getPaddedValue().toString();
    } else if (actualValue instanceof LongWritable) {
        actualValue = ((LongWritable) actualValue).get();
    } else if (actualValue instanceof ShortWritable) {
        actualValue = ((ShortWritable) actualValue).get();
    } else if (actualValue instanceof HiveDecimalWritable) {
        DecimalType decimalType = (DecimalType) type;
        HiveDecimalWritable writable = (HiveDecimalWritable) actualValue;
        // writable messes with the scale so rescale the values to the Presto type
        BigInteger rescaledValue = rescale(writable.getHiveDecimal().unscaledValue(), writable.getScale(), decimalType.getScale());
        actualValue = new SqlDecimal(rescaledValue, decimalType.getPrecision(), decimalType.getScale());
    } else if (actualValue instanceof Text) {
        actualValue = actualValue.toString();
    } else if (actualValue instanceof TimestampWritable) {
        TimestampWritable timestamp = (TimestampWritable) actualValue;
        actualValue = sqlTimestampOf((timestamp.getSeconds() * 1000) + (timestamp.getNanos() / 1000000L), SESSION);
    } else if (actualValue instanceof OrcStruct) {
        List<Object> fields = new ArrayList<>();
        OrcStruct structObject = (OrcStruct) actualValue;
        for (int fieldId = 0; fieldId < structObject.getNumFields(); fieldId++) {
            fields.add(OrcUtil.getFieldValue(structObject, fieldId));
        }
        actualValue = decodeRecordReaderStruct(type, fields);
    } else if (actualValue instanceof com.facebook.hive.orc.OrcStruct) {
        List<Object> fields = new ArrayList<>();
        com.facebook.hive.orc.OrcStruct structObject = (com.facebook.hive.orc.OrcStruct) actualValue;
        for (int fieldId = 0; fieldId < structObject.getNumFields(); fieldId++) {
            fields.add(structObject.getFieldValue(fieldId));
        }
        actualValue = decodeRecordReaderStruct(type, fields);
    } else if (actualValue instanceof List) {
        actualValue = decodeRecordReaderList(type, ((List<?>) actualValue));
    } else if (actualValue instanceof Map) {
        actualValue = decodeRecordReaderMap(type, (Map<?, ?>) actualValue);
    }
    return actualValue;
}
Also used : SqlVarbinary(com.facebook.presto.common.type.SqlVarbinary) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) TimestampWritable(org.apache.hadoop.hive.serde2.io.TimestampWritable) UncheckedIOException(java.io.UncheckedIOException) DoubleWritable(org.apache.hadoop.io.DoubleWritable) ShortWritable(org.apache.hadoop.hive.serde2.io.ShortWritable) OrcLazyObject(com.facebook.hive.orc.lazy.OrcLazyObject) OrcStruct(org.apache.hadoop.hive.ql.io.orc.OrcStruct) Arrays.asList(java.util.Arrays.asList) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) Collectors.toList(java.util.stream.Collectors.toList) LongWritable(org.apache.hadoop.io.LongWritable) ByteWritable(org.apache.hadoop.io.ByteWritable) IntWritable(org.apache.hadoop.io.IntWritable) DateWritable(org.apache.hadoop.hive.serde2.io.DateWritable) HiveDecimalWritable(org.apache.hadoop.hive.serde2.io.HiveDecimalWritable) HiveCharWritable(org.apache.hadoop.hive.serde2.io.HiveCharWritable) BytesWritable(org.apache.hadoop.io.BytesWritable) SqlDecimal(com.facebook.presto.common.type.SqlDecimal) Text(org.apache.hadoop.io.Text) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) FloatWritable(org.apache.hadoop.io.FloatWritable) BooleanWritable(org.apache.hadoop.io.BooleanWritable) SqlDate(com.facebook.presto.common.type.SqlDate) DecimalType(com.facebook.presto.common.type.DecimalType) BigInteger(java.math.BigInteger) OrcLazyObject(com.facebook.hive.orc.lazy.OrcLazyObject) Map(java.util.Map) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) ImmutableMap(com.google.common.collect.ImmutableMap) HashMap(java.util.HashMap)

Example 2 with SqlVarbinary

use of com.facebook.presto.common.type.SqlVarbinary in project presto by prestodb.

the class TestSelectiveOrcReader method testVarBinaries.

@Test
public void testVarBinaries() throws Exception {
    tester.testRoundTrip(VARBINARY, createList(NUM_ROWS, i -> new SqlVarbinary(String.valueOf(i).getBytes(UTF_8))), stringIn(false, "10", "11"));
    tester.testRoundTripTypes(ImmutableList.of(VARBINARY, VARBINARY), ImmutableList.of(createList(NUM_ROWS, i -> new SqlVarbinary(Ints.toByteArray(i))), Streams.stream(limit(cycle(ImmutableList.of("A", "B", "C")), NUM_ROWS)).map(String::getBytes).map(SqlVarbinary::new).collect(toImmutableList())), toSubfieldFilters(ImmutableMap.of(0, stringBetween(true, "10", "16"), 1, stringBetween(false, "A", "B"))));
    tester.testRoundTrip(VARBINARY, createList(NUM_ROWS, i -> new SqlVarbinary(String.valueOf(i).getBytes(UTF_8))), bytesBetween(false, new byte[] { 8 }, new byte[] { 9 }));
    tester.testRoundTrip(VARBINARY, nCopies(NUM_ROWS, new SqlVarbinary(new byte[0])), bytesBetween(false, new byte[0], new byte[] { 1 }));
    tester.testRoundTrip(VARBINARY, ImmutableList.copyOf(limit(cycle(ImmutableList.of(1, 3, 5, 7, 11, 13, 17)), NUM_ROWS)).stream().map(String::valueOf).map(string -> string.getBytes(UTF_8)).map(SqlVarbinary::new).collect(toImmutableList()), bytesBetween(false, new byte[] { 1 }, new byte[] { 12 }));
}
Also used : CharType.createCharType(com.facebook.presto.common.type.CharType.createCharType) Page(com.facebook.presto.common.Page) DateTimeZone(org.joda.time.DateTimeZone) Arrays(java.util.Arrays) OrcTester.createCustomOrcSelectiveRecordReader(com.facebook.presto.orc.OrcTester.createCustomOrcSelectiveRecordReader) BigintRange(com.facebook.presto.common.predicate.TupleDomainFilter.BigintRange) Test(org.testng.annotations.Test) Random(java.util.Random) OrcTester.quickSelectiveOrcTester(com.facebook.presto.orc.OrcTester.quickSelectiveOrcTester) SESSION(com.facebook.presto.testing.TestingConnectorSession.SESSION) Iterables.concat(com.google.common.collect.Iterables.concat) Iterables.cycle(com.google.common.collect.Iterables.cycle) Slices(io.airlift.slice.Slices) Map(java.util.Map) HIVE_STORAGE_TIME_ZONE(com.facebook.presto.orc.OrcTester.HIVE_STORAGE_TIME_ZONE) FloatRange(com.facebook.presto.common.predicate.TupleDomainFilter.FloatRange) BigInteger(java.math.BigInteger) SqlDecimal(com.facebook.presto.common.type.SqlDecimal) BigintValuesUsingHashTable(com.facebook.presto.common.predicate.TupleDomainFilter.BigintValuesUsingHashTable) ImmutableMap(com.google.common.collect.ImmutableMap) DOUBLE(com.facebook.presto.common.type.DoubleType.DOUBLE) OrcTester.mapType(com.facebook.presto.orc.OrcTester.mapType) NONE(com.facebook.presto.orc.metadata.CompressionKind.NONE) Collections.nCopies(java.util.Collections.nCopies) BeforeClass(org.testng.annotations.BeforeClass) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Range(com.google.common.collect.Range) BooleanValue(com.facebook.presto.common.predicate.TupleDomainFilter.BooleanValue) Iterables.limit(com.google.common.collect.Iterables.limit) Assert.assertNotNull(org.testng.Assert.assertNotNull) Streams(com.google.common.collect.Streams) Assertions.assertBetweenInclusive(com.facebook.airlift.testing.Assertions.assertBetweenInclusive) List(java.util.List) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) SqlTimestamp(com.facebook.presto.common.type.SqlTimestamp) IS_NOT_NULL(com.facebook.presto.common.predicate.TupleDomainFilter.IS_NOT_NULL) INTEGER(com.facebook.presto.common.type.IntegerType.INTEGER) CompressionKind(com.facebook.presto.orc.metadata.CompressionKind) Optional(java.util.Optional) IS_NULL(com.facebook.presto.common.predicate.TupleDomainFilter.IS_NULL) IntStream(java.util.stream.IntStream) MAX_BLOCK_SIZE(com.facebook.presto.orc.OrcTester.MAX_BLOCK_SIZE) DecimalType(com.facebook.presto.common.type.DecimalType) ContiguousSet(com.google.common.collect.ContiguousSet) Slice(io.airlift.slice.Slice) Assert.assertNull(org.testng.Assert.assertNull) TINYINT(com.facebook.presto.common.type.TinyintType.TINYINT) VARCHAR(com.facebook.presto.common.type.VarcharType.VARCHAR) DateTimeTestingUtils.sqlTimestampOf(com.facebook.presto.testing.DateTimeTestingUtils.sqlTimestampOf) Assert.assertEquals(org.testng.Assert.assertEquals) TIMESTAMP(com.facebook.presto.common.type.TimestampType.TIMESTAMP) Function(java.util.function.Function) DATE(com.facebook.presto.common.type.DateType.DATE) REAL(com.facebook.presto.common.type.RealType.REAL) BytesRange(com.facebook.presto.common.predicate.TupleDomainFilter.BytesRange) ArrayList(java.util.ArrayList) Strings(com.google.common.base.Strings) ZLIB(com.facebook.presto.orc.metadata.CompressionKind.ZLIB) SqlDate(com.facebook.presto.common.type.SqlDate) Subfield(com.facebook.presto.common.Subfield) ImmutableList(com.google.common.collect.ImmutableList) SqlVarbinary(com.facebook.presto.common.type.SqlVarbinary) DiscreteDomain(com.google.common.collect.DiscreteDomain) OrcTester.writeOrcColumnsPresto(com.facebook.presto.orc.OrcTester.writeOrcColumnsPresto) BOOLEAN(com.facebook.presto.common.type.BooleanType.BOOLEAN) CharType(com.facebook.presto.common.type.CharType) Type(com.facebook.presto.common.type.Type) MAX_BATCH_SIZE(com.facebook.presto.orc.OrcReader.MAX_BATCH_SIZE) BIGINT(com.facebook.presto.common.type.BigintType.BIGINT) OrcTester.arrayType(com.facebook.presto.orc.OrcTester.arrayType) InvalidFunctionArgumentException(com.facebook.presto.common.InvalidFunctionArgumentException) Iterator(java.util.Iterator) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.fail(org.testng.Assert.fail) AbstractIterator(com.google.common.collect.AbstractIterator) TupleDomainFilterUtils.toBigintValues(com.facebook.presto.common.predicate.TupleDomainFilterUtils.toBigintValues) VARBINARY(com.facebook.presto.common.type.VarbinaryType.VARBINARY) Maps(com.google.common.collect.Maps) Ints(com.google.common.primitives.Ints) TupleDomainFilter(com.facebook.presto.common.predicate.TupleDomainFilter) DWRF(com.facebook.presto.orc.OrcTester.Format.DWRF) OrcReaderSettings(com.facebook.presto.orc.OrcTester.OrcReaderSettings) Collectors.toList(java.util.stream.Collectors.toList) SMALLINT(com.facebook.presto.common.type.SmallintType.SMALLINT) OrcTester.rowType(com.facebook.presto.orc.OrcTester.rowType) TestingOrcPredicate.createOrcPredicate(com.facebook.presto.orc.TestingOrcPredicate.createOrcPredicate) Assert.assertTrue(org.testng.Assert.assertTrue) Block(com.facebook.presto.common.block.Block) BytesValues(com.facebook.presto.common.predicate.TupleDomainFilter.BytesValues) DoubleRange(com.facebook.presto.common.predicate.TupleDomainFilter.DoubleRange) Collections(java.util.Collections) ZSTD(com.facebook.presto.orc.metadata.CompressionKind.ZSTD) SqlVarbinary(com.facebook.presto.common.type.SqlVarbinary) Test(org.testng.annotations.Test)

Example 3 with SqlVarbinary

use of com.facebook.presto.common.type.SqlVarbinary in project presto by prestodb.

the class ParquetTester method writeValue.

private static void writeValue(Type type, BlockBuilder blockBuilder, Object value) {
    if (value == null) {
        blockBuilder.appendNull();
    } else {
        if (BOOLEAN.equals(type)) {
            type.writeBoolean(blockBuilder, (Boolean) value);
        } else if (TINYINT.equals(type) || SMALLINT.equals(type) || INTEGER.equals(type) || BIGINT.equals(type)) {
            type.writeLong(blockBuilder, ((Number) value).longValue());
        } else if (Decimals.isShortDecimal(type)) {
            type.writeLong(blockBuilder, ((SqlDecimal) value).getUnscaledValue().longValue());
        } else if (Decimals.isLongDecimal(type)) {
            if (Decimals.overflows(((SqlDecimal) value).getUnscaledValue(), MAX_PRECISION_INT64)) {
                type.writeSlice(blockBuilder, Decimals.encodeUnscaledValue(((SqlDecimal) value).toBigDecimal().unscaledValue()));
            } else {
                type.writeSlice(blockBuilder, Decimals.encodeUnscaledValue(((SqlDecimal) value).getUnscaledValue().longValue()));
            }
        } else if (DOUBLE.equals(type)) {
            type.writeDouble(blockBuilder, ((Number) value).doubleValue());
        } else if (REAL.equals(type)) {
            float floatValue = ((Number) value).floatValue();
            type.writeLong(blockBuilder, Float.floatToIntBits(floatValue));
        } else if (type instanceof VarcharType) {
            Slice slice = truncateToLength(utf8Slice((String) value), type);
            type.writeSlice(blockBuilder, slice);
        } else if (type instanceof CharType) {
            Slice slice = truncateToLengthAndTrimSpaces(utf8Slice((String) value), type);
            type.writeSlice(blockBuilder, slice);
        } else if (VARBINARY.equals(type)) {
            type.writeSlice(blockBuilder, Slices.wrappedBuffer(((SqlVarbinary) value).getBytes()));
        } else if (DATE.equals(type)) {
            long days = ((SqlDate) value).getDays();
            type.writeLong(blockBuilder, days);
        } else if (TIMESTAMP.equals(type)) {
            long millis = ((SqlTimestamp) value).getMillisUtc();
            type.writeLong(blockBuilder, millis);
        } else {
            if (type instanceof ArrayType) {
                List<?> array = (List<?>) value;
                Type elementType = type.getTypeParameters().get(0);
                BlockBuilder arrayBlockBuilder = blockBuilder.beginBlockEntry();
                for (Object elementValue : array) {
                    writeValue(elementType, arrayBlockBuilder, elementValue);
                }
                blockBuilder.closeEntry();
            } else if (type instanceof MapType) {
                Map<?, ?> map = (Map<?, ?>) value;
                Type keyType = type.getTypeParameters().get(0);
                Type valueType = type.getTypeParameters().get(1);
                BlockBuilder mapBlockBuilder = blockBuilder.beginBlockEntry();
                for (Map.Entry<?, ?> entry : map.entrySet()) {
                    writeValue(keyType, mapBlockBuilder, entry.getKey());
                    writeValue(valueType, mapBlockBuilder, entry.getValue());
                }
                blockBuilder.closeEntry();
            } else if (type instanceof RowType) {
                List<?> array = (List<?>) value;
                List<Type> fieldTypes = type.getTypeParameters();
                BlockBuilder rowBlockBuilder = blockBuilder.beginBlockEntry();
                for (int fieldId = 0; fieldId < fieldTypes.size(); fieldId++) {
                    Type fieldType = fieldTypes.get(fieldId);
                    writeValue(fieldType, rowBlockBuilder, array.get(fieldId));
                }
                blockBuilder.closeEntry();
            } else {
                throw new IllegalArgumentException("Unsupported type " + type);
            }
        }
    }
}
Also used : Varchars.isVarcharType(com.facebook.presto.common.type.Varchars.isVarcharType) VarcharType(com.facebook.presto.common.type.VarcharType) SqlVarbinary(com.facebook.presto.common.type.SqlVarbinary) RowType(com.facebook.presto.common.type.RowType) MetastoreUtil.isRowType(com.facebook.presto.hive.metastore.MetastoreUtil.isRowType) SqlDecimal(com.facebook.presto.common.type.SqlDecimal) SqlTimestamp(com.facebook.presto.common.type.SqlTimestamp) MapType(com.facebook.presto.common.type.MapType) MetastoreUtil.isMapType(com.facebook.presto.hive.metastore.MetastoreUtil.isMapType) ArrayType(com.facebook.presto.common.type.ArrayType) MetastoreUtil.isArrayType(com.facebook.presto.hive.metastore.MetastoreUtil.isArrayType) Varchars.isVarcharType(com.facebook.presto.common.type.Varchars.isVarcharType) DecimalType(com.facebook.presto.common.type.DecimalType) HiveUtil.isStructuralType(com.facebook.presto.hive.HiveUtil.isStructuralType) ArrayType(com.facebook.presto.common.type.ArrayType) CharType(com.facebook.presto.common.type.CharType) MetastoreUtil.isArrayType(com.facebook.presto.hive.metastore.MetastoreUtil.isArrayType) RowType(com.facebook.presto.common.type.RowType) MetastoreUtil.isRowType(com.facebook.presto.hive.metastore.MetastoreUtil.isRowType) VarcharType(com.facebook.presto.common.type.VarcharType) MessageType(org.apache.parquet.schema.MessageType) MapType(com.facebook.presto.common.type.MapType) Type(com.facebook.presto.common.type.Type) MetastoreUtil.isMapType(com.facebook.presto.hive.metastore.MetastoreUtil.isMapType) Slices.utf8Slice(io.airlift.slice.Slices.utf8Slice) Slice(io.airlift.slice.Slice) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) CharType(com.facebook.presto.common.type.CharType) Map(java.util.Map) HashMap(java.util.HashMap) BlockBuilder(com.facebook.presto.common.block.BlockBuilder)

Example 4 with SqlVarbinary

use of com.facebook.presto.common.type.SqlVarbinary in project presto by prestodb.

the class ChecksumResult method fromResultSet.

public static Optional<ChecksumResult> fromResultSet(ResultSet resultSet) throws SQLException {
    long rowCount = resultSet.getLong(1);
    ResultSetMetaData metaData = resultSet.getMetaData();
    Map<String, Object> checksums = new HashMap<>(metaData.getColumnCount());
    for (int i = 2; i <= metaData.getColumnCount(); i++) {
        String columnName = metaData.getColumnName(i);
        Object checksum = resultSet.getObject(i);
        if (checksum == null) {
            checksums.put(columnName, null);
            continue;
        }
        if (metaData.getColumnType(i) == Types.DOUBLE) {
            checkState(checksum instanceof Double, "Expecting double for column %s, found %s", columnName, checksum.getClass());
            checksums.put(columnName, checksum);
        } else if (metaData.getColumnType(i) == Types.BIGINT) {
            checkState(checksum instanceof Long, "Expecting bigint for column %s, found %s", columnName, checksum.getClass());
            checksums.put(columnName, checksum);
        } else {
            checkState(checksum instanceof byte[], "Expecting binary for column %s, found %s", columnName, checksum.getClass());
            checksums.put(columnName, new SqlVarbinary((byte[]) checksum));
        }
    }
    return Optional.of(new ChecksumResult(rowCount, checksums));
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) HashMap(java.util.HashMap) SqlVarbinary(com.facebook.presto.common.type.SqlVarbinary)

Example 5 with SqlVarbinary

use of com.facebook.presto.common.type.SqlVarbinary in project presto by prestodb.

the class TestChecksumValidator method testArray.

@Test
public void testArray() {
    List<Column> columns = ImmutableList.of(INT_ARRAY_COLUMN, MAP_ARRAY_COLUMN);
    ChecksumResult controlChecksum = new ChecksumResult(5, ImmutableMap.<String, Object>builder().put("int_array$checksum", new SqlVarbinary(new byte[] { 0xa })).put("int_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0xb })).put("int_array$cardinality_sum", 1L).put("map_array$checksum", new SqlVarbinary(new byte[] { 0xc })).put("map_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0xd })).put("map_array$cardinality_sum", 2L).build());
    // Matched
    assertTrue(checksumValidator.getMismatchedColumns(columns, controlChecksum, controlChecksum).isEmpty());
    // Mismatched different elements
    ChecksumResult testChecksum = new ChecksumResult(5, ImmutableMap.<String, Object>builder().put("int_array$checksum", new SqlVarbinary(new byte[] { 0x1a })).put("int_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0xb })).put("int_array$cardinality_sum", 1L).put("map_array$checksum", new SqlVarbinary(new byte[] { 0x1c })).put("map_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0xd })).put("map_array$cardinality_sum", 2L).build());
    assertMismatchedColumns(columns, controlChecksum, testChecksum, INT_ARRAY_COLUMN, MAP_ARRAY_COLUMN);
    // Mismatched different cardinality checksum
    testChecksum = new ChecksumResult(5, ImmutableMap.<String, Object>builder().put("int_array$checksum", new SqlVarbinary(new byte[] { 0xa })).put("int_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0x1b })).put("int_array$cardinality_sum", 1L).put("map_array$checksum", new SqlVarbinary(new byte[] { 0xc })).put("map_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0x1d })).put("map_array$cardinality_sum", 2L).build());
    assertMismatchedColumns(columns, controlChecksum, testChecksum, INT_ARRAY_COLUMN, MAP_ARRAY_COLUMN);
    // Mismatched different cardinality sum
    testChecksum = new ChecksumResult(5, ImmutableMap.<String, Object>builder().put("int_array$checksum", new SqlVarbinary(new byte[] { 0xa })).put("int_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0xb })).put("int_array$cardinality_sum", 3L).put("map_array$checksum", new SqlVarbinary(new byte[] { 0xc })).put("map_array$cardinality_checksum", new SqlVarbinary(new byte[] { 0xd })).put("map_array$cardinality_sum", 4L).build());
    assertMismatchedColumns(columns, controlChecksum, testChecksum, INT_ARRAY_COLUMN, MAP_ARRAY_COLUMN);
}
Also used : Column(com.facebook.presto.verifier.framework.Column) SqlVarbinary(com.facebook.presto.common.type.SqlVarbinary) Test(org.testng.annotations.Test)

Aggregations

SqlVarbinary (com.facebook.presto.common.type.SqlVarbinary)40 Test (org.testng.annotations.Test)19 DecimalType (com.facebook.presto.common.type.DecimalType)10 SqlDecimal (com.facebook.presto.common.type.SqlDecimal)10 ArrayList (java.util.ArrayList)10 SqlTimestamp (com.facebook.presto.common.type.SqlTimestamp)9 ImmutableList (com.google.common.collect.ImmutableList)8 List (java.util.List)8 SqlDate (com.facebook.presto.common.type.SqlDate)7 Type (com.facebook.presto.common.type.Type)7 Slice (io.airlift.slice.Slice)7 Collectors.toList (java.util.stream.Collectors.toList)7 ArrayType (com.facebook.presto.common.type.ArrayType)6 CharType (com.facebook.presto.common.type.CharType)6 TDigest (com.facebook.presto.tdigest.TDigest)6 TDigest.createTDigest (com.facebook.presto.tdigest.TDigest.createTDigest)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 BlockBuilder (com.facebook.presto.common.block.BlockBuilder)5 VarcharType (com.facebook.presto.common.type.VarcharType)5