Skip to content

[hotfix][multistage] support not-in in leaf stage#9610

Merged
walterddr merged 3 commits into
apache:masterfrom
walterddr:pr_hotfix_range_search
Oct 18, 2022
Merged

[hotfix][multistage] support not-in in leaf stage#9610
walterddr merged 3 commits into
apache:masterfrom
walterddr:pr_hotfix_range_search

Conversation

@walterddr
Copy link
Copy Markdown
Contributor

@walterddr walterddr commented Oct 17, 2022

NOTIN is not supported in leaf stage as it is compiled as NOT(IN(e, v)) however this is optimized by calcute into a range search NOTIN in v2. adding this support

Copy link
Copy Markdown
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@agavra agavra Oct 17, 2022

Choose a reason for hiding this comment

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

should we also add tests for v1 like InTransformFunctionTest? also it's unclear to me how this new test relates?

Copy link
Copy Markdown
Contributor Author

@walterddr walterddr Oct 17, 2022

Choose a reason for hiding this comment

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

yeah I can add a test in v1 as well. the trick is that same column with multiple = is converted into range IN and multiple <> is converted into range NOT IN

Copy link
Copy Markdown
Contributor

@61yao 61yao Oct 17, 2022

Choose a reason for hiding this comment

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

Can we document this trick in the comments? :) +1 to have tests on the transform functions only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might want to add an explicit test in addition to the ones above (that test the functionality provided calcite rewrites) just to ensure this always works even if Calcite ever changes it's mind

@walterddr walterddr changed the title [multistage] support not-in in leaf stage [hotfix][multistage] support not-in in leaf stage Oct 17, 2022
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 17, 2022

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.79%. Comparing base (4935326) to head (60217a3).
⚠️ Report is 5530 commits behind head on master.

Files with missing lines Patch % Lines
...erator/transform/function/InTransformFunction.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #9610      +/-   ##
============================================
- Coverage     63.83%   63.79%   -0.05%     
+ Complexity     5267     4922     -345     
============================================
  Files          1888     1886       -2     
  Lines        101218   101222       +4     
  Branches      15427    15433       +6     
============================================
- Hits          64617    64574      -43     
- Misses        31869    31919      +50     
+ Partials       4732     4729       -3     
Flag Coverage Δ
unittests1 67.31% <93.75%> (-0.06%) ⬇️
unittests2 15.61% <0.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
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 otherwise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to add the second one because they will be canonicalized to the same value

Suggested change
NOT_IN("not_in", "notin"),
NOT_IN("not_in"),

Comment on lines 60 to 61
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same for other changes

Suggested change
Preconditions.checkArgument(numArguments >= 2, "At least 2 arguments are required for ["
+ getName() + "] transform function: expression, values");
Preconditions.checkArgument(numArguments >= 2, "At least 2 arguments are required for [%s] transform function: expression, values", getName());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
intValuesSV[i] = intValuesSV[i] == 0 ? 1 : 0;
intValuesSV[i] = 1 - intValuesSV[i];

@walterddr walterddr force-pushed the pr_hotfix_range_search branch from 3e33485 to 60217a3 Compare October 17, 2022 22:48
}
}
@Test
public void testIntNotInTransformFunction() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a e2e query execution test ? May be in one of the subclasses of BaseQueriesTest or TransformQueriesTest ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's a bit hard b/c it will be rewrite as NOT(IN(...)) as stated in the description.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. I am ok with merging though

@siddharthteotia siddharthteotia added the multi-stage Related to the multi-stage query engine label Oct 18, 2022
@walterddr walterddr merged commit 6b3689c into apache:master Oct 18, 2022
@walterddr walterddr deleted the pr_hotfix_range_search branch December 6, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multi-stage Related to the multi-stage query engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants