Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.util.stream.Collectors;

import static com.facebook.presto.common.Utils.nativeValueToBlock;
import static com.facebook.presto.common.type.VarbinaryType.VARBINARY;
import static com.facebook.presto.expressions.LogicalRowExpressions.FALSE_CONSTANT;
import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT;
import static com.facebook.presto.iceberg.IcebergAbstractMetadata.toSubfield;
Expand Down Expand Up @@ -276,6 +277,13 @@ public static boolean canEnforceColumnConstraintInSpecs(
Domain domain,
ConnectorSession session)
{
// Disables metadata deletion and filter thoroughly pushdown for varbinary columns
// because of the known issue about binary partition column in Iceberg.
// See: https://github.com/apache/iceberg/issues/15128
// todo: This restrict could be removed once the Iceberg issue is resolved.
if (columnHandle.getType() == VARBINARY) {
return false;
}
return table.specs().values().stream()
.filter(partitionSpec -> partitionSpecIds.contains(partitionSpec.specId()))
.allMatch(spec -> canEnforceConstraintWithinPartitioningSpec(spec, columnHandle, domain, session));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,21 @@ public void testPartitionedByTimeType()
assertQuerySucceeds("drop table test_partition_columns_time");
}

@Test
public void testPartitionedByVarbinaryType()
@DataProvider(name = "insertValues")
public Object[][] getInsertValues()
{
return new Object[][] {
{"(1, X'bcd1'), (2, X'e3bcd1')"},
{"(2, X'e3bcd1'), (1, X'bcd1')"}};
}

@Test(dataProvider = "insertValues")
public void testPartitionedByVarbinaryType(String insertValues)
{
// create iceberg table partitioned by column of VarbinaryType, and insert some data
assertQuerySucceeds("drop table if exists test_partition_columns_varbinary");
assertQuerySucceeds("create table test_partition_columns_varbinary(a bigint, b varbinary) with (partitioning = ARRAY['b'])");
assertQuerySucceeds("insert into test_partition_columns_varbinary values(1, X'bcd1'), (2, X'e3bcd1')");
assertQuerySucceeds("insert into test_partition_columns_varbinary values " + insertValues);

// validate return data of VarbinaryType
List<Object> varbinaryColumnDatas = getQueryRunner().execute("select b from test_partition_columns_varbinary order by a asc").getOnlyColumn().collect(Collectors.toList());
Expand All @@ -861,7 +869,7 @@ public void testPartitionedByVarbinaryType()
assertEquals(varbinaryColumnDatas.get(0), new byte[] {(byte) 0xe3, (byte) 0xbc, (byte) 0xd1});
assertEquals(getQueryRunner().execute("select b FROM test_partition_columns_varbinary where b = X'e3bcd1'").getOnlyValue(),
new byte[] {(byte) 0xe3, (byte) 0xbc, (byte) 0xd1});
assertEquals(getQueryRunner().execute("select count(*) from \"test_partition_columns_varbinary$partitions\"").getOnlyValue(), 1L);
assertEquals(getQueryRunner().execute("select count(*) from \"test_partition_columns_varbinary$partitions\"").getOnlyValue(), 2L);
assertEquals(getQueryRunner().execute("select row_count from \"test_partition_columns_varbinary$partitions\" where b = X'e3bcd1'").getOnlyValue(), 1L);

assertQuerySucceeds("drop table test_partition_columns_varbinary");
Expand Down
Loading