[email protected] has uploaded this change for review. ( http://gerrit.cloudera.org:8080/25084
Change subject: IMPALA-15536: Report matched rows for Kudu UPDATE ...................................................................... IMPALA-15536: Report matched rows for Kudu UPDATE IMPALA-12588 skips rows of an UPDATE that already have the desired values by adding 'col IS DISTINCT FROM new_value' predicates to the WHERE clause. As a side effect the affected-row count changed meaning: 'Modified 0 row(s)' is now returned both when no row matches the WHERE clause and when every matching row already has the desired values, so clients can no longer tell these cases apart. For Kudu tables, the row-changed predicate is no longer added to the WHERE clause. Instead it is added as the last output expression of the KuduTableSink, which is marked with the new 'has_row_changed_expr' flag. The sink still skips the write operation for rows where the predicate is false, but it now counts every row it receives as matched. Since the Kudu sink is in the same fragment as the scan or join that produces its input, no extra rows are exchanged. Iceberg UPDATEs keep filtering in the WHERE clause. The number of matched rows is reported: - in the runtime profile as 'NumMatchedRows' (DML stats) and 'NumUnchangedRows' (KuduTableSink counter), - in TDmlResult as the new 'num_matched_rows' field, - by impala-shell, e.g. 'Modified 0 row(s), 1 row(s) matched, 0 row error(s)'. EXPLAIN shows the predicate on the sink as 'skip unchanged rows' instead of on the scan or join. Column lineage still reports the columns of the predicate as predicate dependencies, so lineage output does not change. Testing: - PlannerTest: updated kudu-update, kudu-dml-with-utc-conversion and kudu-insert-writer-limit for the predicate moving to the sink. - ExprRewriterTest: updated the expected rewrite counts and the rewritten SQL of a Kudu UPDATE. - kudu_update.test: added NumMatchedRows checks for unchanged rows, for an UPDATE that matches no rows and with SKIP_UNNEEDED_UPDATES_COL_LIMIT=0. - test_shell_commandline.py: added the matched row count to the Kudu DML reporting test, including an UPDATE of unchanged rows. - Ran test_lineage.py::test_lineage_kudu_update. Change-Id: Ia5e09369f53fa9f94aef97cfc6d991550dbfdeb1 Assisted-by: Claude Opus 5.5 (Claude Code) --- M be/src/exec/kudu/kudu-table-sink.cc M be/src/exec/kudu/kudu-table-sink.h M be/src/runtime/dml-exec-state.cc M be/src/runtime/dml-exec-state.h M common/protobuf/control_service.proto M common/thrift/DataSinks.thrift M common/thrift/ImpalaService.thrift M fe/src/main/java/org/apache/impala/analysis/KuduModifyImpl.java M fe/src/main/java/org/apache/impala/analysis/KuduUpdateImpl.java M fe/src/main/java/org/apache/impala/analysis/ModifyImpl.java M fe/src/main/java/org/apache/impala/analysis/UpdateStmt.java M fe/src/main/java/org/apache/impala/planner/KuduTableSink.java M fe/src/main/java/org/apache/impala/planner/Planner.java M fe/src/test/java/org/apache/impala/analysis/ExprRewriterTest.java M shell/impala_shell/impala_client.py M shell/impala_shell/impala_shell.py M testdata/workloads/functional-planner/queries/PlannerTest/kudu-dml-with-utc-conversion.test M testdata/workloads/functional-planner/queries/PlannerTest/kudu-insert-writer-limit.test M testdata/workloads/functional-planner/queries/PlannerTest/kudu-update.test M testdata/workloads/functional-query/queries/QueryTest/kudu_update.test M tests/shell/test_shell_commandline.py 21 files changed, 284 insertions(+), 84 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/84/25084/1 -- To view, visit http://gerrit.cloudera.org:8080/25084 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ia5e09369f53fa9f94aef97cfc6d991550dbfdeb1 Gerrit-Change-Number: 25084 Gerrit-PatchSet: 1 Gerrit-Owner: Anonymous Coward <[email protected]>
