-
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
Updates plugins to use the Catalog and Bindings interfaces #1502
Conversation
98b9bd8
to
7adc8a3
Compare
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.
plugin update following spi changes looks good. some minor comments related to LocalConnector
?: error("Catalog $catalogName is not registered in the MemoryPlugin") | ||
return MemoryConnector(catalog) | ||
override fun create(config: StructElement): Connector { | ||
TODO("Instantiation of a MemoryConnector via the factory is currently not supported") |
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.
Will creation of a MemoryConnector
be supported in a subsequent PR as part of #1496?
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.
Yes. It's required for conformance testing.
|
||
public fun createTable(table: MemoryTable): Builder = apply { tables[table.getName()] = table } | ||
|
||
public fun build(): MemoryConnector = MemoryConnector(name!!, tables) |
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.
nit: even though this is meant for internal testing, can first check that name
is not null.
* Implement [Bindings] over the tables map. | ||
*/ | ||
private val bindings = object : Bindings { | ||
override fun getBindings(name: String): Bindings? = null |
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.
perhaps should be a TODO rather than returning null?
|
||
override fun getTable(name: Name): Table? { | ||
if (name.hasNamespace()) { | ||
error("MemoryCatalog does not support namespaces") |
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.
Is MemoryCatalog
something that will be added in a subsequent PR? Or should this refer to MemoryConnector's catalog:
error("MemoryCatalog does not support namespaces") | |
error("MemoryConnector's Catalog does not support namespaces") |
val catalog = MemoryCatalog.builder() | ||
.name("hello") | ||
.defineTable("pi", MemoryTable( | ||
type = PType.typeFloat32(), | ||
data = ionFloat(3.14), | ||
)) | ||
.build() | ||
|
||
// create a connector to be used in a session | ||
val connector = MemoryConnector.from(catalog) |
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.
nit: code snippet slightly out of date. guess we can update after all the APIs are more finalized
- MemoryCatalog -> MemoryConnector
- MemoryTable(...) -> MemoryTable.of()
- data should be of type
Datum
- MemoryConnector.from() does not exist
Relevant Issues
#1496
Description
This updates the our plugins to be based on the catalog interface defined in partiql-planner. It flips the dependency from planner->spi to be spi->planner.
Other Information
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.