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 comparisom (facebookincubator#…
…11169) 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::equals` comparison, it will iterate its children and apply `operator==` for equal comparison. However `operator==` is not defined for ArrayType and the equal logic fall back to use ArrayType::equivalent which is weakly matched. Differential Revision: D63883106
- Loading branch information