forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improvement](statistics)Improve statistics user experience (apache#2…
…4414) Two improvements: 1. Move the `Job_id` column for the return info of `Analyze table` command to the first column. To keep consistent with `show analyze`. ``` mysql> analyze table hive.tpch100.region; +--------+--------------+-------------------------+------------+--------------------------------+ | Job_Id | Catalog_Name | DB_Name | Table_Name | Columns | +--------+--------------+-------------------------+------------+--------------------------------+ | 14403 | hive | default_cluster:tpch100 | region | [r_regionkey,r_comment,r_name] | +--------+--------------+-------------------------+------------+--------------------------------+ 1 row in set (0.03 sec) ``` 2. Add `analyze_timeout` session variable, to control `analyze table/database with sync` timeout.
- Loading branch information
Showing
7 changed files
with
90 additions
and
2 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
7 changes: 7 additions & 0 deletions
7
regression-test/data/external_table_p2/hive/test_hive_statistic_timeout.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,7 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !01 -- | ||
p_container 200000000 40 0 JUMBO BAG WRAP PKG | ||
p_partkey 200000000 200778064 0 1 200000000 | ||
p_retailprice 200000000 120014 0 900.00 2099.00 | ||
p_type 200000000 150 0 ECONOMY ANODIZED BRASS STANDARD POLISHED TIN | ||
|
54 changes: 54 additions & 0 deletions
54
regression-test/suites/external_table_p2/hive/test_hive_statistic_timeout.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,54 @@ | ||
// 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_hive_statistic_timeout", "p2,external,hive,external_remote,external_remote_hive") { | ||
String enabled = context.config.otherConfigs.get("enableExternalHiveTest") | ||
if (enabled != null && enabled.equalsIgnoreCase("true")) { | ||
String extHiveHmsHost = context.config.otherConfigs.get("extHiveHmsHost") | ||
String extHiveHmsPort = context.config.otherConfigs.get("extHiveHmsPort") | ||
String catalog_name = "test_hive_statistic_timeout" | ||
sql """drop catalog if exists ${catalog_name};""" | ||
sql """ | ||
create catalog if not exists ${catalog_name} properties ( | ||
'type'='hms', | ||
'hadoop.username' = 'hadoop', | ||
'hive.metastore.uris' = 'thrift://${extHiveHmsHost}:${extHiveHmsPort}' | ||
); | ||
""" | ||
logger.info("catalog " + catalog_name + " created") | ||
|
||
sql """use ${catalog_name}.tpch_1000_parquet""" | ||
sql """set query_timeout=1""" | ||
sql """analyze table part (p_partkey, p_container, p_type, p_retailprice) with sync;""" | ||
|
||
def result = sql """show column stats part""" | ||
assertTrue(result.size() == 4) | ||
|
||
def ctlId | ||
result = sql """show proc '/catalogs'""" | ||
|
||
for (int i = 0; i < result.size(); i++) { | ||
if (result[i][1] == catalog_name) { | ||
ctlId = result[i][0] | ||
} | ||
} | ||
|
||
qt_01 """select col_id, count, ndv, null_count, min, max from internal.__internal_schema.column_statistics where catalog_id='$ctlId' order by col_id;""" | ||
sql """drop catalog ${catalog_name}"""; | ||
} | ||
} | ||
|