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 catalog definitions and tests to fix assemble. #1514

Closed
wants to merge 15 commits into from

Conversation

RCHowell
Copy link
Member

Description

This PR stubs out all planner and tests so that I can begin implementing and executing planner tests.

CONTRIBUTING.md)
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.

@RCHowell RCHowell mentioned this pull request Jul 16, 2024
17 tasks
@RCHowell RCHowell force-pushed the v1-metadata-planner branch from 2aec92c to ad93e3c Compare July 16, 2024 20:42
Comment on lines -34 to -37
testImplementation(project(":plugins:partiql-local"))
testImplementation(project(":plugins:partiql-memory"))
// Test Fixtures
testFixturesImplementation(project(":partiql-spi"))
Copy link
Member Author

Choose a reason for hiding this comment

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

partiql-planner no long depends on spi which means we cannot use any of the plugins.


@JvmStatic
public fun default(): PartiQLPlanner = PartiQLPlannerBuilder().build()
public class Builder {
Copy link
Member Author

Choose a reason for hiding this comment

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

The recurring pattern is to namespace all builders under the interface class.

Comment on lines -45 to -52
public class Session(
public val queryId: String,
public val userId: String,
public val currentCatalog: String,
public val currentDirectory: List<String> = emptyList(),
public val catalogs: Map<String, ConnectorMetadata> = emptyMap(),
public val instant: Instant = Instant.now(),
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Session is moved to an interface.

public fun getTable(session: Session, name: Name): Table? = null

/**
* Get a table by identifier; note that identifiers may be case-insensitive.
*/
public fun getTable(session: Session, identifier: Identifier): Table? = null
Copy link
Member Author

Choose a reason for hiding this comment

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

Consider getTable(session: Session, name: Name) and searchTable(session, identifier: Identifier) or something similar.

We have no way of knowing which is the catalog/namespace, the table name, and the path expression — so we must do searching.


val name = this.name ?: throw IllegalArgumentException("Catalog name must be provided")

return object : 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.

Replacement for partiql-memory plugin

properties: Properties = DEFAULT_PROPERTIES,
): Scalar = object : Scalar {
override fun getName(): String = name
override fun getParameters(): Array<Parameter> = parameters.toTypedArray()
override fun getReturnType(): PType.Kind = returnType
override fun getReturnType(): PType = returnType
Copy link
Member Author

Choose a reason for hiding this comment

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

For now use PType to minimize changes.

Comment on lines -20 to +18
val signature: FnSignature,
val signature: Routine,
Copy link
Member Author

Choose a reason for hiding this comment

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

You'll see Routine replaces FnSignature everywhere.

return tables[name.getName()]
}

override fun getTable(session: Session, identifier: Identifier): Table? {
Copy link
Member

Choose a reason for hiding this comment

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

Wasn't this just deleted from the interface?

@@ -13,9 +13,9 @@ public interface Catalogs {
/**
* Returns a catalog by name (single identifier).
*/
public fun get(name: String, ignoreCase: Boolean = false): Catalog? {
public fun get(identifier: Identifier): Catalog? {
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking as the code pre-exists: shouldn't you be using list() in this scenario?

@@ -9,7 +12,7 @@ package org.partiql.planner.catalog
public class Identifier private constructor(
private val qualifier: Array<Part>,
private val identifier: Part,
) {
) : Iterable<Identifier.Part> {
Copy link
Member

Choose a reason for hiding this comment

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

Nice

Copy link
Member

Choose a reason for hiding this comment

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

While this PR doesn't address this, I'm only leaving it since I didn't review previous PRs. Routines in SQL are either functions or procedures (any SQL statement, not required to return a value). So, Function might be a better name -- and operator and scalar could be variants.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree and can go back to Function. I was only avoiding it because most often function is taken to mean scalar function.

But I do like,

  • aggregation function
  • scalar function
  • operator function

Where an operator function is an operator backed by a function a'la postgres.

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.

only reviewed a few files -- leaving just an initial comment about Nodes.kt getting overwritten.

// include("**/Nodes.kt")
// into("src/main/kotlin")
// }
tasks.register<Copy>("copyNodes") {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm I think should remain commented out or possibly removed? Some custom logic in Nodes.kt is getting overwritten.

Copy link
Member

Choose a reason for hiding this comment

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

we can fix Nodes.kt after all the internal plan nodes are more finalized.

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, this was my intention as it is being changes frequently.

@RCHowell RCHowell closed this Jul 17, 2024
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.

3 participants