Mihaly Szjatinya has uploaded this change for review. ( https://gerrit.cloudera.org/25414
Change subject: IMPALA-15787: Compute Puffin theta sketches in the column stats query ...................................................................... IMPALA-15787: Compute Puffin theta sketches in the column stats query With IMPALA-15004, COMPUTE STATS on an Iceberg table with ICEBERG_WRITE_PUFFIN_STATS=true (the default) ran a third child query that computed a theta sketch per column for the Puffin file, so the table was scanned twice. The column stats query computed no NDV() in this mode, only a placeholder for it. This patch computes the sketch with ds_theta_sketch_iceberg() in place of the NDV in the column stats query, so the table is scanned once again. The new TComputeStatsParams.theta_sketch_ndv flag tells the backend that the NDV slots hold sketches, the same way is_incremental does for the HLL intermediates of COMPUTE INCREMENTAL STATS. The backend passes the sketches to catalogd in theta_sketch_blobs, which, as before, writes them to Puffin and sets the NDV in HMS to the sketch's estimate. A NULL sketch means that the column has no non-NULL values, so its NDV is 0. BINARY columns still get no NDV. The column stats query now runs with TIMEZONE=UTC in this mode, which the timestamp hashing needs. No other column stat depends on the time zone. TComputeStatsParams.theta_sketch_query (added by IMPALA-15004, not released) is removed. Testing: - AnalyzeDDLTest#TestComputeStatsIcebergPuffin: the column stats query computes DS_THETA_SKETCH_ICEBERG() instead of NDV() and analyzes, also for the other Iceberg types; no flag with the option false, for non-Iceberg tables and with TABLESAMPLE. - test_iceberg.py::TestIcebergTableWithPuffinStats:: test_compute_stats_write_puffin_stats_option: COMPUTE STATS runs exactly two child queries in every mode. Regression: - test_iceberg.py::TestIcebergTableWithPuffinStats: Puffin write and read cycle, timestamps in UTC, carry-over. - test_iceberg.py::TestIcebergTable::test_compute_stats: COMPUTE and DROP STATS on Iceberg tables. - test_iceberg_trino_puffin_sketches.py: sketch bytes identical to Trino's. - tests/metadata/test_compute_stats.py: COMPUTE STATS on other table types, which share SetColumnStats(). Change-Id: I15cae4e150f726dcfd53f440b6321b0cd6b837f5 Assisted-by: Claude Opus 4.8 (GitHub Copilot) --- M be/src/exec/catalog-op-executor.cc M be/src/exec/catalog-op-executor.h M be/src/service/client-request-state.cc M common/thrift/JniCatalog.thrift M fe/src/main/java/org/apache/impala/analysis/ComputeStatsStmt.java M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java M fe/src/test/java/org/apache/impala/analysis/AnalyzeDDLTest.java M tests/query_test/test_iceberg.py 8 files changed, 78 insertions(+), 144 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/14/25414/1 -- To view, visit https://gerrit.cloudera.org/25414 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I15cae4e150f726dcfd53f440b6321b0cd6b837f5 Gerrit-Change-Number: 25414 Gerrit-PatchSet: 1 Gerrit-Owner: Mihaly Szjatinya <[email protected]>
