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

Updates plugins to use the Catalog and Bindings interfaces #1502

Merged
merged 9 commits into from
Jul 10, 2024

Conversation

RCHowell
Copy link
Member

@RCHowell RCHowell commented Jul 8, 2024

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

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 review from alancai98 and johnedquinn July 8, 2024 23:16
@RCHowell RCHowell force-pushed the v1-metadata-plugins branch from 98b9bd8 to 7adc8a3 Compare July 9, 2024 16:33
@RCHowell RCHowell mentioned this pull request Jul 9, 2024
17 tasks
Copy link
Member

@alancai98 alancai98 left a 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")
Copy link
Member

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?

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. It's required for conformance testing.


public fun createTable(table: MemoryTable): Builder = apply { tables[table.getName()] = table }

public fun build(): MemoryConnector = MemoryConnector(name!!, tables)
Copy link
Member

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
Copy link
Member

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")
Copy link
Member

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:

Suggested change
error("MemoryCatalog does not support namespaces")
error("MemoryConnector's Catalog does not support namespaces")

Comment on lines +9 to +18
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)
Copy link
Member

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

@RCHowell RCHowell merged commit d8ef10b into v1-metadata Jul 10, 2024
6 of 14 checks passed
@RCHowell RCHowell deleted the v1-metadata-plugins branch July 10, 2024 17:27
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