Skip to content

Comments

Tests for CASE/WHEN query with NULL support#11395

Merged
Jackie-Jiang merged 6 commits intoapache:masterfrom
abhioncbr:literal-null-support
Aug 22, 2023
Merged

Tests for CASE/WHEN query with NULL support#11395
Jackie-Jiang merged 6 commits intoapache:masterfrom
abhioncbr:literal-null-support

Conversation

@abhioncbr
Copy link
Contributor

@abhioncbr abhioncbr commented Aug 20, 2023

This PR is for the issue

  • enables ENABLE_NULL_HANDLING for multistage query testing.
  • Added multiple case/when queries with null literal function case.

cc: @shenyu0127, @Jackie-Jiang

@codecov-commenter
Copy link

codecov-commenter commented Aug 20, 2023

Codecov Report

Merging #11395 (43c6c2c) into master (575398d) will increase coverage by 1.41%.
Report is 17 commits behind head on master.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master   #11395      +/-   ##
============================================
+ Coverage     61.46%   62.88%   +1.41%     
+ Complexity     6514      207    -6307     
============================================
  Files          2233     2300      +67     
  Lines        120144   123622    +3478     
  Branches      18234    18796     +562     
============================================
+ Hits          73848    77740    +3892     
+ Misses        40882    40356     -526     
- Partials       5414     5526     +112     
Flag Coverage Δ
integration <0.01% <ø> (?)
integration1 <0.01% <ø> (+<0.01%) ⬆️
integration2 0.00% <ø> (ø)
java-11 62.86% <ø> (+1.41%) ⬆️
java-17 49.73% <ø> (-11.57%) ⬇️
java-20 62.74% <ø> (+1.41%) ⬆️
temurin 62.88% <ø> (+1.41%) ⬆️
unittests 62.88% <ø> (?)
unittests1 67.40% <ø> (+0.40%) ⬆️
unittests2 14.51% <ø> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 347 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@abhioncbr abhioncbr closed this Aug 20, 2023
@abhioncbr abhioncbr reopened this Aug 20, 2023
@Jackie-Jiang Jackie-Jiang added bugfix multi-stage Related to the multi-stage query engine and removed multi-stage Related to the multi-stage query engine labels Aug 21, 2023
@Jackie-Jiang Jackie-Jiang changed the title [multistage]: CASE/WHEN query with NULL support CASE/WHEN query with NULL support Aug 21, 2023
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shenyu0127 Please also take a look

}
if (!unselectedDocs.isEmpty()) {
if (_elseStatement == null) {
if (_elseStatement == null || LiteralTransformFunction.isNullLiteralTransform(_elseStatement)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To simplify this, we can change constructStatementListCalcite() (also change constructStatementListLegacy() for backward compatible) to set _elseStatement to null when it is null literal

/*
* Util function to check whether the Literal transform is null or not.
*/
public static boolean isNullLiteralTransform(TransformFunction function) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest adding boolean isNull() instead. Checking _dataType itself should be enough (consistent with getNullBitmap())

@shenyu0127
Copy link
Contributor

Without this PR, the query SELECT CASE WHEN boolCol = true THEN 'Yes' also returns NULL if boolCol is NULL or false. Is the purpose of this PR only to improve performance? If that's the case, we can simply re-enable the ignored query.

@abhioncbr
Copy link
Contributor Author

Without this PR, the query SELECT CASE WHEN boolCol = true THEN 'Yes' also returns NULL if boolCol is NULL or false. Is the purpose of this PR only to improve performance? If that's the case, we can simply re-enable the ignored query.

Initially, when I started looking a couple of months back, it was an issue, but as of now, it is more or less a performance improvement and enabling the ignored queries. Please let me know if we can drop the performance improvement changes. Thanks

@shenyu0127
Copy link
Contributor

Without this PR, the query SELECT CASE WHEN boolCol = true THEN 'Yes' also returns NULL if boolCol is NULL or false. Is the purpose of this PR only to improve performance? If that's the case, we can simply re-enable the ignored query.

Initially, when I started looking a couple of months back, it was an issue, but as of now, it is more or less a performance improvement and enabling the ignored queries. Please let me know if we can drop the performance improvement changes. Thanks

I see. Please drop the performance improvement changes.

@abhioncbr
Copy link
Contributor Author

Without this PR, the query SELECT CASE WHEN boolCol = true THEN 'Yes' also returns NULL if boolCol is NULL or false. Is the purpose of this PR only to improve performance? If that's the case, we can simply re-enable the ignored query.

Initially, when I started looking a couple of months back, it was an issue, but as of now, it is more or less a performance improvement and enabling the ignored queries. Please let me know if we can drop the performance improvement changes. Thanks

I see. Please drop the performance improvement changes.

Just out of curiosity, any particular reason for not having the performance logic?

@shenyu0127
Copy link
Contributor

Without this PR, the query SELECT CASE WHEN boolCol = true THEN 'Yes' also returns NULL if boolCol is NULL or false. Is the purpose of this PR only to improve performance? If that's the case, we can simply re-enable the ignored query.

Initially, when I started looking a couple of months back, it was an issue, but as of now, it is more or less a performance improvement and enabling the ignored queries. Please let me know if we can drop the performance improvement changes. Thanks

I see. Please drop the performance improvement changes.

Just out of curiosity, any particular reason for not having the performance logic?

We prefer one PR to do one simple thing.

  • If it's to fix the bug and re-enable the ignored query, the two changes are closely related and can be put one PR.
  • If it's to improve performance and re-enable the ignored query, the two changes are not related and can be put in two PRs separately. Putting these two things in one PR causes confusion to the reviewer.

@abhioncbr
Copy link
Contributor Author

As suggested, diving this PR into two

  • for enabling the ignored query
  • for performance changes.
    Thanks

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Could you revise the title and description for the PR accordingly?

@abhioncbr abhioncbr changed the title CASE/WHEN query with NULL support Tests for CASE/WHEN query with NULL support Aug 22, 2023
Copy link
Contributor

@shenyu0127 shenyu0127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Jackie-Jiang Jackie-Jiang merged commit adbfd23 into apache:master Aug 22, 2023
@abhioncbr abhioncbr deleted the literal-null-support branch April 25, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants