Skip to content

Commit

Permalink
fix test for hive3 about hive.stats.column.autogather
Browse files Browse the repository at this point in the history
  • Loading branch information
suxiaogang223 committed Apr 14, 2024
1 parent 4bde2ba commit 2272bd8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ suite("test_hive_multi_partition_mtmv", "p0,external,hive,external_docker,extern
def hive_database = "test_hive_multi_partition_mtmv_db"
def hive_table = "partition2"

def autogather_off_str = """ set hive.stats.column.autogather = false; """
def autogather_on_str = """ set hive.stats.column.autogather = true; """
def drop_table_str = """ drop table if exists ${hive_database}.${hive_table} """
def drop_database_str = """ drop database if exists ${hive_database}"""
def create_database_str = """ create database ${hive_database}"""
Expand All @@ -51,6 +53,8 @@ suite("test_hive_multi_partition_mtmv", "p0,external,hive,external_docker,extern
def insert_str5 = """insert into ${hive_database}.${hive_table} PARTITION(year=2022,region="bj") values(5)"""
def insert_str6 = """insert into ${hive_database}.${hive_table} PARTITION(year=2022,region="sh") values(6)"""

logger.info("hive sql: " + autogather_off_str)
hive_docker """ ${autogather_off_str} """
logger.info("hive sql: " + drop_table_str)
hive_docker """ ${drop_table_str} """
logger.info("hive sql: " + drop_database_str)
Expand Down Expand Up @@ -247,6 +251,8 @@ suite("test_hive_multi_partition_mtmv", "p0,external,hive,external_docker,extern
assertTrue(showPartitionsResult.toString().contains("p_sh"))
assertFalse(showPartitionsResult.toString().contains("p_tj"))

logger.info("hive sql: " + autogather_on_str)
hive_docker """ ${autogather_on_str} """
sql """drop materialized view if exists ${mvName};"""
sql """drop catalog if exists ${catalog_name}"""
}
Expand Down
8 changes: 8 additions & 0 deletions regression-test/suites/mtmv_p0/test_hive_refresh_mtmv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
def hive_database = "mtmv_test_db"
def hive_table = "test_hive_refresh_mtmv_t1"

def autogather_off_str = """ set hive.stats.column.autogather = false; """
def autogather_on_str = """ set hive.stats.column.autogather = true; """
def drop_table_str = """ drop table if exists ${hive_database}.${hive_table} """
def drop_database_str = """ drop database if exists ${hive_database}"""
def create_database_str = """ create database ${hive_database}"""
Expand All @@ -40,6 +42,9 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
partition(year=2020);
"""
def insert_str = """ insert into ${hive_database}.${hive_table} PARTITION(year=2020) values(1,1)"""

logger.info("hive sql: " + autogather_off_str)
hive_docker """ ${autogather_off_str} """
logger.info("hive sql: " + drop_table_str)
hive_docker """ ${drop_table_str} """
logger.info("hive sql: " + drop_database_str)
Expand Down Expand Up @@ -173,6 +178,9 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
waitingMTMVTaskFinishedNotNeedSuccess(jobName)
order_qt_task_recover "select Status from tasks('type'='mv') where JobName = '${jobName}' order by CreateTime DESC limit 1"

logger.info("hive sql: " + autogather_on_str)
hive_docker """ ${autogather_on_str} """

sql """drop materialized view if exists ${mvName};"""

sql """drop catalog if exists ${catalog_name}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ suite("mv_contain_external_table", "p0,external,hive,external_docker,external_do
def hive_database = "test_mv_contain_external_table_rewrite_db"
def hive_table = "orders"

def autogather_off_str = """ set hive.stats.column.autogather = false; """
def autogather_on_str = """ set hive.stats.column.autogather = true; """
def drop_table_str = """ drop table if exists ${hive_database}.${hive_table} """
def drop_database_str = """ drop database if exists ${hive_database}"""
def create_database_str = """ create database ${hive_database}"""
Expand Down Expand Up @@ -60,6 +62,7 @@ suite("mv_contain_external_table", "p0,external,hive,external_docker,external_do
def insert_str3 = """ insert into ${hive_database}.${hive_table}
PARTITION(o_orderdate='2023-10-19') values(3, 3, 'ok', 99.5, 'a', 'b', 1, 'yy')"""

hive_docker """ ${autogather_off_str} """
hive_docker """ ${drop_table_str} """
hive_docker """ ${drop_database_str} """
hive_docker """ ${create_database_str}"""
Expand Down Expand Up @@ -211,6 +214,7 @@ suite("mv_contain_external_table", "p0,external,hive,external_docker,external_do
}
order_qt_query_rewritten_with_new_data """ ${query_sql}"""

hive_docker """ ${autogather_on_str} """
sql """drop materialized view if exists ${mv_name};"""
sql """drop catalog if exists ${catalog_name}"""
}

0 comments on commit 2272bd8

Please sign in to comment.