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

Adds a built-in PartiQL System catalog, support for SQL-Path, and SPI cleanup #1670

Merged
merged 13 commits into from
Dec 10, 2024

Conversation

johnedquinn
Copy link
Member

@johnedquinn johnedquinn commented Dec 3, 2024

Relevant Issues

Description

  • Adds a built-in PartiQL System catalog, which is installed via the Session builder.
  • Adds support for SQL Path by plumbing the path through scalar and aggregate function resolution.
  • Changes some APIs from using Collection to List, where order matters.
  • Splits Catalog#getTable() and Catalog#resolveTable()
  • The remaining action items in [V1] SPI Feedback Cleanup #1660 will be taken in a follow-up PR.

License Information

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

@johnedquinn johnedquinn marked this pull request as ready for review December 5, 2024 21:17
@johnedquinn johnedquinn requested a review from RCHowell December 5, 2024 21:17
@@ -43,7 +43,8 @@ public interface Session {
public companion object {

/**
* Returns a [Session] with only the "empty" catalog implementation.
* Returns a [Session] with only the "empty" catalog implementation. Note that this does NOT add the
* PartiQL System Catalog.
*/
@JvmStatic
public fun empty(): Session = object : Session {
Copy link
Member

@RCHowell RCHowell Dec 5, 2024

Choose a reason for hiding this comment

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

Session.empty() is used in several places so would need the psystem available. I don't believe we need bare() factory method either. I was referring to a builder method in the previous PR, not a factory.

Think about it this way,

Session.builder()....build()   // standard builder comes with standard system
Session.system(catalog)...builder()  // .system() is a named *builder* factory which replaces the standard system.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the latest revision has this. I can just revert the last commit (the addition of the bare method).

Copy link
Member Author

@johnedquinn johnedquinn Dec 6, 2024

Choose a reason for hiding this comment

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

I just reverted and added the PartiQL system catalog to Session.empty(). See the last three commits. LMK what you think.

Comment on lines 22 to 35

/**
* TODO
*/
@NotNull
private final String name;

/**
* Creates a new PartiQL System Catalog with the given name.
* @param name the name of the PartiQL System Catalog
*/
PartiQLSystemCatalog(@NotNull String name) {
this.name = name;
}
Copy link
Member

Choose a reason for hiding this comment

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

make singleton with private constructor and have a public static final String for "$system"

So it's like

protected final class System implements Catalog { 

     static final INSTANCE

     static final NAME = "\$system"
}

like that. Also I know that protected is different than package-private, but do prefer an explicit modifier

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't make a protected top-level class. Updated the Javadocs to make the visibility more apparent, since there is no package-private modifier. And added the singleton. See latest commit: d1b3305

If we want to expose this class in the future, sure. But we don't need to right now.

@johnedquinn johnedquinn requested a review from RCHowell December 6, 2024 18:49
@johnedquinn johnedquinn marked this pull request as draft December 9, 2024 19:02
@johnedquinn johnedquinn changed the base branch from v1 to main December 9, 2024 20:22
@johnedquinn johnedquinn changed the title Adds a built-in PartiQL System catalog and support for SQL Path Adds a built-in PartiQL System catalog, support for SQL-Path, and SPI cleanup Dec 9, 2024
@johnedquinn johnedquinn requested a review from RCHowell December 9, 2024 20:28
@johnedquinn johnedquinn marked this pull request as ready for review December 9, 2024 20:28
@johnedquinn johnedquinn merged commit 01ed70a into partiql:main Dec 10, 2024
7 checks passed
@johnedquinn johnedquinn deleted the v1-spi branch December 10, 2024 15:35
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