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

Being more straightforward on variables vs identifiers in the AST #1194

Closed
wants to merge 5 commits into from

Conversation

vgapeyev
Copy link
Contributor

@vgapeyev vgapeyev commented Sep 5, 2023

This is the 3rd preliminary PR towards #1122, on top of PR #1178 and PR #1187.

The AST node for a variable reference, Expr.Vr (formerly Expr.Id) now has an identifier (Id, formerly Identifier) as its field, instead of repeating the latter's fields.
There have been some comments in partiql.ion (now removed) alluding to the awkwardness of the prior situation.

There is also some renaming, for better mnemonics.

The primary change for the above is in partiql.ion and can be summarized as this:

(id                               -->          (vr
   name::symbol                   -->               id::id
   case::case_sensitivity         -->
   qualifier::scope_qualifier)                      qualifier::scope_qualifier)

(product identifier               -->          (product id
   name::symbol                   -->                symb::symbol
   case::case_sensitivity)                           case::case_sensitivity)

(product defnid symb::symbol)                  (product defnid symb::symbol)

The rest is the mechanical churn necessary to make it work.

As a reminder, the former id is a variant of the expr union, which was used for variable references. The new name vr better reflects this role. This renaming has freed id for the "bare" identifiers. (The shorter name is handy, as vr and id are used in many-many tests.)

License Information

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

In partiql.ion:
  id --> vr   [a case in (sum expr ...)]
  (product identifier name::symbol case::case_sensitivity)
  -->
  (product id         symb::symbol case::case_sensitivity)
Or, in the generated AST, have an Id as a field of Expr.Vr,
instead of having Id's fields as fields of Expr.Vr as well.
By calling Ident.normalizeRegular() instead.
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

Conformance comparison report

Base (1ece3aa) cd12122 +/-
% Passing 92.40% 92.40% 0.00%
✅ Passing 5376 5376 0
❌ Failing 442 442 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5376

Number failing in both: 442

Number passing in Base (1ece3aa) but now fail: 0

Number failing in Base (1ece3aa) but now pass: 0

@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2023

Codecov Report

Patch coverage: 86.60% and project coverage change: -0.01% ⚠️

Comparison is base (1ece3aa) 72.84% compared to head (3d28210) 72.84%.

Additional details and impacted files
@@                Coverage Diff                 @@
##             sqlid-defnid    #1194      +/-   ##
==================================================
- Coverage           72.84%   72.84%   -0.01%     
  Complexity           2352     2352              
==================================================
  Files                 221      221              
  Lines               16847    16846       -1     
  Branches             3147     3147              
==================================================
- Hits                12272    12271       -1     
  Misses               3600     3600              
  Partials              975      975              
Flag Coverage Δ
CLI 14.28% <ø> (ø)
EXAMPLES 80.28% <ø> (ø)
LANG 78.86% <86.60%> (-0.01%) ⬇️

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

Files Changed Coverage Δ
...tiql/examples/PartialEvaluationVisitorTransform.kt 92.30% <ø> (ø)
...iql-lang/src/main/kotlin/org/partiql/lang/Ident.kt 68.75% <ø> (ø)
...artiql/lang/eval/physical/operators/Accumulator.kt 85.00% <0.00%> (ø)
...tlin/org/partiql/lang/prettyprint/RecursionTree.kt 100.00% <ø> (ø)
...c/main/kotlin/org/partiql/lang/CompilerPipeline.kt 93.75% <50.00%> (ø)
...org/partiql/lang/prettyprint/QueryPrettyPrinter.kt 78.29% <50.00%> (ø)
.../visitors/GroupByPathExpressionVisitorTransform.kt 80.76% <60.00%> (-0.25%) ⬇️
...rtiql/lang/planner/transforms/plan/RelConverter.kt 66.82% <66.66%> (-0.16%) ⬇️
...sforms/LogicalToLogicalResolvedVisitorTransform.kt 93.62% <75.00%> (ø)
...planner/transforms/AstToLogicalVisitorTransform.kt 86.20% <90.00%> (-0.08%) ⬇️
... and 14 more

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

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.

3 participants