From db43ee8d39013147ee05cd8ffeb199fee42f2078 Mon Sep 17 00:00:00 2001 From: Vikash Kumar Date: Thu, 11 May 2023 00:39:40 +0530 Subject: [PATCH] Ensure statistics predicate only for base column in delta connector tableHandle.getNonPartitionConstraint() can include the dereferenced field if dereference field is used as a predicate. Since stats for dereferenced field is not supported, so filter those fields before creating statistics predicate. --- .../deltalake/statistics/FileBasedTableStatisticsProvider.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/statistics/FileBasedTableStatisticsProvider.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/statistics/FileBasedTableStatisticsProvider.java index 254e21b229ac..937c2907c007 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/statistics/FileBasedTableStatisticsProvider.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/statistics/FileBasedTableStatisticsProvider.java @@ -103,6 +103,8 @@ public TableStatistics getTableStatistics(ConnectorSession session, DeltaLakeTab } Set predicatedColumnNames = tableHandle.getNonPartitionConstraint().getDomains().orElseThrow().keySet().stream() + // TODO Statistics for column inside complex type is not collected (https://github.com/trinodb/trino/issues/17164) + .filter(DeltaLakeColumnHandle::isBaseColumn) .map(DeltaLakeColumnHandle::getBaseColumnName) .collect(toImmutableSet()); List predicatedColumns = columnMetadata.stream()