This is an automated email from the ASF dual-hosted git repository. morrysnow pushed a commit to branch branch-3.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push: new 1019f5cad9f branch-3.1: [bugfix](query) Fix for incorrect query results of variant type #51651 (#51920) 1019f5cad9f is described below commit 1019f5cad9ff3eb94c1b5d50d041c9117c427a6e Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Thu Jun 19 19:30:46 2025 +0800 branch-3.1: [bugfix](query) Fix for incorrect query results of variant type #51651 (#51920) Cherry-picked from #51651 Co-authored-by: lw112 <131352377+felixw...@users.noreply.github.com> --- .../LogicalResultSinkToShortCircuitPointQuery.java | 3 ++ .../data/point_query_p0/test_point_query.out | Bin 9934 -> 9946 bytes .../data/variant_p0/variant_with_rowstore.out | Bin 1338 -> 1344 bytes .../suites/point_query_p0/test_point_query.groovy | 31 +++++++++++++++++---- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java index c087dcbb37b..dfcd2ea289c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/LogicalResultSinkToShortCircuitPointQuery.java @@ -65,6 +65,9 @@ public class LogicalResultSinkToShortCircuitPointQuery implements RewriteRuleFac return false; } OlapTable olapTable = olapScan.getTable(); + if (olapTable.hasVariantColumns()) { + return false; + } return olapTable.getEnableLightSchemaChange() && olapTable.getEnableUniqueKeyMergeOnWrite() && olapTable.storeRowColumn(); } diff --git a/regression-test/data/point_query_p0/test_point_query.out b/regression-test/data/point_query_p0/test_point_query.out index 8572ed52a68..60aff86a589 100644 Binary files a/regression-test/data/point_query_p0/test_point_query.out and b/regression-test/data/point_query_p0/test_point_query.out differ diff --git a/regression-test/data/variant_p0/variant_with_rowstore.out b/regression-test/data/variant_p0/variant_with_rowstore.out index a2aa68f2270..347df4dcd41 100644 Binary files a/regression-test/data/variant_p0/variant_with_rowstore.out and b/regression-test/data/variant_p0/variant_with_rowstore.out differ diff --git a/regression-test/suites/point_query_p0/test_point_query.groovy b/regression-test/suites/point_query_p0/test_point_query.groovy index fbf96d9f478..04afed2ed74 100644 --- a/regression-test/suites/point_query_p0/test_point_query.groovy +++ b/regression-test/suites/point_query_p0/test_point_query.groovy @@ -280,8 +280,8 @@ suite("test_point_query", "nonConcurrent") { PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "store_row_column" = "true" - ); - """ + ); + """ sql "insert into test_ODS_EBA_LLREPORT(RPTNO) values('567890')" sql "select /*+ SET_VAR(enable_nereids_planner=true) */ substr(RPTNO,2,5) from test_ODS_EBA_LLREPORT where RPTNO = '567890'" @@ -298,14 +298,14 @@ suite("test_point_query", "nonConcurrent") { "enable_unique_key_merge_on_write" = "true", "store_row_column" = "true" ); - """ + """ sql """insert into `test_cc_aaaid2` values('1111111')""" qt_sql """SELECT `__DORIS_DELETE_SIGN__`, aaaid FROM - `test_cc_aaaid2` + `test_cc_aaaid2` WHERE aaaid = '1111111'""" } finally { @@ -333,7 +333,7 @@ suite("test_point_query", "nonConcurrent") { explain { sql("select * from table_3821461 where col1 = -10 and col2 = 20 and loc3 = 'aabc'") contains "SHORT-CIRCUIT" - } + } qt_sql "select * from table_3821461 where col1 = 10 and col2 = 20 and loc3 = 'aabc';" sql "delete from table_3821461 where col1 = 10 and col2 = 20 and loc3 = 'aabc';" // read delete sign @@ -444,4 +444,25 @@ suite("test_point_query", "nonConcurrent") { sql "insert into table_with_chars values (20, 30, 'aabc', 'value');" sql "set enable_short_circuit_query = true" qt_sql "select length(loc3) from table_with_chars where col1 = 10" + + // test variant type + sql "DROP TABLE IF EXISTS test_with_variant" + sql """ + CREATE TABLE `test_with_variant` ( + `col1` bigint NULL, + `col2` variant NULL + ) ENGINE=OLAP + UNIQUE KEY(`col1`) + DISTRIBUTED BY HASH(`col1`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "enable_unique_key_merge_on_write" = "true", + "store_row_column" = "true" + ); + """ + sql """ + INSERT INTO test_with_variant VALUES(1, '{"k1":"v1", "k2": 200}'); + """ + qt_sql "select col2['k1'] from test_with_variant where col1=1" + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org