Mihaly Szjatinya has uploaded this change for review. ( http://gerrit.cloudera.org:8080/24889
Change subject: IMPALA-15106: Support missing types with theta sketches ...................................................................... IMPALA-15106: Support missing types with theta sketches ds_theta_sketch() and ds_theta_sketch_and_estimate() previously only accepted TINYINT, INT, BIGINT, FLOAT, DOUBLE, and STRING. This patch extends support to all types that COMPUTE STATS processes, in preparation for IMPALA-15004 (writing theta sketch NDV stats to Puffin files from COMPUTE STATS). Gap analysis (before this patch): Type | C++ impl | FE symbol| Notes ----------+----------+----------+------------------------------------ BOOLEAN | yes | no | needs FE wiring only TINYINT | yes | yes | already done SMALLINT | yes | no | needs FE wiring only INT | yes | yes | already done BIGINT | yes | yes | already done FLOAT | yes | yes | already done DOUBLE | yes | yes | already done STRING | yes | yes | already done DATE | yes | no | needs FE wiring only TIMESTAMP | no | no | needs C++ impl (8-byte LE micros) DECIMAL | no | no | needs C++ impl (BE two's-complement) Changes: - BOOLEAN, SMALLINT, DATE: C++ template instantiations already existed; added the corresponding entries to DS_THETA_UPDATE_SYMBOL in BuiltinsDb.java so the FE registers these overloads. - TIMESTAMP: Added DsThetaUpdate<TimestampVal> specialisation that converts the value to microseconds since epoch via TimestampValue::FloorUtcToUnixTimeMicros(), matching the Iceberg single-value serialization encoding (Appendix D). - DECIMAL: Added DsThetaUpdate<DecimalVal> specialisation that encodes the unscaled integer as big-endian two's-complement minimum bytes, matching the Iceberg single-value serialization encoding (Appendix D). Handles all three backing types (val4/val8/val16) based on precision from the FunctionContext arg type. Tests: - datasketches-theta.test: removed 8 AnalysisException CATCH blocks for the newly supported types; expanded the main positive queries to include BOOLEAN, SMALLINT, and TIMESTAMP; added separate DATE tests against functional_parquet.date_tbl and DECIMAL tests against functional_parquet.decimal_tbl. - aggregate-functions-test.cc: added DsThetaSketch.DataToSketchTimestamp unit test covering empty input, distinct values, duplicates, and NULLs. Change-Id: I549a51ba96d0b9be2052a9350efe2096c1755816 Assisted-by: Claude Opus 4.8 (GitHub Copilot) --- M be/src/exprs/aggregate-functions-ir.cc M be/src/exprs/aggregate-functions-test.cc M fe/src/main/java/org/apache/impala/catalog/BuiltinsDb.java M testdata/workloads/functional-query/queries/QueryTest/datasketches-theta.test 4 files changed, 151 insertions(+), 42 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/89/24889/1 -- To view, visit http://gerrit.cloudera.org:8080/24889 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I549a51ba96d0b9be2052a9350efe2096c1755816 Gerrit-Change-Number: 24889 Gerrit-PatchSet: 1 Gerrit-Owner: Mihaly Szjatinya <[email protected]>
