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

Prevent the ORDER BY clause from being dropped in visitor transforms #420

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

dlurton
Copy link
Member

@dlurton dlurton commented Jun 15, 2021

Fixes #417

Dropping the ORDER BY clause prevents the EvaluationException from being thrown by EvaluatingCompiler due to not having evaluation support for ORDER BY, effectively ignoring the ORDER BY clause.

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

Fixes #417

Dropping the ORDER BY clause prevents the EvaluationException from
being thrown by EvaluatingCompiler due to not having evaluation
support for ORDER BY, effectively ignoring the ORDER BY clause.
@dlurton dlurton requested a review from abhikuhikar June 15, 2021 20:28
@codecov-commenter
Copy link

codecov-commenter commented Jun 15, 2021

Codecov Report

Merging #420 (9ba2ebc) into master (3b2f4ec) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #420      +/-   ##
============================================
+ Coverage     82.24%   82.29%   +0.04%     
+ Complexity     1400     1394       -6     
============================================
  Files           171      171              
  Lines         10724    10725       +1     
  Branches       1776     1769       -7     
============================================
+ Hits           8820     8826       +6     
+ Misses         1362     1358       -4     
+ Partials        542      541       -1     
Flag Coverage Δ
CLI 18.18% <ø> (ø)
EXAMPLES 74.85% <ø> (ø)
LANG 84.78% <100.00%> (+0.05%) ⬆️
PTS ∅ <ø> (∅)
TEST_SCRIPT 79.68% <ø> (ø)

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

Impacted Files Coverage Δ
...ng/src/org/partiql/lang/eval/EvaluatingCompiler.kt 84.22% <100.00%> (+0.66%) ⬆️
.../visitors/GroupByPathExpressionVisitorTransform.kt 82.43% <100.00%> (ø)
...l/lang/eval/visitors/SelectStarVisitorTransform.kt 75.00% <100.00%> (+0.39%) ⬆️
...partiql/lang/eval/visitors/VisitorTransformBase.kt 97.29% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b2f4ec...9ba2ebc. Read the comment docs.


val having = node.having?.let { currentAndUnshadowedTransformer.transformExprSelect_having(node) }

val order = node.having?.let { currentAndUnshadowedTransformer.transformExprSelect_order(node) }
Copy link
Member Author

Choose a reason for hiding this comment

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

Bug caused by:

`val order = node.having?...`

All the ?.let calls were unnecessary here anyway too...

@@ -22,6 +22,7 @@ class SelectStarVisitorTransform : VisitorTransformBase() {
where = node.where,
group = node.group,
having = node.having,
order = node.order,
Copy link
Member Author

@dlurton dlurton Jun 15, 2021

Choose a reason for hiding this comment

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

bug: this was omitted previously

FWIW, this is the one bug that would have been prevented by using the .copy function, since all we really wanted to do was replace the projection node.

@@ -40,7 +40,7 @@ abstract class VisitorTransformBase : PartiqlAst.VisitorTransform() {
val having = transformExprSelect_having(node)
val setq = transformExprSelect_setq(node)
val project = transformExprSelect_project(node)
val order = node.having?.let { transformExprSelect_order(node) }
val order = transformExprSelect_order(node)
Copy link
Member Author

Choose a reason for hiding this comment

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

similar to above. bug:

val order = node.having?.let ...

Copy link
Contributor

@almann almann left a comment

Choose a reason for hiding this comment

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

🚢

@dlurton dlurton merged commit 2b672f6 into master Jun 15, 2021
@alancai98 alancai98 deleted the dont-drop-order-by branch September 13, 2021 18:18
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.

ORDER BY is dropped by three different VisitorTransforms
3 participants