github-actions[bot] commented on code in PR #63389: URL: https://github.com/apache/doris/pull/63389#discussion_r3395968401
########## regression-test/suites/query_p0/expr_zonemap/test_expr_zonemap_pruning.groovy: ########## @@ -0,0 +1,227 @@ +// 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. + +import java.util.regex.Matcher +import java.util.regex.Pattern +import org.apache.doris.regression.action.ProfileAction + +suite("test_expr_zonemap_pruning") { + sql """ set enable_common_expr_pushdown = true """ + sql """ set enable_profile = true """ + sql """ set profile_level = 2 """ + + sql """ DROP TABLE IF EXISTS test_expr_zonemap_pruning """ + sql """ + CREATE TABLE test_expr_zonemap_pruning ( + id INT, + v VARCHAR(32) + ) ENGINE=OLAP + DUPLICATE KEY(id) + DISTRIBUTED BY HASH(id) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "disable_auto_compaction" = "true" + ) + """ + + sql """ + INSERT INTO test_expr_zonemap_pruning + SELECT CAST(number AS INT), CONCAT('a', CAST(number AS STRING)) + FROM numbers("number" = "4096") + """ + sql """ sync """ + + def profileAction = new ProfileAction(context) + + def getProfileByToken = { String token -> + for (int retry = 0; retry < 10; ++retry) { + List profileData = profileAction.getProfileList() + for (final def profileItem in profileData) { + if (profileItem["Sql Statement"].toString().contains(token)) { + return profileAction.getProfile(profileItem["Profile ID"].toString()) + } + } + Thread.sleep(500) + } + throw new IllegalStateException("Missing profile for token: " + token) + } + + def counterSum = { String profile, String counterName -> + Pattern pattern = Pattern.compile(Pattern.quote(counterName) + ":\\s*([0-9,]+)") + Matcher matcher = pattern.matcher(profile) + long sum = 0 + while (matcher.find()) { + sum += Long.parseLong(matcher.group(1).replace(",", "")) + } + return sum + } + + def assertExprZonemapPruned = { String token -> + String profile = "" + long filteredSegments = 0 + long filteredPages = 0 + for (int retry = 0; retry < 20; ++retry) { + profile = getProfileByToken(token).toString() + filteredSegments = counterSum(profile, "ExprZoneMapFilteredSegments") + filteredPages = counterSum(profile, "ExprZoneMapFilteredPages") + if (filteredSegments + filteredPages > 0) { + logger.info("${token} Profile Data: ${profile}") + return + } + Thread.sleep(500) + } + logger.info("${token} Profile Data: ${profile}") + assertTrue(filteredSegments + filteredPages > 0) + } + + def assertProfileCounterPositive = { String token, String counterName -> + String profile = "" + long counterValue = 0 + for (int retry = 0; retry < 20; ++retry) { + profile = getProfileByToken(token).toString() + counterValue = counterSum(profile, counterName) + if (counterValue > 0) { + logger.info("${token} Profile Data: ${profile}") + return + } + Thread.sleep(500) + } + logger.info("${token} Profile Data: ${profile}") + assertTrue(counterValue > 0) + } + + def matchedRows = sql """ + SELECT COUNT(*) FROM test_expr_zonemap_pruning WHERE starts_with(v, 'a') + """ + assertEquals(4096L, matchedRows[0][0] as long) Review Comment: The deterministic query results in this new regression suite are checked with Groovy `assertEquals`, and the PR does not add a generated `.out` file under `regression-test/data/...`. Doris regression tests should record deterministic SQL results with `qt_sql`/`order_qt` (or explicit `ORDER BY`) and commit the generated output; direct assertions should be reserved for checks that cannot be represented in golden output, such as profile counters. Please convert these result checks to `qt_...` cases and add the generated `.out` file. ########## regression-test/suites/query_p1/expr_zonemap/test_expr_zonemap_pruning_p1.groovy: ########## @@ -0,0 +1,157 @@ +// 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. + +import java.util.regex.Matcher +import java.util.regex.Pattern +import org.apache.doris.regression.action.ProfileAction + +suite("test_expr_zonemap_pruning_p1") { + sql """ set enable_common_expr_pushdown = true """ + sql """ set enable_profile = true """ + sql """ set profile_level = 2 """ + + sql """ DROP TABLE IF EXISTS test_expr_zonemap_pruning_p1 """ + sql """ + CREATE TABLE test_expr_zonemap_pruning_p1 ( + id INT, + k BIGINT, + v VARCHAR(32), + nullable_v VARCHAR(32) NULL + ) ENGINE=OLAP + DUPLICATE KEY(id) + DISTRIBUTED BY HASH(id) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "disable_auto_compaction" = "true" + ) + """ + + sql """ + INSERT INTO test_expr_zonemap_pruning_p1 + SELECT CAST(number AS INT), CAST(number AS BIGINT), + CONCAT('left_', CAST(number AS STRING)), NULL + FROM numbers("number" = "2048") + """ + sql """ + INSERT INTO test_expr_zonemap_pruning_p1 + SELECT CAST(number + 2048 AS INT), CAST(number + 2048 AS BIGINT), + CONCAT('right_', CAST(number + 2048 AS STRING)), + CONCAT('not_null_', CAST(number + 2048 AS STRING)) + FROM numbers("number" = "2048") + """ + sql """ sync """ + + def profileAction = new ProfileAction(context) + + def getProfileByToken = { String token -> + for (int retry = 0; retry < 10; ++retry) { + List profileData = profileAction.getProfileList() + for (final def profileItem in profileData) { + if (profileItem["Sql Statement"].toString().contains(token)) { + return profileAction.getProfile(profileItem["Profile ID"].toString()) + } + } + Thread.sleep(500) + } + throw new IllegalStateException("Missing profile for token: " + token) + } + + def counterSum = { String profile, String counterName -> + Pattern pattern = Pattern.compile(Pattern.quote(counterName) + ":\\s*([0-9,]+)") + Matcher matcher = pattern.matcher(profile) + long sum = 0 + while (matcher.find()) { + sum += Long.parseLong(matcher.group(1).replace(",", "")) + } + return sum + } + + def assertProfileCounterPositive = { String token, String counterName -> + String profile = "" + long counterValue = 0 + for (int retry = 0; retry < 20; ++retry) { + profile = getProfileByToken(token).toString() + counterValue = counterSum(profile, counterName) + if (counterValue > 0) { + logger.info("${token} Profile Data: ${profile}") + return + } + Thread.sleep(500) + } + logger.info("${token} Profile Data: ${profile}") + assertTrue(counterValue > 0) + } + + def assertExprZonemapPruned = { String token -> + String profile = "" + long filteredSegments = 0 + long filteredPages = 0 + for (int retry = 0; retry < 20; ++retry) { + profile = getProfileByToken(token).toString() + filteredSegments = counterSum(profile, "ExprZoneMapFilteredSegments") + filteredPages = counterSum(profile, "ExprZoneMapFilteredPages") + if (filteredSegments + filteredPages > 0) { + logger.info("${token} Profile Data: ${profile}") + return + } + Thread.sleep(500) + } + logger.info("${token} Profile Data: ${profile}") + assertTrue(filteredSegments + filteredPages > 0) + } + + def notNullToken = "expr_zonemap_pruning_p1_is_not_null_" + UUID.randomUUID().toString() + def notNullRows = sql """ + SELECT '${notNullToken}', COUNT(*) FROM test_expr_zonemap_pruning_p1 + WHERE nullable_v IS NOT NULL OR starts_with(v, 'never_') + """ + assertEquals(2048L, notNullRows[0][1] as long) Review Comment: Same issue in this P1 suite: deterministic SQL result checks use Groovy `assertEquals`, and the PR does not add a generated `.out` file. Please use `qt_sql`/`order_qt` for the expected result queries and commit the generated output, leaving only the profile-counter checks as Groovy assertions. -- 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]
