[BugFix] Fix transpose command name collision with 'value' field (#5172)#5352
Conversation
…nsearch-project#5172) Signed-off-by: Songkan Tang <songkant@amazon.com>
Decision LogRoot Cause: The Approach: Introduced a unique internal column name Alternatives Rejected:
Pitfalls: None encountered. The fix is mechanical — replace string literal with constant in two places. Things to Watch: The same |
PR Reviewer Guide 🔍(Review updated until commit 371ef50)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 371ef50
Previous suggestionsSuggestions up to commit e692ea7
|
Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit 371ef50 |
Description
The
transposecommand's internal unpivot column was hardcoded asvalue, which collides with input fields namedvalue. When a field namedvalueexists in the input data, all transposed rows incorrectly show duplicated values from that field instead of each column's actual values.Root cause: In
CalciteRelNodeVisitor.visitTranspose(), the unpivot step usesImmutableList.of("value")as the value column alias, and the subsequent pivot step referencesb.field("value"). When the input has avaluefield, Calcite resolves the ambiguous reference to the wrong column.Fix: Replaced the hardcoded
"value"with a unique internal name_value_transpose_(constantPlanUtils.VALUE_COLUMN_FOR_TRANSPOSE), following the same naming convention as_row_number_transpose_.Related Issues
Resolves #5172
Check List
-s)spotlessCheckpassed