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

[pick](nereids) partition prunner evaluates "not x=const" on single no… #29359

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ public EvaluateRangeResult visitOr(Or or, EvaluateRangeInput context) {
@Override
public EvaluateRangeResult visitNot(Not not, EvaluateRangeInput context) {
EvaluateRangeResult result = evaluateChildrenThenThis(not, context);
if (result.isRejectNot()) {
if (result.isRejectNot() && !result.result.equals(BooleanLiteral.TRUE)) {
Map<Slot, ColumnRange> newRanges = Maps.newHashMap();
for (Map.Entry<Slot, ColumnRange> entry : result.childrenResult.get(0).columnRanges.entrySet()) {
Slot slot = entry.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,40 @@ suite("test_multi_range_partition") {
sql "select * from pt where not k3 < 5;"
contains "partitions=3/3 (p1,p2,p3)"
}

sql "drop table if exists tt"
sql """
CREATE TABLE `tt` (
a bigint(20) NULL,
b bigint(20) null
) ENGINE=OLAP
duplicate KEY(`a`)
COMMENT 'OLAP'
PARTITION BY RANGE(`a`, `b`)
(PARTITION p0 VALUES [("-2147483648", "-9223372036854775808"), ("5", "5")),
PARTITION p1 VALUES [("5", "5"), ("7", "7")),
PARTITION p2 VALUES [("7", "7"), ("2147483647", "2147483647000")))
DISTRIBUTED BY HASH(`b`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);
"""
sql "SET enable_nereids_planner=true"
sql "SET enable_fallback_to_original_planner=false"
sql "insert into tt values (0, 0), (6, 6), (8, 8)"
explain {
sql """SELECT
*
FROM
tt
WHERE
( NOT ( a IN ( 5 ) )
AND b BETWEEN 2 AND 13 )"""
contains "partitions=3/3 (p0,p1,p2)"
}
}
Loading