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] Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast #1544

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

alancai98
Copy link
Member

Relevant Issues

Description

  • partiql-ast -- removes CAN_CAST and CAN_LOSSLESS_CAST nodes
  • Adds TODOs in partiql-parser grammar and partiql-lang tests for parts we want to remove ahead of the v1 release

Other Information

  • Updated Unreleased Section in CHANGELOG: [NO]

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

    • Yes, deletes CAN_CAST and CAN_LOSSLESS_CAST nodes from the partiql-ast
  • 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.

@alancai98 alancai98 changed the title Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast Aug 12, 2024
@alancai98 alancai98 force-pushed the v1-remove-can-cast-can-lossless branch from 1f263b3 to 895a3a8 Compare August 12, 2024 19:25
Comment on lines -461 to -472
// PartiQL special form `CAN_CAST`
can_cast::{
value: expr,
as_type: '.type',
},

// PartiQL special form `CAN_LOSSLESS_CAST`
can_lossless_cast::{
value: expr,
as_type: '.type',
},

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'm not sure of a way we can mark these partiql-ast nodes as deprecated and then remove them in a subsequent release. In the PR's current state, it will remove the nodes and corresponding partiql-ast code within the v1 branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

from offline discussion, PartiQL team will remove these partiql-ast nodes from the v1 branch.

@@ -131,6 +131,7 @@ abstract class CastTestBase : EvaluatorTestBase() {
}
override fun toString(): String = "$expression -> ${expected ?: expectedErrorCode}"

// TODO: delete these tests ahead of `v1` release
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): Within the legacy code of partiql-lang, I didn't remove anything just yet. Currently just marks parts of the code in partiql-lang that we will remove in the v1 release.

Copy link
Member Author

Choose a reason for hiding this comment

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

from offline discussion, we'll leave existing tests as-is. They will be deleted in the v1 release.

@@ -623,8 +623,8 @@ exprPrimary
| substring # ExprPrimaryBase
| position # ExprPrimaryBase
| overlay # ExprPrimaryBase
| canCast # ExprPrimaryBase
| canLosslessCast # ExprPrimaryBase
| canCast # ExprPrimaryBase // TODO remove ahead of `v1` release
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) Was not sure if we wanted to remove the partiql-parser logic just yet or wait until after we've deprecated everything in partiql-lang before removing.

Copy link
Member Author

Choose a reason for hiding this comment

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

from offline discussion, we'll keep the parsing rules in the grammar in place for now. Eventually, the rules in the parser and lexer will be removed in the v1 branch. We will have the following behavior for the ANTLR visitors:

  • partiql-parser ANTLR visitor (parsing to partiql-ast) -- will now error when visiting the canCast and canLosslessCast nodes
  • partiql-lang ANTLR visitor (parsing to PIG-generated AST) -- leave as-is

@alancai98 alancai98 self-assigned this Aug 12, 2024
@alancai98 alancai98 changed the title Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast [draft] [v1]Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast Aug 12, 2024
@alancai98 alancai98 changed the title [draft] [v1]Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast [draft] [v1] Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast Aug 12, 2024
@alancai98 alancai98 marked this pull request as draft August 12, 2024 19:29
Copy link

github-actions bot commented Aug 12, 2024

CROSS-ENGINE Conformance Report ❌

BASE (LEGACY-8A68AE4) TARGET (EVAL-8A68AE4) +/-
% Passing 90.47% 96.62% 6.16% ✅
Passing 5334 5697 363 ✅
Failing 562 199 -363 ✅
Ignored 0 0 0 ✅
Total Tests 5896 5896 0 ✅

Testing Details

  • Base Commit: 8a68ae4
  • Base Engine: LEGACY
  • Target Commit: 8a68ae4
  • Target Engine: EVAL

Result Details

  • ❌ REGRESSION DETECTED. See Now Failing Tests. ❌
  • Passing in both: 5205
  • Failing in both: 70
  • PASSING in BASE but now FAILING in TARGET: 129
  • FAILING in BASE but now PASSING in TARGET: 492

