Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Feb 19, 2025
1 parent ebab86a commit a51cba9
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 19 deletions.
20 changes: 10 additions & 10 deletions regression-test/data/variant_github_events_new_p2/load.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
39

-- !sql --
39

-- !sql --
\N
\N
Expand All @@ -9,14 +15,8 @@
67843

-- !sql_inv --
11 ["async-await", "express", "javascript", "promise"]
106 ["javascript", "nodejs"]
165 ["bem-methodology", "css", "frontend-components", "react-components", "style-guide"]
181 ["bem-methodology", "css", "frontend-components", "react-components", "style-guide"]
448 ["es6", "eslint", "front-end", "frontend", "html", "html-css", "html5", "javascript", "js", "minions", "pam", "salt", "salt-command", "webapp", "yarn"]
496 ["bootstrap", "css", "css-framework", "html", "javascript", "sass", "scss"]
685 ["apollo-client", "apollo-server", "graphql", "javascript", "node", "react"]
826 ["javascript", "react"]
948 ["chrome", "chrome-extension", "firefox", "firefox-addon", "javascript", "jquery"]
962 ["application-programming-interface", "clang", "command-line-interface", "community-feedback-supported", "cpp", "css3", "html5", "javascript", "php8", "py311", "typescript"]
166

-- !sql_inv --
166

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ suite("test_arrayInvertedIdx_profile", "nonConcurrent"){
// If we use common expr pass to inverted index , we should set enable_common_expr_pushdown = true
sql """ set enable_common_expr_pushdown = true; """
sql """ set enable_common_expr_pushdown_for_inverted_index = true; """
sql """ set enable_pipeline_x_engine = true;"""
sql """ set enable_profile = true;"""
sql """ set profile_level = 2;"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ suite("test_array_contains_with_inverted_index"){
// If we use common expr pass to inverted index , we should set enable_common_expr_pushdown = true
sql """ set enable_common_expr_pushdown = true; """
sql """ set enable_common_expr_pushdown_for_inverted_index = true; """
sql """ set enable_pipeline_x_engine = true;"""
sql """ set enable_profile = true;"""

sql "DROP TABLE IF EXISTS ${indexTblName}"
Expand Down
47 changes: 42 additions & 5 deletions regression-test/suites/variant_github_events_new_p2/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,44 @@ suite("regression_test_variant_github_events_p2", "nonConcurrent,p2"){
DISTRIBUTED BY HASH(k) BUCKETS 4
properties("replication_num" = "1", "disable_auto_compaction" = "false");
"""

sql """DROP TABLE IF EXISTS github_events_arr"""
sql """
CREATE TABLE IF NOT EXISTS github_events_arr (
k bigint,
v array<text>,
INDEX idx_var(v) USING INVERTED COMMENT ''
)
DUPLICATE KEY(`k`)
DISTRIBUTED BY HASH(k) BUCKETS 4
properties("replication_num" = "1", "disable_auto_compaction" = "false");
"""
// 2015
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2015-01-01-0.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2015-01-01-1.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2015-01-01-2.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2015-01-01-3.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
// 2022
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2022-11-07-16.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2022-11-07-10.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2022-11-07-22.json'}""")
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
load_json_data.call(table_name, """${getS3Url() + '/regression/gharchive.m/2022-11-07-23.json'}""")

// test array index
sql """insert into github_events_arr select k, cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>) from github_events"""
sql "set enable_common_expr_pushdown = true; "
qt_sql """select count() from github_events_arr where array_contains(v, 'css');"""
sql "set enable_common_expr_pushdown = false; "
qt_sql """select count() from github_events_arr where array_contains(v, 'css');"""
sql "set enable_common_expr_pushdown = true; "

// TODO fix compaction issue, this case could be stable
qt_sql """select cast(v["payload"]["pull_request"]["additions"] as int) from github_events where cast(v["repo"]["name"] as string) = 'xpressengine/xe-core' order by 1;"""
// TODO add test case that some certain columns are materialized in some file while others are not materilized(sparse)
Expand Down Expand Up @@ -140,14 +168,23 @@ suite("regression_test_variant_github_events_p2", "nonConcurrent,p2"){
sql """ set profile_level = 2;"""
run {
qt_sql_inv """/* test_profile_1 */
select k, v['payload']['pull_request']['head']['repo']['topics'] from github_events where arrays_overlap(cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>), ['javascript', 'css'] ) order by k
select count() from github_events where arrays_overlap(cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>), ['javascript', 'css'] )
"""
}

check { profileString, exception ->
log.info(profileString)
assertTrue(profileString.contains("RowsInvertedIndexFiltered: 67.682K"))
}
// Use a regular expression to match the numeric value inside parentheses after "RowsInvertedIndexFiltered:"
def matcher = (profileString =~ /RowsInvertedIndexFiltered:\s+[^\(]+\((\d+)\)/)
def total = 0
while (matcher.find()) {
total += matcher.group(1).toInteger()
}
// Assert that the sum of all matched numbers equals 67677
assertEquals(67677, total)
}
}
qt_sql_inv """select k, v['payload']['pull_request']['head']['repo']['topics'] from github_events where arrays_overlap(cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>), ['javascript', 'css'] ) order by k limit 10;"""
}
sql """ set enable_common_expr_pushdown = true; """
sql """ set enable_common_expr_pushdown_for_inverted_index = true; """
qt_sql_inv """select count() from github_events where arrays_overlap(cast(v['payload']['pull_request']['head']['repo']['topics'] as array<text>), ['javascript', 'css'] )"""
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ suite("test_array_contains_with_inverted_index"){
// If we use common expr pass to inverted index , we should set enable_common_expr_pushdown = true
sql """ set enable_common_expr_pushdown = true; """
sql """ set enable_common_expr_pushdown_for_inverted_index = true; """
sql """ set enable_pipeline_x_engine = true;"""
sql """ set enable_profile = true;"""

sql "DROP TABLE IF EXISTS ${indexTblName}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ suite("test_variant_arrayInvertedIdx_profile", "nonConcurrent"){
// If we use common expr pass to inverted index , we should set enable_common_expr_pushdown = true
sql """ set enable_common_expr_pushdown = true; """
sql """ set enable_common_expr_pushdown_for_inverted_index = true; """
sql """ set enable_pipeline_x_engine = true;"""
sql """ set enable_profile = true;"""
sql """ set profile_level = 2;"""
sql "set disable_inverted_index_v1_for_variant = false"
Expand Down

0 comments on commit a51cba9

Please sign in to comment.