Hello Peter Rozsa, Nandor Kollar, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    https://gerrit.cloudera.org/24733

to look at the new patch set (#11).

Change subject: IMPALA-14996: Optimize count(*) for Iceberg V3 DV-only tables
......................................................................

IMPALA-14996: Optimize count(*) for Iceberg V3 DV-only tables

Enable compile-time count(*) optimization for Iceberg V3 tables
whose only delete files are Deletion Vectors (DVs). As for V1
tables, plain count(*) is rewritten to a constant:

  live rows = total data records - rows deleted by DVs

The deleted row count only includes DVs that reference live data
files.

Key changes:
- A plain count(*) becomes a constant if the snapshot has no delete
  files or only DVs, otherwise the existing V2 rewrite is used. The
  native and Calcite planners share this decision. V1 tables now sum
  the data file record counts instead of the snapshot summary.
- IcebergContentFileStore keeps running totals of the data file rows
  and the rows deleted by DVs, so the count for the current snapshot
  is O(1). For time travel the same numbers come from the snapshot's
  manifests, which are loaded once.
- The constant rewrite has no scan to report missing files, so it is
  skipped if a file of the snapshot is missing and the scan reports
  the error. DVs are only checked for time travel.
- Calcite: transformForV1CountStarOptimization() is renamed to
  transformForConstantCountStarOptimization(), and the V2 count(*)
  optimization is not enabled for DV-only tables.

Testing:
- iceberg-v3-plain-count-star-optimization.test: the constant rewrite
  on both planners, including partitioned tables, mixed aggregates
  and time travel, and a V2 -> V3 upgrade with V2 position deletes.
- iceberg-missing-data-files.test: count(*) fails for a missing data
  file, for the current snapshot and for time travel.
- test_v3_plain_count_star_optimization: time travel to older
  snapshots reads no data.

Change-Id: I0e6239629ee779a64808a0a4bbe041ef756c5bb2
Assisted-by: Composer 2.5 (Cursor)
---
M common/thrift/CatalogObjects.thrift
M fe/src/main/java/org/apache/impala/analysis/SelectStmt.java
M fe/src/main/java/org/apache/impala/catalog/FeIcebergTable.java
M fe/src/main/java/org/apache/impala/catalog/IcebergContentFileStore.java
M fe/src/main/java/org/apache/impala/catalog/iceberg/GroupedContentFiles.java
M fe/src/main/java/org/apache/impala/rewrite/CountStarToConstRule.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/rules/IcebergCountStarOptimizer.java
M 
java/calcite-planner/src/main/java/org/apache/impala/calcite/schema/CalciteIcebergTable.java
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-missing-data-files.test
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-v3-delete-v2-equality-upgrade.test
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-v3-plain-count-star-optimization.test
M tests/query_test/test_iceberg.py
12 files changed, 661 insertions(+), 125 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/33/24733/11
--
To view, visit https://gerrit.cloudera.org/24733
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0e6239629ee779a64808a0a4bbe041ef756c5bb2
Gerrit-Change-Number: 24733
Gerrit-PatchSet: 11
Gerrit-Owner: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Arnab Karmakar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>

Reply via email to