-
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
Identifier mode #1511
Identifier mode #1511
Conversation
Conformance comparison report-Cross Engine
Number failing in both: 230 Number passing in eval engine but fail in legacy engine: 203 Number failing in eval engine but pass in legacy engine: 528 Conformance comparison report-Cross Commit-EVAL
Number failing in both: 499 Number passing in Base (8b4e0d3) but now fail: 260 Number failing in Base (8b4e0d3) but now pass: 51 Conformance comparison report-Cross Commit-LEGACY
Number failing in both: 432 Number passing in Base (8b4e0d3) but now fail: 1 Number failing in Base (8b4e0d3) but now pass: 4 Click here to see
Click here to see
|
binder::{ | ||
symbol: string, | ||
case_sensitivity: [ | ||
SENSITIVE, | ||
INSENSITIVE, | ||
], | ||
} |
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.
binder::{ | |
symbol: string, | |
case_sensitivity: [ | |
SENSITIVE, | |
INSENSITIVE, | |
], | |
} | |
binder::{ | |
text: string, | |
normal: bool, | |
} |
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 somewhat think we should modify the definition for identifier
to be like,
identifier::{
qualifier: list::[binder],
identifier: binder,
}
Or something similar. The point is, having identifier
with a qualifier rather than a root and steps. I guess this is also difficult because identifier paths in PartiQL are like path expressions.
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.
Binder is different than Identifier.
Identifier: used at place where we do variable reference. It can be optionally qualified.
Binder: used at place where we do variable declaration. It can not be qualified (AFAIK).
public fun default(): PartiQLPlanner = PartiQLPlannerBuilder().build() | ||
public fun default(): PartiQLPlanner = | ||
PartiQLPlannerBuilder() | ||
.casePreserve() |
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 would leave out casePreserve
for now because we agreed this is is the only lvalue behavior for now.
public fun default(): PartiQLPlanner = | ||
PartiQLPlannerBuilder() | ||
.casePreserve() | ||
.lookUpBehavior("INSENSITIVE") |
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 suggest an enum like
enum class CaseNormalForm {
LOWERCASE,
UPPERCASE,
EXACTCASE,
}
This determines if we normalize identifiers, ie how we handle SQL/PartiQL "normal" identifiers.
LOWERCASE -> AbC -> "abc"
UPPERCASE -> AbC -> "ABC"
EXACTCASE -> AbC -> "AbC"
// null (aka insensitive, no normalization)
AbC -> AbC
partiql-planner/src/main/kotlin/org/partiql/planner/internal/astPasses/NormalizeSelect.kt
Outdated
Show resolved
Hide resolved
partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt
Outdated
Show resolved
Hide resolved
Close in favor of PR #1519 |
Relevant Issues
Note
lvalue
andrvalue
behavior.Semantics
This draft PR enables adding planner modes to determine Case Preservation and Variable Look Up behavior.
Case Preservation:
Variable Look Up (RValue):
Modeling
Behavior
SELECT bAr .....
SELECT "BAR" ...
SELECT "bar" ...
SELECT "bAR" ...
AST Node:
Binder
t.c.a AS A
,t.c.a
is a qualified identifier andt
,c
,a
are identifier symbol.A
is a binder.lvalue
andrvalue
on the AST level easily, without the need to go down each node and distinguish the type of identifier based on the node parameter. (check if the identifier symbol is anas_alias
, etc).Removed to reduce noise in this PR.
- Decouple SelectNormalization with RelConverter.- The previous invocation of SelectNormalization is invoked by RelConverter.- This is due to the need of handling subquery coercion.- I found this jumping between AST and Relational Operation introduces confusion, but to decouple the two, we are forced to add a boolean flag in the AST to indicate coercible. Not something I necessarily like either...- We can revert this decouple per later discussion.Other Information
Updated Unreleased Section in CHANGELOG: [YES/NO]
Any backward-incompatible changes? [YES/NO]
Any new external dependencies? [YES/NO]
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES/NO]
Yes.
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.