Skip to content

HIVE-29819: Fix Iceberg COW UPDATE for null identity partition column filters - #6763

Open
kokila-19 wants to merge 1 commit into
apache:masterfrom
kokila-19:fix_update
Open

HIVE-29819: Fix Iceberg COW UPDATE for null identity partition column filters#6763
kokila-19 wants to merge 1 commit into
apache:masterfrom
kokila-19:fix_update

Conversation

@kokila-19

@kokila-19 kokila-19 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Column pruning now keeps Iceberg identity partition columns in the TableScan when a filter uses them.
Before, UPDATE ... WHERE str_col IS NULL could leave str_col in the Filter but remove it from the TableScan.
Now, if a filter references a partition column, that column stays in the scan.

Why are the changes needed?

Iceberg COW UPDATE builds a plan with a Filter above the TableScan. Column pruning was dropping partition columns the Filter still needed causing errors like cannot find field str_col.
The fix keeps the Filter and TableScan aligned on which columns are read.

Does this PR introduce any user-facing change?

User will get error while executing update query with is null predicate in partition column.
It executes successfully after this fix.

How was this patch tested?

qtest: update_iceberg_cow_null_identity_partition.q

@kokila-19

Copy link
Copy Markdown
Contributor Author

Before fix:

TableScan [TS_48] (rows=1 width=97)
                      default@iceberg_cow_partitioned,iceberg_cow_partitioned,Tbl:COMPLETE,Col:PARTIAL,Output:["index","string_col","boolean_col","tinyint_col"]

After fix:

TableScan [TS_48] (rows=1 width=281)
                      default@iceberg_cow_partitioned,iceberg_cow_partitioned,Tbl:COMPLETE,Col:PARTIAL,Output:["index","string_col","boolean_col","tinyint_col","str_col"] 

Tablescan now has str_col partition column in them , so it won't throw error.

@kokila-19
kokila-19 marked this pull request as ready for review September 10, 2026 04:57
@kokila-19

Copy link
Copy Markdown
Contributor Author

@kasakrisz @chinnaraolalam
Could you please review this PR ?

Comment on lines +529 to +530
for (Operator<? extends OperatorDesc> child : scanOp.getChildOperators()) {
if (child instanceof FilterOperator filterOperator) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please verify whether FilterOperator is guaranteed to be a direct child of TS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for telling me this!
Not necessarily, Hive’s PPD code already handles cases where a Select sits between them, so plans like TableScan → Select → Filter are normal. I’ve replaced the direct-child check with a passthrough pipeline walk plus filterExpr handling.

@@ -0,0 +1,33 @@
-- SORT_QUERY_RESULTS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please set

set hive.explain.user=false;

That type of plan has more details.

… filters

Column pruning dropped partition columns from the TableScan while filters above
the scan still referenced them. Keep filter-referenced partition columns in the
Iceberg scan projection.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants