This is an automated email from the ASF dual-hosted git repository. maxyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit fa2bde2521e70d14f0d8b8d27f43e3cf2d1601cd Author: Ekta Khanna <[email protected]> AuthorDate: Thu Apr 13 16:14:20 2023 -0700 Update test description --- .../gporca/data/dxl/minidump/ArrayCoerceImplicitCast.mdp | 16 ++++++++++++++++ src/test/regress/expected/gporca.out | 2 ++ src/test/regress/expected/gporca_optimizer.out | 2 ++ src/test/regress/sql/gporca.sql | 2 ++ 4 files changed, 22 insertions(+) diff --git a/src/backend/gporca/data/dxl/minidump/ArrayCoerceImplicitCast.mdp b/src/backend/gporca/data/dxl/minidump/ArrayCoerceImplicitCast.mdp index c6583ac8bb..878ca170c4 100644 --- a/src/backend/gporca/data/dxl/minidump/ArrayCoerceImplicitCast.mdp +++ b/src/backend/gporca/data/dxl/minidump/ArrayCoerceImplicitCast.mdp @@ -1,5 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <dxl:DXLMessage xmlns:dxl="http://greenplum.com/dxl/2010/12/"> + <dxl:Comment><![CDATA[ + Objective: Ensure ORCA doesn't fake an explicit cast inplace of an + implicit one. + In the below example the column b in foo has a different length than b. + While inserting data from bar into foo, ORCA should translate the cast + function as part of ArrayCoerceExpr. + This will error out while execution as the length of col b mismatches between + foo and bar. + + create table foo (a int, b varchar(2)[]); + create table bar (a int, b varchar(10)[]); + + insert into bar values (1, ARRAY['abcde']); + explain insert into foo select * from bar; + ]]> + </dxl:Comment> <dxl:Thread Id="0"> <dxl:OptimizerConfig> <dxl:EnumeratorConfig Id="0" PlanSamples="0" CostThreshold="0"/> diff --git a/src/test/regress/expected/gporca.out b/src/test/regress/expected/gporca.out index 556536bb23..a0e59bfe48 100644 --- a/src/test/regress/expected/gporca.out +++ b/src/test/regress/expected/gporca.out @@ -14591,6 +14591,8 @@ select * from conf; reset optimizer_trace_fallback; -- Test ORCA support for implicit array coerce cast +-- ORCA should generate a valid plan passing along the cast function as part of ArrayCoerceExpr +-- While execution thin insert query fails due to the mismatch of column length. create table array_coerce_foo (a int, b varchar(2)[]); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. diff --git a/src/test/regress/expected/gporca_optimizer.out b/src/test/regress/expected/gporca_optimizer.out index 85863735f5..e68157ffb0 100644 --- a/src/test/regress/expected/gporca_optimizer.out +++ b/src/test/regress/expected/gporca_optimizer.out @@ -14707,6 +14707,8 @@ select * from conf; reset optimizer_trace_fallback; -- Test ORCA support for implicit array coerce cast +-- ORCA should generate a valid plan passing along the cast function as part of ArrayCoerceExpr +-- While execution thin insert query fails due to the mismatch of column length. create table array_coerce_foo (a int, b varchar(2)[]); NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. diff --git a/src/test/regress/sql/gporca.sql b/src/test/regress/sql/gporca.sql index ef071ff6d9..a314ab51d6 100644 --- a/src/test/regress/sql/gporca.sql +++ b/src/test/regress/sql/gporca.sql @@ -3576,6 +3576,8 @@ analyze ts_tbl; explain select * from ts_tbl where ts = to_timestamp('99991231'::text, 'YYYYMMDD'::text); -- Test ORCA support for implicit array coerce cast +-- ORCA should generate a valid plan passing along the cast function as part of ArrayCoerceExpr +-- While execution thin insert query fails due to the mismatch of column length. create table array_coerce_foo (a int, b varchar(2)[]); create table array_coerce_bar (a int, b varchar(10)[]); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
