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

[DRAFT] Initializes PartiQL-system interfaces and document. #1480

Closed
wants to merge 5 commits into from

Conversation

RCHowell
Copy link
Member

@RCHowell RCHowell commented Jun 3, 2024

Description

https://github.com/partiql/partiql-lang-kotlin/blob/v1-path/partiql-planner/README.adoc

This PR initializes the interfaces for the 1.0 planner interfaces which model the PartiQL-system. This review is meant to collect feedback on the high-level public interfaces and documentation before updating internals.

Details can be found in the README.adoc.

License Information

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

@RCHowell RCHowell requested a review from johnedquinn June 3, 2024 19:44
Copy link
Member

Choose a reason for hiding this comment

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

Very glad to see this document. Kudos for taking the initiative.

* @property isNullCall
*/
public data class Properties(
@JvmField public val isNullCall: Boolean = false,
Copy link
Member

Choose a reason for hiding this comment

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

No isMissingCall? Are you expecting to add it later?

Copy link
Member Author

@RCHowell RCHowell Jun 4, 2024

Choose a reason for hiding this comment

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

No I don't believe it's necessary for function calls, only some very special operators (which will come later).


Let _N_ be a name with steps _n~1~ . n~2~ ... n~i~_ and let _S_ be the session scope with name _s~1~_ ... _s~j~_.

. Let _T_ be the fully-qualified table name.
Copy link
Member

Choose a reason for hiding this comment

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

The guide might be a bit confusing due to the conflation of SQL terms and PartiQL terms. From above: A name is composed of _n_ steps and can be qualified (_n > 1_) or unqualified (_n = 1_). It seems like the use of "qualified" only indicates whether a name has more than 1 step (regardless of whether the name is absolute or relative).

Then, A _relative_ name begins with a step whereas an _absolute_ name begins with a leading period..

I almost feel as if we should begin to deprecate the use of "qualified". It could just be "absolute path/name". Essentially, does the use of SQL's "qualified" give any additional meaning now with the concept of relative & absolute?

On a similar note, depending on your thoughts on this, it may be a good idea to specify what the root of the system is. Is it a scope? For first launch, it may be useful to say that it is not a scope (so that tables/views/etc) cannot be created outside of a catalog.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you can have a relative-qualified path.

x.y.z     -- relative-qualified
.a.b.c    -- absolute-qualified

I don't think "qualified" adds any value here though, and should just be "relative name" and "absolute name".

public fun getKind(): Kind = Kind.TABLE

/**
* The table's shape; in SQL this is called 'table schema'.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The table's shape; in SQL this is called 'table schema'.
* The table's shape; in SQL this is called 'table descriptor'.

*
* @property steps
*/
public data class Name(public val steps: List<String>) : Iterable<String> {
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to represent an Absolute Name or Relative Name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Neither, it's just a name.

* @param name The case-sensitive [Table] name.
* @return The [Table] or null if not found.
*/
public fun getTable(name: String): Table? = null
Copy link
Member

Choose a reason for hiding this comment

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

For this method (as well as the ones below), I'm wondering how we can determine the case-sensitive names for third-party consumers (that may not consistently upper-or-lower-case their table names upon storage).

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't determine the case-sensitive names; I think you have consumer-implementer backwards. We case-normalize to lowercase and it's up to the implementer how to handle.

In other words, all usage of the Scope comes from the planner; so the planner is only "consumer" of Scope — implementers are responsible for handling their own mapping from PartiQL's case-normalized

Comment on lines 58 to 64
Let _N_ be a routine name with steps _n~1~ . n~2~ ... n~i~_ and let _S_ be the session scope with name _s~1~_ ... _s~j~_.

. If n = 1 then the session path is searched left-to-right for _n~1~_.
. If n > 1, then let _R_ be the fully-qualified routine name.
.. If _N_ is a relative name, then _R = s~1~ . s~2~ ... s~j~ . n~1~ . n~2~. ... n~i~_ .
.. If _N_ is an absolute name, then _R = n~1~ . n~2~ ... n~i~_ .
. Lookup the fully-qualified name _R_ and fail compilation if not found.
Copy link
Member

@johnedquinn johnedquinn Jun 3, 2024

Choose a reason for hiding this comment

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

Regarding "fully-qualified" vs "absolute", I think the following suggestion is a bit more clear.

Suggested change
Let _N_ be a routine name with steps _n~1~ . n~2~ ... n~i~_ and let _S_ be the session scope with name _s~1~_ ... _s~j~_.
. If n = 1 then the session path is searched left-to-right for _n~1~_.
. If n > 1, then let _R_ be the fully-qualified routine name.
.. If _N_ is a relative name, then _R = s~1~ . s~2~ ... s~j~ . n~1~ . n~2~. ... n~i~_ .
.. If _N_ is an absolute name, then _R = n~1~ . n~2~ ... n~i~_ .
. Lookup the fully-qualified name _R_ and fail compilation if not found.
Let _N_ be the routine invocation name (absolute or relative) with steps _n1_, _n2_, …​, _ni_. Let _S_ be the session scope with name _.s1.s2. …​ sj_. Let _R_ by the absolute name of the invoked routine.
1. If _N_ is an absolute name, then _R = . n1 . n2 …​ ni_ . Return _R_.
2. If n = 1 then the function path is searched left-to-right for _n1_.
3. If n > 1, then _R = . s1 . s2 …​ sj . n1 . n2. …​ ni_ .
4. Lookup the absolute name _R_. Return function(s) if found. Fail compilation if not found.

Maybe the "function path" should be SQL Path or invocation path. Up to you.

Copy link
Member Author

@RCHowell RCHowell Jun 4, 2024

Choose a reason for hiding this comment

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

Edit, it's meant to be "session path" from the original text.

Copy link

github-actions bot commented Jun 14, 2024

Conformance comparison report-Cross Engine

Base (legacy) eval +/-
% Passing 92.62% 15.68% -76.94%
✅ Passing 5422 918 -4504
❌ Failing 432 4936 4504
🔶 Ignored 0 0 0
Total Tests 5854 5854 0
Number passing in both: 881

Number failing in both: 395

Number passing in legacy engine but fail in eval engine: 4541

Number failing in legacy engine but pass in eval engine: 37
⁉️ CONFORMANCE REPORT REGRESSION DETECTED ⁉️
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.
37 test(s) were failing in legacy but now pass in eval. 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.

Conformance comparison report-Cross Commit-LEGACY

Base (4dd0972) a0103d6 +/-
% Passing 92.60% 92.62% 0.02%
✅ Passing 5421 5422 1
❌ Failing 433 432 -1
🔶 Ignored 0 0 0
Total Tests 5854 5854 0
Number passing in both: 5421

Number failing in both: 432

Number passing in Base (4dd0972) but now fail: 0

Number failing in Base (4dd0972) but now pass: 1
The following test(s) were previously failing but now pass. Before merging, confirm they are intended to pass:

Click here to see
  • MYSQL_SELECT_29, compileOption: LEGACY

Conformance comparison report-Cross Commit-EVAL

Base (4dd0972) a0103d6 +/-
% Passing 87.05% 15.68% -71.37%
✅ Passing 5097 918 -4179
❌ Failing 758 4936 4178
🔶 Ignored 0 0 0
Total Tests 5855 5854 -1
Number passing in both: 918

Number failing in both: 758

Number passing in Base (4dd0972) but now fail: 4179

Number failing in Base (4dd0972) but now pass: 0
⁉️ CONFORMANCE REPORT REGRESSION DETECTED ⁉️
The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

@RCHowell RCHowell closed this Jun 24, 2024
@RCHowell RCHowell deleted the v1-path branch July 18, 2024 21:45
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