[Fix](multi-catalog) Fix string dictionary filtering when using null related functions in parquet and orc reader by disabling dictionary filtering when predicates contain functions.#35335
Merged
morningman merged 1 commit intoapache:masterfrom May 27, 2024
Conversation
…function in parquet and orc reader.
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
Contributor
Author
|
run buildall |
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
TPC-H: Total hot run time: 39799 ms |
|
TeamCity be ut coverage result: |
TPC-DS: Total hot run time: 169494 ms |
ClickBench: Total hot run time: 30.57 s |
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
zy-kkk
approved these changes
May 26, 2024
dataroaring
pushed a commit
that referenced
this pull request
May 27, 2024
…function in parquet and orc reader. (#35335) The following sql and when the dictionary column contains functions related to null, the results will be incorrect. ``` select * from ( select IF(o_orderpriority IS NULL, 'null', o_orderpriority) AS o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = 'null'; ``` ``` select * from ( select IFNULL(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null' ``` ``` select * from ( select COALESCE(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null'; ```
yiguolei
pushed a commit
that referenced
this pull request
May 27, 2024
…function in parquet and orc reader. (#35335) The following sql and when the dictionary column contains functions related to null, the results will be incorrect. ``` select * from ( select IF(o_orderpriority IS NULL, 'null', o_orderpriority) AS o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = 'null'; ``` ``` select * from ( select IFNULL(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null' ``` ``` select * from ( select COALESCE(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null'; ```
seawinde
pushed a commit
to seawinde/doris
that referenced
this pull request
May 27, 2024
…function in parquet and orc reader. (apache#35335) The following sql and when the dictionary column contains functions related to null, the results will be incorrect. ``` select * from ( select IF(o_orderpriority IS NULL, 'null', o_orderpriority) AS o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = 'null'; ``` ``` select * from ( select IFNULL(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null' ``` ``` select * from ( select COALESCE(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null'; ```
kaka11chen
added a commit
to kaka11chen/doris
that referenced
this pull request
May 28, 2024
…function in parquet and orc reader. (apache#35335) The following sql and when the dictionary column contains functions related to null, the results will be incorrect. ``` select * from ( select IF(o_orderpriority IS NULL, 'null', o_orderpriority) AS o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = 'null'; ``` ``` select * from ( select IFNULL(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null' ``` ``` select * from ( select COALESCE(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null'; ```
kaka11chen
added a commit
to kaka11chen/doris
that referenced
this pull request
May 28, 2024
…function in parquet and orc reader. (apache#35335) The following sql and when the dictionary column contains functions related to null, the results will be incorrect. ``` select * from ( select IF(o_orderpriority IS NULL, 'null', o_orderpriority) AS o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = 'null'; ``` ``` select * from ( select IFNULL(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null' ``` ``` select * from ( select COALESCE(o_orderpriority, 'null') AS o_orderpriority from test_string_dict_filter_parquet ) as A where o_orderpriority = 'null'; ```
Closed
mongo360
pushed a commit
to mongo360/doris
that referenced
this pull request
Aug 16, 2024
…related functions in parquet and orc reader by disabling dictionary filtering when predicates contain functions apache#35335 (apache#35514)
morningman
pushed a commit
that referenced
this pull request
Oct 21, 2024
…te express is not slot (#42113) ## Proposed changes follow up #35335 When the `"case when ... then ... when ... then ... else"` occurs, function_expr may not exist in the pushed down predicate, but the handling of null values is still problematic. table data: ```text mysql> select o_orderpriority from test_string_dict_filter_orc; +-----------------+ | o_orderpriority | +-----------------+ | 5-LOW | | 1-URGENT | | 5-LOW | | NULL | | 5-LOW | +-----------------+ ``` before: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 4 | +------------------------+ ``` after: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 5 | +------------------------+ ```
morningman
pushed a commit
to morningman/doris
that referenced
this pull request
Oct 21, 2024
…te express is not slot (apache#42113) ## Proposed changes follow up apache#35335 When the `"case when ... then ... when ... then ... else"` occurs, function_expr may not exist in the pushed down predicate, but the handling of null values is still problematic. table data: ```text mysql> select o_orderpriority from test_string_dict_filter_orc; +-----------------+ | o_orderpriority | +-----------------+ | 5-LOW | | 1-URGENT | | 5-LOW | | NULL | | 5-LOW | +-----------------+ ``` before: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 4 | +------------------------+ ``` after: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 5 | +------------------------+ ```
morningman
pushed a commit
to morningman/doris
that referenced
this pull request
Oct 21, 2024
…te express is not slot (apache#42113) ## Proposed changes follow up apache#35335 When the `"case when ... then ... when ... then ... else"` occurs, function_expr may not exist in the pushed down predicate, but the handling of null values is still problematic. table data: ```text mysql> select o_orderpriority from test_string_dict_filter_orc; +-----------------+ | o_orderpriority | +-----------------+ | 5-LOW | | 1-URGENT | | 5-LOW | | NULL | | 5-LOW | +-----------------+ ``` before: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 4 | +------------------------+ ``` after: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 5 | +------------------------+ ```
GoGoWen
pushed a commit
to GoGoWen/incubator-doris
that referenced
this pull request
Sep 26, 2025
…te express is not slot (apache#42113) ## Proposed changes follow up apache#35335 When the `"case when ... then ... when ... then ... else"` occurs, function_expr may not exist in the pushed down predicate, but the handling of null values is still problematic. table data: ```text mysql> select o_orderpriority from test_string_dict_filter_orc; +-----------------+ | o_orderpriority | +-----------------+ | 5-LOW | | 1-URGENT | | 5-LOW | | NULL | | 5-LOW | +-----------------+ ``` before: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 4 | +------------------------+ ``` after: ```text mysql> select count(o_orderpriority) from ( select (case when o_orderpriority = 'x' then '1' when o_orderpriority = 'y' then '2' else '0' end) as o_orderpriority from test_string_dict_filter_orc ) as A where o_orderpriority = '0'; +------------------------+ | count(o_orderpriority) | +------------------------+ | 5 | +------------------------+ ```
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
Issue
The following sql and when the dictionary column contains functions related to null, the results will be incorrect.
Root cause:
The current implementation of dictionary filtering does not take into account the implementation of NULL values because the dictionary itself does not contain NULL value encoding. As a result, many NULL-related functions or expressions cannot work properly, such as
is null,is not null,coalesce, etc.Solution
Here we first disable dictionary filtering when predicate contains functions. Implementation of NULL value dictionary filtering will be carried out later.
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...