forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Summary: X-link: facebookincubator#11169 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 falls 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 Reviewed By: kevinwilfong Differential Revision: D63993116 fbshipit-source-id: 24348eb7325d4460c8f481904950d40e0e405f08
- Loading branch information
1 parent
3fabdf5
commit 3ce3fb1
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