-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](simplify range) no merge compound value with different references #59671
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](simplify range) no merge compound value with different references #59671
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 31416 ms |
TPC-DS: Total hot run time: 172191 ms |
ClickBench: Total hot run time: 26.84 s |
|
run buildall |
TPC-H: Total hot run time: 32043 ms |
TPC-DS: Total hot run time: 171909 ms |
|
run cloud_p0 |
FE UT Coverage ReportIncrement line coverage |
FE Regression Coverage ReportIncrement line coverage |
|
run vault_p0 |
|
PR approved by at least one committer and no changes requested. |
|
run nonConcurrent |
FE Regression Coverage ReportIncrement line coverage |
…es (apache#59671) simplify range have exception: mysql > explain select pk from table_0_500_undef_partitions2_keys3_properties4_distributed_by5 where not ( date_sub(col_date_undef_signed, interval 1 day) > '2010-03-21' or null ) or lower(col_varchar_20__undef_signed) between null and 'e'; (1105, "errCode = 2, detailMessage = Cannot compare two values with different data types: 2010-03-22 (DATEV2) vs 'e' (VARCHAR(1))") PR apache#57537 introduce merging compound value with other value desc. when merge value desc, it will merge values with the same reference. but for compound value, its reference have other meaning: 1) a < 1 or a > 10, this is a compound value, its reference is a; 2) a < 1 or b > 10, this is a compound value, its reference is 'a < 1 or b > 10'. then for expression `TA > 1 and FALSE or FALSE and SB > 'abc''`, for the operator OR, it will have two compound values: a. C1 = CompoundValue(referece = getCompoundExpression(TA > 1 and FALSE) = FALSE, source values={TA > 1, FALSE}) b. C2 = CompoundValue(reference = getCompoundExpression(FALSE and SB > 'abc') = FALSE, source values={FALSE, SB > 'abc'}) because the function getCompoundExpression will fold constant, then C1 andC2's referece will be 'FALSE', and since C1 and C2's reference equals, then will try merge C1 and C2, then will check merge ' > 1' and ' > abc' will cause the above exception. to fix this, for a compound value if its source values different reference (like a < 1 or b > 10), then don't merge it with other values descs.
…es (apache#59671) simplify range have exception: mysql > explain select pk from table_0_500_undef_partitions2_keys3_properties4_distributed_by5 where not ( date_sub(col_date_undef_signed, interval 1 day) > '2010-03-21' or null ) or lower(col_varchar_20__undef_signed) between null and 'e'; (1105, "errCode = 2, detailMessage = Cannot compare two values with different data types: 2010-03-22 (DATEV2) vs 'e' (VARCHAR(1))") PR apache#57537 introduce merging compound value with other value desc. when merge value desc, it will merge values with the same reference. but for compound value, its reference have other meaning: 1) a < 1 or a > 10, this is a compound value, its reference is a; 2) a < 1 or b > 10, this is a compound value, its reference is 'a < 1 or b > 10'. then for expression `TA > 1 and FALSE or FALSE and SB > 'abc''`, for the operator OR, it will have two compound values: a. C1 = CompoundValue(referece = getCompoundExpression(TA > 1 and FALSE) = FALSE, source values={TA > 1, FALSE}) b. C2 = CompoundValue(reference = getCompoundExpression(FALSE and SB > 'abc') = FALSE, source values={FALSE, SB > 'abc'}) because the function getCompoundExpression will fold constant, then C1 andC2's referece will be 'FALSE', and since C1 and C2's reference equals, then will try merge C1 and C2, then will check merge ' > 1' and ' > abc' will cause the above exception. to fix this, for a compound value if its source values different reference (like a < 1 or b > 10), then don't merge it with other values descs.
…es (apache#59671) simplify range have exception: mysql > explain select pk from table_0_500_undef_partitions2_keys3_properties4_distributed_by5 where not ( date_sub(col_date_undef_signed, interval 1 day) > '2010-03-21' or null ) or lower(col_varchar_20__undef_signed) between null and 'e'; (1105, "errCode = 2, detailMessage = Cannot compare two values with different data types: 2010-03-22 (DATEV2) vs 'e' (VARCHAR(1))") PR apache#57537 introduce merging compound value with other value desc. when merge value desc, it will merge values with the same reference. but for compound value, its reference have other meaning: 1) a < 1 or a > 10, this is a compound value, its reference is a; 2) a < 1 or b > 10, this is a compound value, its reference is 'a < 1 or b > 10'. then for expression `TA > 1 and FALSE or FALSE and SB > 'abc''`, for the operator OR, it will have two compound values: a. C1 = CompoundValue(referece = getCompoundExpression(TA > 1 and FALSE) = FALSE, source values={TA > 1, FALSE}) b. C2 = CompoundValue(reference = getCompoundExpression(FALSE and SB > 'abc') = FALSE, source values={FALSE, SB > 'abc'}) because the function getCompoundExpression will fold constant, then C1 andC2's referece will be 'FALSE', and since C1 and C2's reference equals, then will try merge C1 and C2, then will check merge ' > 1' and ' > abc' will cause the above exception. to fix this, for a compound value if its source values different reference (like a < 1 or b > 10), then don't merge it with other values descs.
…es (apache#59671) simplify range have exception: mysql > explain select pk from table_0_500_undef_partitions2_keys3_properties4_distributed_by5 where not ( date_sub(col_date_undef_signed, interval 1 day) > '2010-03-21' or null ) or lower(col_varchar_20__undef_signed) between null and 'e'; (1105, "errCode = 2, detailMessage = Cannot compare two values with different data types: 2010-03-22 (DATEV2) vs 'e' (VARCHAR(1))") PR apache#57537 introduce merging compound value with other value desc. when merge value desc, it will merge values with the same reference. but for compound value, its reference have other meaning: 1) a < 1 or a > 10, this is a compound value, its reference is a; 2) a < 1 or b > 10, this is a compound value, its reference is 'a < 1 or b > 10'. then for expression `TA > 1 and FALSE or FALSE and SB > 'abc''`, for the operator OR, it will have two compound values: a. C1 = CompoundValue(referece = getCompoundExpression(TA > 1 and FALSE) = FALSE, source values={TA > 1, FALSE}) b. C2 = CompoundValue(reference = getCompoundExpression(FALSE and SB > 'abc') = FALSE, source values={FALSE, SB > 'abc'}) because the function getCompoundExpression will fold constant, then C1 andC2's referece will be 'FALSE', and since C1 and C2's reference equals, then will try merge C1 and C2, then will check merge ' > 1' and ' > abc' will cause the above exception. to fix this, for a compound value if its source values different reference (like a < 1 or b > 10), then don't merge it with other values descs.
simplify range have exception:
PR #57537 introduce merging compound value with other value desc.
when merge value desc, it will merge values with the same reference.
but for compound value, its reference have other meaning:
then for expression
TA > 1 and FALSE or FALSE and SB > 'abc'', for the operator OR, it will have two compound values:a. C1 = CompoundValue(referece = getCompoundExpression(TA > 1 and FALSE) = FALSE, source values={TA > 1, FALSE})
b. C2 = CompoundValue(reference = getCompoundExpression(FALSE and SB > 'abc') = FALSE, source values={FALSE, SB > 'abc'})
because the function getCompoundExpression will fold constant, then C1 andC2's referece will be 'FALSE', and since C1 and C2's reference equals, then will try merge C1 and C2, then will check merge ' > 1' and ' > abc' will cause the above exception.
to fix this, for a compound value if its source values different reference (like a < 1 or b > 10), then don't merge it with other values descs.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)