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

Bitwise and plan typer and WIki. #1232

Merged
merged 7 commits into from
Sep 28, 2023
Merged

Bitwise and plan typer and WIki. #1232

merged 7 commits into from
Sep 28, 2023

Conversation

yliuuuu
Copy link
Contributor

@yliuuuu yliuuuu commented Sep 28, 2023

Relevant Issues

Description

  • Type Inferencer for Bitwise And.
  • Wiki Page explaining semantics for bitwise and operator.

Other Information

  • Updated Unreleased Section in CHANGELOG: [YES/NO]

    • Yes.
  • Any backward-incompatible changes? [YES/NO]

    • No.
  • Any new external dependencies? [YES/NO]

    • No.
  • Do your changes comply with the Contributing Guidelines
    and Code Style Guidelines? [YES/NO]
    No.

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yliuuuu yliuuuu changed the title Bitwise and plan Bitwise and plan typer and WIki. Sep 28, 2023
@github-actions
Copy link

github-actions bot commented Sep 28, 2023

Conformance comparison report

Base (4e2a184) 8a06047 +/-
% Passing 92.33% 92.33% 0.00%
✅ Passing 5372 5372 0
❌ Failing 446 446 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5372

Number failing in both: 446

Number passing in Base (4e2a184) but now fail: 0

Number failing in Base (4e2a184) but now pass: 0

alancai98
alancai98 previously approved these changes Sep 28, 2023
Copy link
Member

@alancai98 alancai98 left a comment

Choose a reason for hiding this comment

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

Looks good! Minor comments and some additional tests you could add

: Else return `INT2` type.

Note:
: Type precedence of the bitwise operator is lower than the plus/minus operator and higher than the predicates.
Copy link
Member

Choose a reason for hiding this comment

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

Could link the partiql-docs issue since this could change: https://github.com/partiql/partiql-docs/issues/50.

CHANGELOG.md Outdated Show resolved Hide resolved
query = "CAST(1 AS INT8) & 2",
expected = StaticType.unionOf(StaticType.INT, MISSING)
),

Copy link
Member

Choose a reason for hiding this comment

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

nice set of tests! could also add

  • test w/ null propagation (1 & NULL) -> NULL
  • test w/ missing propagation (1 & MISSING) -> MISSING and (NULL & MISSING) -> MISSING
  • data type mismatch (1 & 'non-int') -> error and output type of union of int types

@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (4e2a184) 70.67% compared to head (642c6d1) 70.80%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1232      +/-   ##
============================================
+ Coverage     70.67%   70.80%   +0.12%     
- Complexity     2335     2353      +18     
============================================
  Files           229      229              
  Lines         17382    17393      +11     
  Branches       3199     3201       +2     
============================================
+ Hits          12285    12315      +30     
+ Misses         4109     4092      -17     
+ Partials        988      986       -2     
Flag Coverage Δ
CLI 13.70% <ø> (ø)
EXAMPLES 80.28% <ø> (ø)
LANG 77.93% <81.81%> (+0.14%) ⬆️

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

Files Coverage Δ
...rtiql/lang/planner/transforms/plan/RexConverter.kt 55.45% <100.00%> (+1.93%) ⬆️
.../partiql/lang/planner/transforms/plan/PlanTyper.kt 53.66% <33.33%> (+1.54%) ⬆️

... and 1 file with indirect coverage changes

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

@yliuuuu yliuuuu merged commit acd74ab into main Sep 28, 2023
10 checks passed
@yliuuuu yliuuuu deleted the bitwise_and_plan branch September 28, 2023 21:11
@RCHowell
Copy link
Member

I'm a bit late to the party, but 1 & NULL isn't an error. It's an odd query and would be constant folded to NULL, but it shouldn't be an error as the tests suggest. In fact, the error "value is always null or missing" probably doesn't make sense in most contexts.

@yliuuuu
Copy link
Contributor Author

yliuuuu commented Sep 28, 2023

I'm a bit late to the party, but 1 & NULL isn't an error. It's an odd query and would be constant folded to NULL, but it shouldn't be an error as the tests suggest. In fact, the error "value is always null or missing" probably doesn't make sense in most contexts.

+1 on that. Loop in @johnedquinn for more context on the error ExpressionAlwaysReturnsNullOrMissing

@johnedquinn
Copy link
Member

Yeah, it's an artifact from the behavior of the StaticTypeInferencer. I do think it's a useful warning, though it's misclassified as a ProblemSeverity of ERROR. Should probably be WARNING.

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.

5 participants