-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fb_reshape_row for ArrayType equal comparison (#11188)
Summary: fb_reshape_row returns wrong result for array of row when "from" and "to" row types are the same size and same type but different names. For example: ``` SELECT fb_reshape_row( col, CAST(NULL AS ROW(arr ARRAY(ROW(b VARCHAR, a VARCHAR)))) ) as col FROM ( SELECT CAST(ROW(x) AS ROW(arr ARRAY(ROW(a VARCHAR, b VARCHAR)))) AS col FROM ( VALUES (ARRAY[('1', '2')]) ) t(x) ); ``` In fb_reshape_row::reshapeRow, if it finds fromType is equal to toType, it will not do transformation ``` if (fromVector->type()->asRow().equals(toType->asRow())) { return fromVector; } ``` For RowType equal comparison, it will iterate its children and apply `operator==`. In this case, the child is `ArrayType`. However `operator==` is not defined for `ArrayType` and the logic fall back to use ArrayType::equivalent which is weakly matched. Change `operator==` to use `equals` for all complex types to ensure strongly matching for equal comparison Differential Revision: D63993116
- Loading branch information
1 parent
291957f
commit 9ffb9f3
Showing
3 changed files
with
77 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters