github-actions[bot] commented on code in PR #67776: URL: https://github.com/apache/doris/pull/67776#discussion_r3978174798
########## regression-test/suites/query_p0/hint/test_leading_row_policy.groovy: ########## @@ -0,0 +1,164 @@ +// 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_leading_row_policy") { + String dbName = context.config.getDbNameByFile(context.file) + String user = "leading_row_policy_user" + String pwd = 'C123_567p' + def tokens = context.config.jdbcUrl.split('/') + def url = tokens[0] + "//" + tokens[2] + "/" + dbName + "?" + + sql "DROP ROW POLICY IF EXISTS leading_row_policy ON ${dbName}.leading_row_policy_t1 FOR ${user}" + sql "DROP ROW POLICY IF EXISTS leading_row_policy_agg ON ${dbName}.leading_row_policy_agg FOR ${user}" + sql "DROP TABLE IF EXISTS leading_row_policy_t1" + sql "DROP TABLE IF EXISTS leading_row_policy_t2" + sql "DROP TABLE IF EXISTS leading_row_policy_agg" + sql """ + CREATE TABLE leading_row_policy_t1 ( + `k` INT, + `v` INT + ) DUPLICATE KEY (`k`) DISTRIBUTED BY HASH (`k`) BUCKETS 1 + PROPERTIES ('replication_num' = '1') + """ + sql """ + CREATE TABLE leading_row_policy_t2 ( + `k` INT, + `v` INT + ) DUPLICATE KEY (`k`) DISTRIBUTED BY HASH (`k`) BUCKETS 1 + PROPERTIES ('replication_num' = '1') + """ + // the aggregate table with random distribution needs an aggregation above the scan to merge the rows + sql """ + CREATE TABLE leading_row_policy_agg ( + `k` INT, + `v` INT SUM + ) AGGREGATE KEY (`k`) DISTRIBUTED BY RANDOM BUCKETS 1 + PROPERTIES ('replication_num' = '1') + """ + sql "INSERT INTO leading_row_policy_t1 VALUES (1, 10), (2, 20)" + sql "INSERT INTO leading_row_policy_t2 VALUES (1, 100), (2, 200)" + sql "INSERT INTO leading_row_policy_agg VALUES (1, 10), (1, 30), (2, 20)" + + sql "DROP USER IF EXISTS ${user}" + sql "CREATE USER ${user} IDENTIFIED BY '${pwd}'" + sql "GRANT SELECT_PRIV ON internal.${dbName}.leading_row_policy_t1 TO ${user}" + sql "GRANT SELECT_PRIV ON internal.${dbName}.leading_row_policy_t2 TO ${user}" + sql "GRANT SELECT_PRIV ON internal.${dbName}.leading_row_policy_agg TO ${user}" Review Comment: [P1] Grant this test user access to a cloud compute group. The cloud-p0 pipeline runs the p0 group and does not exclude `query_p0/hint`, but this user receives only table `SELECT_PRIV`. In cloud mode, `ConnectContext` selects only compute groups on which the user has `USAGE_PRIV` and throws `CURRENT_USER_NO_AUTH_TO_USE_ANY_COMPUTE_GROUP` when none exist, so the first `SELECT` in the `connect` block fails before exercising LEADING or the row-policy oracle. Mirror the setup in `query_p0/test_row_policy.groovy` before connecting: ```suggestion sql "GRANT SELECT_PRIV ON ${dbName}.${tableRandom} TO ${user}" if (isCloudMode()) { def clusters = sql "SHOW CLUSTERS" assertTrue(!clusters.isEmpty()) def validCluster = clusters[0][0] sql """GRANT USAGE_PRIV ON CLUSTER `${validCluster}` TO ${user}""" } ``` -- 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]
