forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature](sql-block-rule) sql block rule support external table (apac…
…he#37041) Let SQL Block rule feature support external table: ``` create sql_block_rule r1 properties("partition_num" = "100", "global" = "true"); create sql_block_rule r2 properties("tablet_num" = "100", "global" = "true"); create sql_block_rule r3 properties("cardinality" = "100", "global" = "true"); ``` For external table, `tablet_num` equals to `splitNum`
- Loading branch information
1 parent
fa43afc
commit bd05cba
Showing
15 changed files
with
132 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
regression-test/data/external_table_p0/hive/test_external_sql_block_rule.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !sql01 -- | ||
6179 21 4 20 5.00 4600.10 0.05 0.00 A F 1994-06-05 1994-07-27 1994-06-26 COLLECT COD MAIL silent deposits. furiously us chicago | ||
6273 2552 1 51 33.00 31384.65 0.04 0.08 R F 1995-04-23 1995-05-02 1995-05-13 DELIVER IN PERSON TRUCK ges. unusual, pending packages accordi us chicago | ||
8645 7554 4 53 34.00 32403.70 0.03 0.03 N O 1996-12-29 1997-01-25 1997-01-16 TAKE BACK RETURN FOB ackages are carefully above the jp tokyo | ||
5121 7580 6 79 2.00 1958.14 0.04 0.07 R F 1992-08-10 1992-06-28 1992-08-11 NONE FOB final, regular account us washington | ||
2883 2592 1 91 33.00 32705.97 0.08 0.07 R F 1995-02-26 1995-03-04 1995-03-01 NONE RAIL s. final i cn shanghai | ||
807 5150 7 149 19.00 19933.66 0.08 0.05 A F 1994-02-10 1994-02-20 1994-03-06 NONE SHIP ns haggle quickly across the furi cn beijing | ||
4452 7650 2 149 47.00 49309.58 0.01 0.06 A F 1994-10-08 1994-08-09 1994-10-09 TAKE BACK RETURN TRUCK ts. slyly regular cour us washington | ||
4102 5176 5 175 32.00 34405.44 0.08 0.01 N O 1996-05-14 1996-04-29 1996-05-29 NONE RAIL the even requests; regular pinto us washington | ||
2117 2680 6 179 27.00 29137.59 0.09 0.08 N O 1997-06-30 1997-06-27 1997-07-11 TAKE BACK RETURN REG AIR the carefully ironic ideas cn shanghai | ||
548 7683 3 182 21.00 22725.78 0.03 0.08 A F 1995-01-13 1994-12-18 1995-01-25 NONE AIR ideas. special accounts above the furiou cn beijing | ||
|
85 changes: 85 additions & 0 deletions
85
regression-test/suites/external_table_p0/hive/test_external_sql_block_rule.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// 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_external_sql_block_rule", "external_docker,hive,external_docker_hive,p0,external") { | ||
String enabled = context.config.otherConfigs.get("enableHiveTest") | ||
if (enabled == null || !enabled.equalsIgnoreCase("true")) { | ||
logger.info("diable Hive test.") | ||
return; | ||
} | ||
|
||
String hivePrefix = "hive2"; | ||
String catalog_name = "test_${hivePrefix}_external_sql_block_rule"; | ||
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") | ||
String hms_port = context.config.otherConfigs.get(hivePrefix + "HmsPort") | ||
|
||
sql """drop catalog if exists ${catalog_name} """ | ||
|
||
sql """CREATE CATALOG ${catalog_name} PROPERTIES ( | ||
'type'='hms', | ||
'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}', | ||
'hadoop.username' = 'hive' | ||
);""" | ||
|
||
sql "use ${catalog_name}.`default`"; | ||
qt_sql01 """select * from parquet_partition_table order by l_linenumber,l_orderkey limit 10;""" | ||
|
||
sql """drop sql_block_rule if exists external_hive_partition""" | ||
sql """create sql_block_rule external_hive_partition properties("partition_num" = "3", "global" = "false");""" | ||
sql """drop sql_block_rule if exists external_hive_partition2""" | ||
sql """create sql_block_rule external_hive_partition2 properties("tablet_num" = "3", "global" = "false");""" | ||
sql """drop sql_block_rule if exists external_hive_partition3""" | ||
sql """create sql_block_rule external_hive_partition3 properties("cardinality" = "3", "global" = "false");""" | ||
// create 3 users | ||
sql """drop user if exists external_block_user1""" | ||
sql """create user external_block_user1;""" | ||
sql """SET PROPERTY FOR 'external_block_user1' 'sql_block_rules' = 'external_hive_partition';""" | ||
sql """grant all on *.*.* to external_block_user1;""" | ||
|
||
sql """drop user if exists external_block_user2""" | ||
sql """create user external_block_user2;""" | ||
sql """SET PROPERTY FOR 'external_block_user2' 'sql_block_rules' = 'external_hive_partition2';""" | ||
sql """grant all on *.*.* to external_block_user2;""" | ||
|
||
sql """drop user if exists external_block_user3""" | ||
sql """create user external_block_user3;""" | ||
sql """SET PROPERTY FOR 'external_block_user3' 'sql_block_rules' = 'external_hive_partition3';""" | ||
sql """grant all on *.*.* to external_block_user3;""" | ||
|
||
// login as external_block_user1 | ||
def result1 = connect(user = 'external_block_user1', password = '', url = context.config.jdbcUrl) { | ||
test { | ||
sql """select * from ${catalog_name}.`default`.parquet_partition_table order by l_linenumber limit 10;""" | ||
exception """sql hits sql block rule: external_hive_partition, reach partition_num : 3""" | ||
} | ||
} | ||
// login as external_block_user2 | ||
def result2 = connect(user = 'external_block_user2', password = '', url = context.config.jdbcUrl) { | ||
test { | ||
sql """select * from ${catalog_name}.`default`.parquet_partition_table order by l_linenumber limit 10;""" | ||
exception """sql hits sql block rule: external_hive_partition2, reach tablet_num : 3""" | ||
} | ||
} | ||
// login as external_block_user3 | ||
def result3 = connect(user = 'external_block_user3', password = '', url = context.config.jdbcUrl) { | ||
test { | ||
sql """select * from ${catalog_name}.`default`.parquet_partition_table order by l_linenumber limit 10;""" | ||
exception """sql hits sql block rule: external_hive_partition3, reach cardinality : 3""" | ||
} | ||
} | ||
} | ||
|