-
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
Exclude planner & plan evaluator from tests for features not yet implemented #586
Exclude planner & plan evaluator from tests for features not yet implemented #586
Conversation
…CompilerPipeline and future PlannerPipeline
"""SELECT VALUE a FROM `[{v:5}]` AS item, @item.v AS a, @item.v AS a""", | ||
ErrorCode.EVALUATOR_AMBIGUOUS_BINDING, | ||
expectedErrorContext = propertyValueMapOf(1, 14, Property.BINDING_NAME to "a", Property.BINDING_NAME_MATCHES to "a, a"), | ||
expectedPermissiveModeResult = "<<MISSING>>" | ||
expectedPermissiveModeResult = "<<MISSING>>", | ||
target = EvaluatorTestTarget.COMPILER_PIPELINE |
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.
This PartiQL statement doesn't seem to use any of the excluded features mentioned in the PR description. Should L103 be omitted?
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.
You're correct, sir. Good catch. EDIT: HOWEVER... there is another slight difference in behavior where ambiguous binding names are concerned. Queries compiled with CompilerPipeline
throw at evaluation-time when an ambiguous binding is detected. However, PlannerPipeline
, etc, arbitrarily pick the first matching binding and disregard any ambiguity. This is not a backward compatibility issue since we are allowing queries to be evaluated that were not able to be evaluated previously.
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.
Updated PR description to include this.
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.
nit: may be worth leaving a comment for this test stating what you mentioned in this comment (or link the PR comment/description)
@@ -140,7 +144,8 @@ class EvaluatingCompilerExceptionsTest : EvaluatorTestBase() { | |||
// Same query as previous test--but DO NOT throw exception this time because of UndefinedVariableBehavior.MISSING | |||
runEvaluatorTestCase( | |||
sqlWithUndefinedVariable, expectedResult = "[null]", | |||
compileOptionsBuilderBlock = { undefinedVariable(UndefinedVariableBehavior.MISSING) } | |||
compileOptionsBuilderBlock = { undefinedVariable(UndefinedVariableBehavior.MISSING) }, | |||
target = EvaluatorTestTarget.COMPILER_PIPELINE |
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.
sqlWithUndefinedVariable
corresponds to the query SELECT VALUE y FROM << 'el1' >> AS x
, which doesn't have one of the "not implemented yet features". Is setting target to COMPILER_PIPELINE
intentional?
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.
Edited the PR description to include: "the PlannerPipeline
does not support UndefinedVariableBehavior.MISSING
, so tests related that have also execute only under CompilerPipeline
. This feature was intended for backward compatibility for a legacy customer who is stuck on a very old version of PartiQL for other reasons anyway."
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.
Thanks for editing the PR description for this.
nit: could also leave a comment for this test and the one on L169 stating what's mentioned here. Or could use a comment you had in QuotedIdentifierTests.kt
// planner & physical plan have no support for UndefinedVariableBehavior.MISSING (and may never)
lang/test/org/partiql/lang/eval/EvaluatingCompilerOffsetTests.kt
Outdated
Show resolved
Hide resolved
lang/test/org/partiql/lang/eval/SimpleEvaluatingCompilerTests.kt
Outdated
Show resolved
Hide resolved
lang/test/org/partiql/lang/eval/SimpleEvaluatingCompilerTests.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Alan Cai <caialan@amazon.com>
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.
Thanks for providing more details in the PR description. Changes look good. Only have a couple minor nits to include some of the PR conversation in a comment.
"""SELECT VALUE a FROM `[{v:5}]` AS item, @item.v AS a, @item.v AS a""", | ||
ErrorCode.EVALUATOR_AMBIGUOUS_BINDING, | ||
expectedErrorContext = propertyValueMapOf(1, 14, Property.BINDING_NAME to "a", Property.BINDING_NAME_MATCHES to "a, a"), | ||
expectedPermissiveModeResult = "<<MISSING>>" | ||
expectedPermissiveModeResult = "<<MISSING>>", | ||
target = EvaluatorTestTarget.COMPILER_PIPELINE |
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.
nit: may be worth leaving a comment for this test stating what you mentioned in this comment (or link the PR comment/description)
@@ -140,7 +144,8 @@ class EvaluatingCompilerExceptionsTest : EvaluatorTestBase() { | |||
// Same query as previous test--but DO NOT throw exception this time because of UndefinedVariableBehavior.MISSING | |||
runEvaluatorTestCase( | |||
sqlWithUndefinedVariable, expectedResult = "[null]", | |||
compileOptionsBuilderBlock = { undefinedVariable(UndefinedVariableBehavior.MISSING) } | |||
compileOptionsBuilderBlock = { undefinedVariable(UndefinedVariableBehavior.MISSING) }, | |||
target = EvaluatorTestTarget.COMPILER_PIPELINE |
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.
Thanks for editing the PR description for this.
nit: could also leave a comment for this test and the one on L169 stating what's mentioned here. Or could use a comment you had in QuotedIdentifierTests.kt
// planner & physical plan have no support for UndefinedVariableBehavior.MISSING (and may never)
Originally part of #582 and based on #583 (which must be merged first), this PR primarily sets the target evaluator for all tests related to the following features to be the AST evaluator, thereby excluding the planner and plan evaluator from them. (These features are not within the current scope of work for the planner and new evaluator.) Note that the new planner and evaluator are not in this branch yet and will be introduced in a separate pull request. There are also a few new tests that I added to provide simpler test cases for a few scenarios that were a little difficult to get working with the new planner and evaluator.
ORDER BY
GROUP BY
HAVING
SUM
,MAX
,MIN
, etc)PIVOT
UNPIVOT
Also, some of the exception tests have been set to only execute under the
CompilerPipeline
because there is a behavior change surrounding a rare edge case: "ambiguous bindings", i.e. when you have a case-insensitive variable reference and more than one matching variable that varies only by letter case. Example: if you havefOo
andFoO
defined but you refer to variablefoo
(case-insenstive),CompilerPipeline
etc would throw an exception at evaluation time if both are defined in the same lexical scope. The plan evaluator simply selectsfOo
and moves along merrily. (This behavior is consistent with Postgres, BTW.) This change is fully backward compatible because it allows queries to execute that wouldn't previously.The
PlannerPipeline
does not supportUndefinedVariableBehavior.MISSING
, so tests related that also execute only underCompilerPipeline
. This feature was intended for backward compatibility for a legacy customer who is stuck on a very old version of PartiQL for other reasons anyway.Lastly, the
PlannerPipeline
does not (yet?) support theStaticTypeInferenceVisitorTransform
, so any test that required the inferencer (i.e.EvaluatingCompilerNAryIntOverflowTests
) to run has also been set to only run against theCompilerPipeline
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.