-
Notifications
You must be signed in to change notification settings - Fork 62
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
Migrate SelectListItemAliasRewriter to PartiqlAst.VisitorTransform #298
Migrate SelectListItemAliasRewriter to PartiqlAst.VisitorTransform #298
Conversation
lang/src/org/partiql/lang/eval/visitors/SelectListItemAliasVisitorTransform.kt
Show resolved
Hide resolved
lang/test/org/partiql/lang/eval/visitors/SelectListItemAliasVisitorTransformTests.kt
Show resolved
Hide resolved
lang/src/org/partiql/lang/eval/visitors/SelectListItemAliasVisitorTransform.kt
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## visitor-transforms #298 +/- ##
========================================================
- Coverage 82.49% 82.44% -0.05%
Complexity 1218 1218
========================================================
Files 157 159 +2
Lines 9264 9290 +26
Branches 1513 1519 +6
========================================================
+ Hits 7642 7659 +17
- Misses 1170 1176 +6
- Partials 452 455 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
lang/test/org/partiql/lang/eval/visitors/SelectListItemAliasVisitorTransformTests.kt
Show resolved
Hide resolved
* FROM bar AS b | ||
* ``` | ||
* | ||
* If provided with a query with all of the select list aliases are already specified, an exact clone is returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's open an issue to opt-out when we have a query that already has AS aliases defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear to me who is doing the opting out. The partiql service? Or should the VisitorTransform
implementation itself detect if there is work to be done? Detecting if there is work to be done for all input queries may be more expensive than just doing the rewrite... However, if the user knows they've supplied a query with all of the AS
aliases specified then is your suggestion to provide a way for the user to cause this transform to be skipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking. I am not sure about your statement "Detecting if there is work to be done for all input queries may be more expensive than just doing the rewrite". Wouldn't it be cheaper to grab all select nodes and check that each input has an AS
name rather than copying trees?
Another idea is to add to our parser the task to keep track of aliases in select clauses and pass a flag as metadata on the root node.
Also:
AstRewriterBase
implementations to be migrated one by one, namely:RewriterTransformBridge
..toAstStatement()
extension function not copying metas over correctly. This caused some negative unit test failures because line & column numbers of the errors were not being included.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.