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

Modifies how we model paths in the plan #1271

Merged
merged 1 commit into from
Nov 30, 2023
Merged

Conversation

johnedquinn
Copy link
Member

@johnedquinn johnedquinn commented Nov 29, 2023

Relevant Issues

  • None

Description

  • Modifies how we model paths in the plan
  • As discussed offline, when dealing with the semantics of pathing, there are 3 core operations:
    1. Indexing into an array. Ex: a[0], a[1 + 1]
    2. Sensitive lookup in a tuple. Ex: a."b", a['b'], a[CAST('a' || 'b' AS STRING)]
    3. Insensitive lookup in a tuple. Ex: a.b
  • The above will be part of the PUBLIC API. However, in order to appropriately handle the subtle differences between a.b, a."b", and a['b'] when we haven't typed yet-- the internal APIs contain:
    1. Indexing into an array. Ex: a[0], a[1 + 1]
    2. Sensitive lookup on a tuple. Ex: a['b'], a[CAST('a' || 'b' AS STRING)]
    3. Dot-notation lookup on a tuple/schema. Ex: a.b and a."b". This has a subtle difference to the public API.
  • We convert the dot-notation lookup to either a sensitive or insensitive lookup after typing/resolving. In my opinion, this should happen at the AST transformation, however, that is not currently supported.
  • See the added PartiQLSchemaInferencerTests for more information.

Other Information

  • Updated Unreleased Section in CHANGELOG: NO
  • Any backward-incompatible changes? YES
    • Yes, but for the unreleased planner.
  • 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 Nov 29, 2023

Conformance comparison report

Base (c23ca8c) fd98115 +/-
% Passing 92.33% 92.33% 0.00%
✅ Passing 5372 5372 0
❌ Failing 446 446 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5372

Number failing in both: 446

Number passing in Base (c23ca8c) but now fail: 0

Number failing in Base (c23ca8c) but now pass: 0

@johnedquinn johnedquinn marked this pull request as ready for review November 29, 2023 18:35
@RCHowell
Copy link
Member

Will review after rebase. Thank you.

partiql-plan/src/main/resources/partiql_plan_0_1.ion Outdated Show resolved Hide resolved
Comment on lines 165 to 170
org.partiql.ast.Identifier.CaseSensitivity.SENSITIVE -> rexOpPathStepKey(
rex(
type = StaticType.STRING,
op = rexOpLit(stringValue(it.symbol.symbol))
)
)
Copy link
Member

Choose a reason for hiding this comment

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

We want this to be a rexOpPathSymbol right? For global resolution.

a."x" != a["x"]  -- !! only for global variable names, the prior is treated as a qualified identifier

Copy link
Member Author

Choose a reason for hiding this comment

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

With your recent PR for internalizing the unresolved IRs, I added the retention of this subtle difference to the internal IR. Then, converting from the internal to the public, I transform it accordingly. See the updated PR description.

Comment on lines +131 to +132
Identifier.CaseSensitivity.SENSITIVE -> rexOpPathStepKey(rex(StaticType.STRING, rexOpLit(stringValue(node.identifier.symbol))))
Identifier.CaseSensitivity.INSENSITIVE -> rexOpPathStepSymbol(node.identifier.symbol)
Copy link
Member

Choose a reason for hiding this comment

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

Nice, here's a notable difference between the typing structure and the public API

@johnedquinn johnedquinn merged commit 32643d5 into partiql-planner Nov 30, 2023
10 checks passed
@johnedquinn johnedquinn deleted the modeling-paths branch November 30, 2023 00:03
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