-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Enhancement](parquet)update runtime filter when read next parquet row group. #59053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,7 @@ Scanner::Scanner(RuntimeState* state, pipeline::ScanLocalStateBase* local_state, | |||||
| _output_tuple_desc(_local_state->output_tuple_desc()), | ||||||
| _output_row_descriptor(_local_state->_parent->output_row_descriptor()), | ||||||
| _has_prepared(false) { | ||||||
| _total_rf_num = cast_set<int>(_local_state->_helper.runtime_filter_nums()); | ||||||
|
||||||
| _total_rf_num = cast_set<int>(_local_state->_helper.runtime_filter_nums()); | |
| _total_rf_num = static_cast<int>(_local_state->_helper.runtime_filter_nums()); |
20 changes: 20 additions & 0 deletions
20
docker/thirdparties/docker-compose/hive/scripts/create_preinstalled_scripts/run84.hql
This file contains hidden or 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,20 @@ | ||
| use `default`; | ||
|
|
||
| create table fact_big ( | ||
| k INT, | ||
| c1 INT, | ||
| c2 BIGINT, | ||
| c3 DOUBLE, | ||
| c4 STRING | ||
| )stored as parquet | ||
| LOCATION '/user/doris/preinstalled_data/parquet_table/runtime_filter_fact_big'; | ||
|
|
||
| create table dim_small ( | ||
| k INT, | ||
| c1 INT, | ||
| c2 BIGINT | ||
| )stored as parquet | ||
| LOCATION '/user/doris/preinstalled_data/parquet_table/runtime_filter_dim_small'; | ||
|
|
||
| msck repair table fact_big; | ||
| msck repair table dim_small; |
Binary file added
BIN
+4.13 KB
...e/hive/scripts/preinstalled_data/parquet_table/runtime_filter_dim_small/dim_small.parquet
Binary file not shown.
Binary file added
BIN
+126 KB
...ose/hive/scripts/preinstalled_data/parquet_table/runtime_filter_fact_big/fact_big.parquet
Binary file not shown.
174 changes: 174 additions & 0 deletions
174
regression-test/suites/external_table_p0/hive/test_parquet_join_runtime_filter.groovy
This file contains hidden or 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,174 @@ | ||
| // 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. | ||
|
|
||
| import groovy.json.JsonSlurper | ||
|
|
||
| suite("test_parquet_join_runtime_filter", "p0,external,hive,external_docker,external_docker_hive") { | ||
|
|
||
| def getProfileList = { | ||
| def dst = 'http://' + context.config.feHttpAddress | ||
| def conn = new URL(dst + "/rest/v1/query_profile").openConnection() | ||
| conn.setRequestMethod("GET") | ||
| def encoding = Base64.getEncoder().encodeToString((context.config.feHttpUser + ":" + | ||
| (context.config.feHttpPassword == null ? "" : context.config.feHttpPassword)).getBytes("UTF-8")) | ||
| conn.setRequestProperty("Authorization", "Basic ${encoding}") | ||
| return conn.getInputStream().getText() | ||
| } | ||
|
|
||
| def getProfile = { id -> | ||
| def dst = 'http://' + context.config.feHttpAddress | ||
| def conn = new URL(dst + "/api/profile/text/?query_id=$id").openConnection() | ||
| conn.setRequestMethod("GET") | ||
| def encoding = Base64.getEncoder().encodeToString((context.config.feHttpUser + ":" + | ||
| (context.config.feHttpPassword == null ? "" : context.config.feHttpPassword)).getBytes("UTF-8")) | ||
| conn.setRequestProperty("Authorization", "Basic ${encoding}") | ||
| return conn.getInputStream().getText() | ||
| } | ||
|
|
||
|
|
||
| def extractFilteredGroupsValue = { String profileText -> | ||
| def values = (profileText =~ /RowGroupsFiltered:\s*(\d+)/).collect { it[1].toLong() } | ||
| return values.sort { a, b -> b <=> a } | ||
| } | ||
|
|
||
| def getProfileWithToken = { token -> | ||
| String profileId = "" | ||
| int attempts = 0 | ||
| while (attempts < 10 && (profileId == null || profileId == "")) { | ||
| List profileData = new JsonSlurper().parseText(getProfileList()).data.rows | ||
| for (def profileItem in profileData) { | ||
| if (profileItem["Sql Statement"].toString().contains(token)) { | ||
| profileId = profileItem["Profile ID"].toString() | ||
| break | ||
| } | ||
| } | ||
| if (profileId == null || profileId == "") { | ||
| Thread.sleep(300) | ||
| } | ||
| attempts++ | ||
| } | ||
| assertTrue(profileId != null && profileId != "") | ||
| Thread.sleep(800) | ||
| return getProfile(profileId).toString() | ||
| } | ||
| // session vars | ||
| sql "unset variable all;" | ||
| sql "set profile_level=2;" | ||
| sql "set enable_profile=true;" | ||
|
|
||
|
|
||
| String enabled = context.config.otherConfigs.get("enableHiveTest") | ||
| if (!"true".equalsIgnoreCase(enabled)) { | ||
| return; | ||
| } | ||
| for (String hivePrefix : ["hive2"]) { | ||
| String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") | ||
| String hmsPort = context.config.otherConfigs.get(hivePrefix + "HmsPort") | ||
| String catalog_name = "test_parquet_join_runtime_filter" | ||
|
|
||
| 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://${externalEnvIp}:${hmsPort}' | ||
| ); | ||
| """ | ||
| logger.info("catalog " + catalog_name + " created") | ||
| sql """switch ${catalog_name};""" | ||
| logger.info("switched to catalog " + catalog_name) | ||
|
|
||
| sql """ use `default` """ | ||
|
|
||
|
|
||
| for (int wait_time : [0, 10, 100]) { | ||
| sql """ set runtime_filter_wait_time_ms = ${wait_time}; """ | ||
|
|
||
| def f1 = { | ||
| def t1 = UUID.randomUUID().toString() | ||
| def sql_result = sql """ | ||
| select *, "${t1}" from fact_big as a join dim_small as b on a.k = b.k where b.c1 = 5 | ||
| """ | ||
| def filter_result = extractFilteredGroupsValue(getProfileWithToken(t1)); | ||
| logger.info("sql_result = ${sql_result}"); | ||
| logger.info("filter_result = ${filter_result}"); | ||
|
|
||
| assertTrue(filter_result.size() == 2) | ||
| assertTrue(filter_result[0] > 40) | ||
| } | ||
|
|
||
|
|
||
|
|
||
| def f2 = { | ||
| def t1 = UUID.randomUUID().toString() | ||
| def sql_result = sql """ | ||
| select *, "${t1}" from fact_big as a join dim_small as b on a.k = b.k where b.c1 in (1,2) | ||
| """ | ||
| def filter_result = extractFilteredGroupsValue(getProfileWithToken(t1)); | ||
| logger.info("sql_result = ${sql_result}"); | ||
| logger.info("filter_result = ${filter_result}"); | ||
|
|
||
| assertTrue(filter_result.size() == 2) | ||
| assertTrue(filter_result[0] > 30) | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| def f3 = { | ||
| def t1 = UUID.randomUUID().toString() | ||
| def sql_result = sql """ | ||
| select *, "${t1}" from fact_big as a join dim_small as b on a.k = b.k where b.c1 < 3 | ||
| """ | ||
| def filter_result = extractFilteredGroupsValue(getProfileWithToken(t1)); | ||
| logger.info("sql_result = ${sql_result}"); | ||
| logger.info("filter_result = ${filter_result}"); | ||
|
|
||
| assertTrue(filter_result.size() == 2) | ||
| assertTrue(filter_result[0] > 30) | ||
| } | ||
|
|
||
|
|
||
|
|
||
| def f4 = { | ||
| def t1 = UUID.randomUUID().toString() | ||
| def sql_result = sql """ | ||
| select *, "${t1}" from fact_big as a join dim_small as b on a.k = b.k where b.c2 >= 50 | ||
| """ | ||
| def filter_result = extractFilteredGroupsValue(getProfileWithToken(t1)); | ||
| logger.info("sql_result = ${sql_result}"); | ||
| logger.info("filter_result = ${filter_result}"); | ||
|
|
||
| assertTrue(filter_result.size() == 2) | ||
| assertTrue(filter_result[0] > 40) | ||
| } | ||
|
|
||
|
|
||
| f1() | ||
| f2() | ||
| f3() | ||
| f4() | ||
| } | ||
|
|
||
| sql """drop catalog ${catalog_name};""" | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving from
_lazy_read_ctxand then assigning back to it on line 416 leaves the source in a moved-from state. Consider copying these values instead of moving, or restructure to avoid the circular dependency.