Skip to content

Fix channel mapping in createColumnValueAndRowIdChannels #25599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

imjalpreet
Copy link
Member

@imjalpreet imjalpreet commented Jul 23, 2025

Description

Previously, createColumnValueAndRowIdChannels() iterated over all variableReferenceExpressions and attempted to locate them in columnValueAndRowIdSymbols, relying on the output order and performing an incorrect size check.

This commit fixes the logic by iterating directly over columnValueAndRowIdSymbols and verifying each one’s position in variableReferenceExpressions. This removes the incorrect ordering assumption and ensures accurate channel mapping when multiple identical values or updates are involved.

Motivation and Context

Fixes #25345

presto:imjalpreet_iceberg> create table test_update (id int, column1 varchar(10), column2 varchar(10), column3 int);
CREATE TABLE

presto:imjalpreet_iceberg> insert into test_update values(1, 'a', 'a', 1);
INSERT: 1 row

Query 20250721_103400_00005_yzsks, FINISHED, 1 node
Splits: 19 total, 19 done (100.00%)
[Latency: client-side: 0:19, server-side: 0:18] [0 rows, 0B] [0 rows/s, 0B/s]

presto:imjalpreet_iceberg> select * from test_update;
 id | c1 | c2 | c3 
----+----+----+----
  1 | a  | a  | 1
(1 row)

presto:imjalpreet_iceberg> update test_update SET column1 = cast(1 as varchar), column2 = cast(1 as varchar), column3 = 11 where id=1;

Query 20250722_235500_00001_xh3ec, FAILED, 1 node
Splits: 1 total, 0 done (0.00%)
[Latency: client-side: 0:11, server-side: 0:10] [0 rows, 0B] [0 rows/s, 0B/s]

Query 20250722_235500_00001_xh3ec failed: symbolCounter 3 should be columnValueAndRowIdChannels.size() %s

Impact

presto:imjalpreet_iceberg> update test_update SET column1 = cast(1 as varchar), column2 = cast(1 as varchar), column3 = 11 where id=1;
UPDATE: 1 row

Query 20250722_235536_00002_xh3ec, FINISHED, 1 node
Splits: 5 total, 5 done (100.00%)
[Latency: client-side: 0:19, server-side: 0:19] [4 rows, 1.97KB] [0 rows/s, 105B/s]

presto:imjalpreet_iceberg> select * from test_update;
 id | c1 | c2 | c3 
----+----+----+----
  1 | 1  | 1  | 11 
(1 row)

Query 20250722_235600_00003_xh3ec, FINISHED, 1 node
Splits: 21 total, 21 done (100.00%)
[Latency: client-side: 0:08, server-side: 0:08] [5 rows, 3.14KB] [0 rows/s, 396B/s]

Test Plan

Added a test case similar to the one in the issue

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Fix for UPDATE statements involving multiple identical target column values.

Previously, createColumnValueAndRowIdChannels() iterated over all
variableReferenceExpressions and attempted to locate them in
columnValueAndRowIdSymbols, relying on the output order and performing
an incorrect size check.

This commit fixes the logic by iterating directly over
columnValueAndRowIdSymbols and verifying each one’s position in
variableReferenceExpressions. This removes the incorrect ordering
assumption and ensures accurate channel mapping when multiple
identical values or updates are involved.
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jul 23, 2025
@imjalpreet imjalpreet self-assigned this Jul 23, 2025
@imjalpreet imjalpreet marked this pull request as ready for review July 23, 2025 02:39
@imjalpreet imjalpreet requested review from hantangwangd, ZacBlanco and a team as code owners July 23, 2025 02:39
@prestodb-ci prestodb-ci requested review from a team, anandamideShakyan and ShahimSharafudeen and removed request for a team July 23, 2025 02:39
Copy link
Member

@hantangwangd hantangwangd left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, lgtm!

@imjalpreet imjalpreet merged commit abbd869 into prestodb:master Jul 24, 2025
119 of 120 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from:IBM PR from IBM
Projects
None yet
3 participants