github-actions[bot] commented on code in PR #62627: URL: https://github.com/apache/doris/pull/62627#discussion_r3109120001
########## regression-test/suites/query_p0/runtime_filter/runtime_filter_cast.groovy: ########## @@ -0,0 +1,154 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Regression test for crash in DecimalComparison due to column/type +// nullability mismatch when runtime filter pushes MIN/MAX predicates +// involving decimal type casts on nullable columns. +suite("runtime_filter_cast") { + String db = context.config.getDbNameByFile(context.file) + sql "use ${db}" + sql "SET enable_nereids_planner=true" + sql "SET enable_fallback_to_original_planner=false" + sql "set disable_join_reorder=true" + sql "set runtime_filter_type=4" + sql "set runtime_filter_mode=GLOBAL" + sql "set runtime_filter_wait_time_ms=10000" + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + // Build-side table: small dimension table with decimal column + sql "drop table if exists decimal_rf_build" + sql """ + CREATE TABLE decimal_rf_build ( + `id` INT NOT NULL, + `val_int_not_null` INT NOT NULL, + `val` DECIMALV3(38, 10) NOT NULL + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "storage_format" = "V2" + ) + """ + + // Probe-side table: fact table with nullable decimal of different precision + // The different precision forces VCastExpr in the runtime filter comparison + sql "drop table if exists decimal_rf_probe" + sql """ + CREATE TABLE decimal_rf_probe ( + `id` INT NOT NULL, + `val` DECIMALV3(15, 2) NOT NULL, + `data` VARCHAR(20) NULL + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 10 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "storage_format" = "V2" + ) + """ + + sql """ + INSERT INTO decimal_rf_build VALUES + (1, 100, 100.5000000000), + (2, 200, 200.7500000000), + (3, 300, 150.2500000000) + """ + + sql """ + INSERT INTO decimal_rf_probe VALUES + (1, 50.12, 'a'), + (2, 100.50, 'b'), + (3, 150.25, 'c'), + (4, 175.99, 'd'), + (5, 200.75, 'e'), + (7, 300.00, 'g') + """ + + sql "SET @v0 = 1 ;" + + order_qt_decimal_rf_join """ Review Comment: This suite is meant to guard a runtime-filter translation bug, but here it only checks final rows. For queries like this, the result is identical whether the optimizer actually builds an RF or not, so the test can still pass if the filter is pruned or never translated. Please add an `explain` assertion (for example `contains("RF")`) for at least one casted / implicit-cast case that is supposed to hit the patched `RuntimeFilterTranslator` path. ########## regression-test/suites/query_p0/runtime_filter/runtime_filter_cast.groovy: ########## @@ -0,0 +1,154 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Regression test for crash in DecimalComparison due to column/type +// nullability mismatch when runtime filter pushes MIN/MAX predicates +// involving decimal type casts on nullable columns. +suite("runtime_filter_cast") { + String db = context.config.getDbNameByFile(context.file) + sql "use ${db}" + sql "SET enable_nereids_planner=true" + sql "SET enable_fallback_to_original_planner=false" + sql "set disable_join_reorder=true" + sql "set runtime_filter_type=4" + sql "set runtime_filter_mode=GLOBAL" + sql "set runtime_filter_wait_time_ms=10000" + sql "set disable_nereids_rules=PRUNE_EMPTY_PARTITION" + + // Build-side table: small dimension table with decimal column + sql "drop table if exists decimal_rf_build" + sql """ + CREATE TABLE decimal_rf_build ( + `id` INT NOT NULL, + `val_int_not_null` INT NOT NULL, + `val` DECIMALV3(38, 10) NOT NULL + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "storage_format" = "V2" + ) + """ + + // Probe-side table: fact table with nullable decimal of different precision + // The different precision forces VCastExpr in the runtime filter comparison + sql "drop table if exists decimal_rf_probe" + sql """ + CREATE TABLE decimal_rf_probe ( + `id` INT NOT NULL, + `val` DECIMALV3(15, 2) NOT NULL, + `data` VARCHAR(20) NULL + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 10 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "storage_format" = "V2" + ) + """ + + sql """ + INSERT INTO decimal_rf_build VALUES + (1, 100, 100.5000000000), + (2, 200, 200.7500000000), + (3, 300, 150.2500000000) + """ + + sql """ + INSERT INTO decimal_rf_probe VALUES + (1, 50.12, 'a'), + (2, 100.50, 'b'), + (3, 150.25, 'c'), + (4, 175.99, 'd'), + (5, 200.75, 'e'), + (7, 300.00, 'g') + """ + + sql "SET @v0 = 1 ;" + + order_qt_decimal_rf_join """ + SELECT p.val, b.val_int_not_null + FROM decimal_rf_probe p + INNER JOIN decimal_rf_build b + ON round(p.val, 1) = b.val_int_not_null + """ + // TOOD: currently the following sql fails with error "hash join condition type mismatch error", + // enable it after the fix for the issue is in place: https://github.com/apache/doris/pull/62524 + // order_qt_decimal_rf_jin_var """ + // SELECT p.val, b.val_int_not_null + // FROM decimal_rf_probe p + // INNER JOIN decimal_rf_build b + // ON round(p.val, @v0) = b.val_int_not_null + // """ + + order_qt_decimal_rf_except """ + select t1.val_int_not_null + from decimal_rf_build t1 + except + select round(t2.val, 1) + from decimal_rf_probe t2 + """ + + // TODO: currently the result is wrong, fix result after the fix for the issue is in place:https://github.com/apache/doris/pull/62524 Review Comment: This `order_qt_` case is encoding a result that the test itself says is currently wrong. That turns the existing bug into the expected golden output, so regression runs will no longer catch it. Please drop this case from the golden suite until the result is fixed, or change it to a non-golden TODO so we do not bless incorrect behavior. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
