Skip to content
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

[BugFix] handle null value in dict colum in parquet file #25800

Merged
merged 19 commits into from
Jun 30, 2023

Conversation

dirtysalt
Copy link
Contributor

Fixes #issue

This PR is to fix dict filtering when null value in dict column.

Right now we intercept is_null function(on top) on dict column, however, that's not enough. Because for some predicates like (c = 'a' or c is null) or coalesce(c, 'a'), there is no is_null function on top, there is is_null function inside.

So the right way to handle null value, is to evaluate null value in conjuncts.

TODO: add UT to cover predicates like above and is_null function on top.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.1
    • 3.0
    • 2.5
    • 2.4

@dirtysalt dirtysalt enabled auto-merge (squash) June 25, 2023 04:52
build.sh Outdated Show resolved Hide resolved
@dirtysalt
Copy link
Contributor Author

The test case is too flaky in the CI test. I'll submit another PR to add test cases.

It's because oss is not well supported in sql-tester right now. I'll submit another PR to fix that.

Youngwb
Youngwb previously approved these changes Jun 27, 2023
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
@dirtysalt
Copy link
Contributor Author

another implementation

-------------------------------------------------------------
Benchmark                   Time             CPU   Iterations
-------------------------------------------------------------
BM_DictDecoder/0        0.013 ms        0.013 ms        52330
BM_DictDecoder/10       0.017 ms        0.017 ms        40683
BM_DictDecoder/20       0.018 ms        0.018 ms        38447
BM_DictDecoder/30       0.018 ms        0.018 ms        39328
BM_DictDecoder/40       0.017 ms        0.017 ms        38572
BM_DictDecoder/50       0.018 ms        0.018 ms        37454
BM_DictDecoder/60       0.018 ms        0.018 ms        38174
BM_DictDecoder/70       0.017 ms        0.017 ms        40298
BM_DictDecoder/80       0.017 ms        0.017 ms        40637
BM_DictDecoder/90       0.017 ms        0.017 ms        42525
BM_DictDecoder/100      0.012 ms        0.012 ms        58747

Signed-off-by: yanz <dirtysalt1987@gmail.com>
@dirtysalt
Copy link
Contributor Author

after saving a branch, a little better

-------------------------------------------------------------
Benchmark                   Time             CPU   Iterations
-------------------------------------------------------------
BM_DictDecoder/0        0.014 ms        0.014 ms        51400
BM_DictDecoder/10       0.016 ms        0.016 ms        45682
BM_DictDecoder/20       0.015 ms        0.015 ms        46104
BM_DictDecoder/30       0.015 ms        0.015 ms        46383
BM_DictDecoder/40       0.015 ms        0.015 ms        46376
BM_DictDecoder/50       0.015 ms        0.015 ms        45959
BM_DictDecoder/60       0.015 ms        0.015 ms        45928
BM_DictDecoder/70       0.015 ms        0.015 ms        46383
BM_DictDecoder/80       0.015 ms        0.015 ms        46571
BM_DictDecoder/90       0.015 ms        0.015 ms        46623
BM_DictDecoder/100      0.013 ms        0.014 ms        51097

Signed-off-by: yanz <dirtysalt1987@gmail.com>
Signed-off-by: yanz <dirtysalt1987@gmail.com>
Youngwb
Youngwb previously approved these changes Jun 30, 2023
Signed-off-by: yanz <dirtysalt1987@gmail.com>
@wanpengfei-git
Copy link
Collaborator

[FE PR Coverage Check]

😍 pass : 0 / 0 (0%)

@dirtysalt dirtysalt merged commit a0a54ac into StarRocks:main Jun 30, 2023
25 checks passed
@dirtysalt
Copy link
Contributor Author

@Mergifyio backport branch-3.1

@mergify
Copy link
Contributor

mergify bot commented Jun 30, 2023

backport branch-3.1

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 30, 2023
This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.

(cherry picked from commit a0a54ac)

# Conflicts:
#	be/src/bench/CMakeLists.txt
wanpengfei-git pushed a commit that referenced this pull request Jun 30, 2023
This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.

(cherry picked from commit a0a54ac)

# Conflicts:
#	be/src/bench/CMakeLists.txt
JackeyLee007 pushed a commit to JackeyLee007/starrocks that referenced this pull request Jul 1, 2023
…5800)

This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.
JackeyLee007 pushed a commit to JackeyLee007/starrocks that referenced this pull request Jul 1, 2023
…5800)

This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.
mergify bot pushed a commit that referenced this pull request Jul 2, 2023
This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.

(cherry picked from commit a0a54ac)

# Conflicts:
#	be/src/bench/CMakeLists.txt
(cherry picked from commit 47771bf)

# Conflicts:
#	be/src/bench/CMakeLists.txt
#	be/src/bench/parquet_writer_array_bench.cpp
#	be/src/bench/parquet_writer_bench.cpp
wanpengfei-git pushed a commit that referenced this pull request Jul 2, 2023
This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.

(cherry picked from commit a0a54ac)

# Conflicts:
#	be/src/bench/CMakeLists.txt
(cherry picked from commit 47771bf)

# Conflicts:
#	be/src/bench/CMakeLists.txt
#	be/src/bench/parquet_writer_array_bench.cpp
#	be/src/bench/parquet_writer_bench.cpp
@dirtysalt
Copy link
Contributor Author

@mergify backport branch-2.5

@mergify
Copy link
Contributor

mergify bot commented Jul 2, 2023

backport branch-2.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 2, 2023
This PR is to fix dict filtering when null value in dict column.

Right now we intercept `is_null` function(on top) on dict column,
however, that's not enough. Because for some predicates like `(c = 'a'
or c is null)` or `coalesce(c, 'a')`, there is no `is_null` function on
top, there is `is_null` function inside.

So the right way to handle null value, is to evaluate null value in
conjuncts.

(cherry picked from commit a0a54ac)

# Conflicts:
#	be/src/bench/CMakeLists.txt
#	be/src/bench/parquet_writer_array_bench.cpp
#	be/src/bench/parquet_writer_bench.cpp
#	be/src/formats/parquet/column_chunk_reader.h
#	be/src/formats/parquet/column_reader.cpp
#	be/src/formats/parquet/column_reader.h
#	be/src/formats/parquet/encoding.h
#	be/src/formats/parquet/encoding_dict.h
#	be/src/formats/parquet/group_reader.cpp
#	be/src/formats/parquet/stored_column_reader.h
#	test/lib/choose_cases.py
#	test/lib/skip.py
@dirtysalt dirtysalt deleted the fix-or-predicate branch July 3, 2023 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants