-
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
Adds a built-in PartiQL System catalog, support for SQL-Path, and SPI cleanup #1670
Merged
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
896e295
Adds a built-in PartiQL System catalog
johnedquinn 11b1496
Moves PartiQLSystemCatalog back into SPI package
johnedquinn 42cc72e
Adds a 'bare' Session implementation with the default system catalog
johnedquinn a712fba
Revert "Adds a 'bare' Session implementation with the default system …
johnedquinn c91977f
Adds the PartiQL System Catalog to the Session.empty()
johnedquinn 0573517
Removes unused Catalogs.empty() public API
johnedquinn 531659d
Renames Session.Builder#systemCatalog() to system()
johnedquinn 628c1db
Fixes bug where system catalog wasn't being updated by Session#system()
johnedquinn d1b3305
Adds a singleton system catalog
johnedquinn 57fb8b3
Renames PartiQLSystemCatalog to System
johnedquinn 4110b4b
Fixes GitHub benchmark workflow
johnedquinn aa2a6f2
Updates Catalog#getTable to Catalog#resolveTable
johnedquinn 8d9ded8
Updates usages of Collection to List in partiql-spi
johnedquinn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.partiql.spi.catalog; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.partiql.spi.function.Aggregation; | ||
import org.partiql.spi.function.Builtins; | ||
import org.partiql.spi.function.Function; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* <p> | ||
* This implements the PartiQL System Catalog. | ||
* </p> | ||
* <p> | ||
* It provides the implementation for the PartiQL System Catalog, which is a built-in catalog | ||
* that provides access to the PartiQL language and its built-in functions and aggregations. | ||
* </p> | ||
* @see Session.Builder | ||
*/ | ||
final class PartiQLSystemCatalog implements Catalog { | ||
|
||
/** | ||
* 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; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Table getTable(@NotNull Session session, @NotNull Name name) { | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Table getTable(@NotNull Session session, @NotNull Identifier identifier) { | ||
return null; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Collection<Function> getFunctions(@NotNull Session session, @NotNull String name) { | ||
return Builtins.INSTANCE.getFunctions(name); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Collection<Aggregation> getAggregations(@NotNull Session session, @NotNull String name) { | ||
return Builtins.INSTANCE.getAggregations(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
make singleton with private constructor and have a public static final String for "$system"
So it's like
like that. Also I know that protected is different than package-private, but do prefer an explicit modifier
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.
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.