Copilot commented on code in PR #67786: URL: https://github.com/apache/doris/pull/67786#discussion_r3977206928
########## regression-test/suites/query_p0/session_variable/test_set_var_hint_restore.groovy: ########## @@ -0,0 +1,44 @@ +// 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. + +suite("test_set_var_hint_restore") { + sql "DROP TABLE IF EXISTS test_set_var_hint_restore" + sql """ + CREATE TABLE test_set_var_hint_restore ( + k INT NOT NULL, + v BIGINT NOT NULL + ) ENGINE=OLAP + DUPLICATE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 6 + PROPERTIES ("replication_num"="1") + """ + + def timeoutsBeforeInsert = sql "SELECT @@query_timeout, @@insert_timeout" + test { + sql """ + INSERT INTO test_set_var_hint_restore + SELECT /*+ SET_VAR(query_timeout=1, insert_timeout=1) */ + 41, SUM(CRC32(CAST(number AS STRING))) + FROM numbers("number"="1000000000") + """ + exception "timeout" + } + + // Read immediately: another statement could restore values leaked by audit SQL parsing. + def timeoutsAfterInsert = sql "SELECT @@query_timeout, @@insert_timeout" + assertEquals(timeoutsBeforeInsert, timeoutsAfterInsert) Review Comment: This test asserts session variables are unchanged after the statement, but it doesn’t explicitly ensure the *audit/redaction SQL parsing path* is exercised in the regression environment. If audit logging/redaction is disabled in some CI configurations, the test may pass even without the fix. Consider explicitly enabling the relevant audit/redaction/masking feature (if configurable at session/global level in this harness) or adding an assertion/fixture step that guarantees the post-exec redaction parse runs, so the test reliably covers the original leakage scenario. ########## regression-test/suites/query_p0/session_variable/test_set_var_hint_restore.groovy: ########## @@ -0,0 +1,44 @@ +// 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. + +suite("test_set_var_hint_restore") { + sql "DROP TABLE IF EXISTS test_set_var_hint_restore" + sql """ + CREATE TABLE test_set_var_hint_restore ( + k INT NOT NULL, + v BIGINT NOT NULL + ) ENGINE=OLAP + DUPLICATE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 6 + PROPERTIES ("replication_num"="1") + """ + + def timeoutsBeforeInsert = sql "SELECT @@query_timeout, @@insert_timeout" + test { + sql """ + INSERT INTO test_set_var_hint_restore + SELECT /*+ SET_VAR(query_timeout=1, insert_timeout=1) */ + 41, SUM(CRC32(CAST(number AS STRING))) + FROM numbers("number"="1000000000") Review Comment: `numbers("number"="1000000000")` is extremely large for a regression test and can cause unnecessary CPU load and/or flakiness (e.g., failures other than timeout, longer cancellation/cleanup time, resource contention in CI). Prefer a smaller input that still deterministically triggers the intended timeout, or use a deterministic slow operation if available in this test framework so the failure mode remains “timeout” without stressing the cluster. -- 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]