Now Failing Tests ❌

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

Now Passing Tests

492 test(s) were previously failing in BASE (LEGACY-8A68AE4) but now pass in TARGET (EVAL-8A68AE4). 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-LEGACY Conformance Report ✅

BASE (LEGACY-4F783C7) TARGET (LEGACY-8A68AE4) +/-
% Passing 90.47% 90.47% 0.00% ✅
Passing 5334 5334 0 ✅
Failing 562 562 0 ✅
Ignored 0 0 0 ✅
Total Tests 5896 5896 0 ✅

Testing Details

  • Base Commit: 4f783c7
  • Base Engine: LEGACY
  • Target Commit: 8a68ae4
  • Target Engine: LEGACY

Result Details

  • Passing in both: 5334
  • Failing in both: 562
  • PASSING in BASE but now FAILING in TARGET: 0
  • FAILING in BASE but now PASSING in TARGET: 0

CROSS-COMMIT-EVAL Conformance Report ✅

BASE (EVAL-4F783C7) TARGET (EVAL-8A68AE4) +/-
% Passing 96.62% 96.62% 0.00% ✅
Passing 5697 5697 0 ✅
Failing 199 199 0 ✅
Ignored 0 0 0 ✅
Total Tests 5896 5896 0 ✅

Testing Details

  • Base Commit: 4f783c7
  • Base Engine: EVAL
  • Target Commit: 8a68ae4
  • Target Engine: EVAL

Result Details

  • Passing in both: 5697
  • Failing in both: 199
  • PASSING in BASE but now FAILING in TARGET: 0
  • FAILING in BASE but now PASSING in TARGET: 0

@alancai98 alancai98 force-pushed the v1-remove-can-cast-can-lossless branch from 895a3a8 to 706bd54 Compare August 13, 2024 19:07
@alancai98 alancai98 changed the title [draft] [v1] Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast [v1] Remove CAN_CAST and CAN_LOSSLESS_CAST from partiql-ast Aug 13, 2024
Comment on lines -1742 to +1740
val type = visitAs<Type>(ctx.type())
exprCanCast(expr, type)
throw error(ctx, "CAN_CAST is no longer supported in the default PartiQLParser")
}

override fun visitCanLosslessCast(ctx: GeneratedParser.CanLosslessCastContext) = translate(ctx) {
val expr = visitExpr(ctx.expr())
val type = visitAs<Type>(ctx.type())
exprCanLosslessCast(expr, type)
throw error(ctx, "CAN_LOSSLESS_CAST is no longer supported in the default PartiQLParser")
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): erroring on canCast and canLosslessCast in the partiql-parser ANTLR visitor does not result in any parsing test failures. As we alter the parsing behavior for other nodes we want to delete from partiql-ast, we may encounter some parsing test failures. We will need some skip-list or other mechanism to

  • not run the PartiQLParserDefault on those tests
  • continue to support parsing w/ the PartiQLPigVisitor

@alancai98 alancai98 marked this pull request as ready for review August 13, 2024 21:26
@alancai98 alancai98 force-pushed the v1-remove-can-cast-can-lossless branch from 706bd54 to 4dfbb98 Compare August 21, 2024 22:47
@alancai98 alancai98 force-pushed the v1-remove-can-cast-can-lossless branch from 4dfbb98 to 5bf5aeb Compare August 23, 2024 17:05
@alancai98 alancai98 requested a review from johnedquinn August 23, 2024 18:45
@alancai98 alancai98 merged commit 00caba9 into v1 Aug 27, 2024
14 checks passed
@alancai98 alancai98 deleted the v1-remove-can-cast-can-lossless branch August 27, 2024 21:52
@alancai98 alancai98 restored the v1-remove-can-cast-can-lossless branch September 16, 2024 23:39
@alancai98 alancai98 deleted the v1-remove-can-cast-can-lossless branch September 17, 2024 23:51
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