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

[v1] Add AST factory methods; some fixes to AST classes #1622

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

alancai98
Copy link
Member

Relevant Issues

Description

  • Adds factory methods for every hand-written AST class
  • Fixes some AST classes/functions
    • Add constructors for some classes
    • Fix naming of visitSelectItemAll -> visitSelectItemStar
    • Change @NotNull Long -> long

Other Information

  • Updated Unreleased Section in CHANGELOG: [NO]

    • No, targeting v1 branch
  • Any backward-incompatible changes? [YES]

    • Yes but on v1 branch
  • Any new external dependencies? [NO]

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

License Information

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

Copy link

github-actions bot commented Oct 17, 2024

CROSS-ENGINE-REPORT ❌

BASE (LEGACY-V0.14.8) TARGET (EVAL-7419125) +/-
% Passing 89.67% 94.22% 4.55% ✅
Passing 5287 5555 268 ✅
Failing 609 54 -555 ✅
Ignored 0 287 287 🔶
Total Tests 5896 5896 0 ✅

Testing Details

  • Base Commit: v0.14.8
  • Base Engine: LEGACY
  • Target Commit: 7419125
  • Target Engine: EVAL

Result Details

  • ❌ REGRESSION DETECTED. See Now Failing/Ignored Tests. ❌
  • Passing in both: 2642
  • Failing in both: 18
  • Ignored in both: 0
  • PASSING in BASE but now FAILING in TARGET: 1
  • PASSING in BASE but now IGNORED in TARGET: 111
  • FAILING in BASE but now PASSING in TARGET: 179
  • IGNORED in BASE but now PASSING in TARGET: 0

Now FAILING Tests ❌

The following 1 test(s) were previously PASSING in BASE but are now FAILING in TARGET:

Click here to see
  1. data type mismatch in logical expression, compileOption: PERMISSIVE

Now IGNORED Tests ❌

The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

Now Passing Tests

179 test(s) were previously failing in BASE (LEGACY-V0.14.8) but now pass in TARGET (EVAL-7419125). Before merging, confirm they are intended to pass.

The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

CROSS-COMMIT-REPORT ✅

BASE (EVAL-F2897A5) TARGET (EVAL-7419125) +/-
% Passing 94.22% 94.22% 0.00% ✅
Passing 5555 5555 0 ✅
Failing 54 54 0 ✅
Ignored 287 287 0 ✅
Total Tests 5896 5896 0 ✅

Testing Details

  • Base Commit: f2897a5
  • Base Engine: EVAL
  • Target Commit: 7419125
  • Target Engine: EVAL

Result Details

  • Passing in both: 5555
  • Failing in both: 54
  • Ignored in both: 287
  • PASSING in BASE but now FAILING in TARGET: 0
  • PASSING in BASE but now IGNORED in TARGET: 0
  • FAILING in BASE but now PASSING in TARGET: 0
  • IGNORED in BASE but now PASSING in TARGET: 0

@@ -36,6 +36,8 @@ public <R, C> R accept(@NotNull AstVisitor<R, C> visitor, C ctx) {
*/
@Builder(builderClassName = "Builder")
public static class AnyShortest extends GraphSelector {
public AnyShortest() {}
Copy link
Member Author

Choose a reason for hiding this comment

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

(self-review) some missing constructors in the graph/ directory.

@@ -149,7 +149,7 @@ public interface AstVisitor<R, C> {

R visitSelectItem(SelectItem node, C ctx);

R visitSelectItemAll(SelectItem.Star node, C ctx);
Copy link
Member Author

Choose a reason for hiding this comment

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

(self-review) I forgot to change naming of this visitor function after the class was renamed.

Comment on lines -17 to -18
@NotNull
public final Long lower;
Copy link
Member Author

Choose a reason for hiding this comment

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

(self-review) type could just be primitive long.

Comment on lines +134 to +137
@NotNull
public static ExprNot exprNot(@NotNull Expr value) {
return new ExprNot(value);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

(self-review) for PartiQL expression NOT false,

example usage from Kotlin

exprNot(exprLit(boolValue(false)))

example usage from Java

exprNot(exprLit(boolValue(false)));

@alancai98 alancai98 requested a review from RCHowell October 17, 2024 23:17
Comment on lines +58 to +61
@NotNull
public static ExprAnd exprAnd(Expr lhs, Expr rhs) {
return new ExprAnd(lhs, rhs);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

One potentially annoying thing I've noticed about these factory methods being written in Java is that they cannot be called from Kotlin with named parameters.

E.g. below results in an error "Named arguments are not allowed for non-Kotlin functions"

identifier(
    symbol = ctx.IDENTIFIER_QUOTED().getStringValue(),
    isDelimited = true
)

Wondering if we should actually have these factory methods written in Kotlin instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll bring up next week w/ the team if these should be written in Kotlin.

@alancai98 alancai98 merged commit 5ba5563 into v1 Oct 18, 2024
14 checks passed
@alancai98 alancai98 deleted the v1-migrate-ast-factory-methods branch October 18, 2024 20:07
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.

2 participants