-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[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
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. |
run buildall |
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
|
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.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
…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'; ```
…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'; ```
…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'; ```
…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'; ```
…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'; ```
…related functions in parquet and orc reader by disabling dictionary filtering when predicates contain functions apache#35335 (apache#35514)
…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 | +------------------------+ ```
…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 | +------------------------+ ```
…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 | +------------------------+ ```
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...