From fcd061b5d5a4d308b64906f4898bcadff97b99b8 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Tue, 2 Jan 2024 15:03:25 -0800 Subject: [PATCH] Re-adds removed builder APIs and adds deprecation notice --- CHANGELOG.md | 6 +++-- .../partiql/planner/PartiQLPlannerBuilder.kt | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e24b83b33d..4050b3fbc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,8 +28,9 @@ Thank you to all who have contributed! ## [Unreleased] ### Added -- Adds the ability to define a user-defined-function in ConnectorMetadata -- Move ConnectorMetadata map from PartiQLPlanner to PartiQLPlanner.Session for planner re-use. +- Adds the ability to define a user-defined-function in `ConnectorMetadata` +- Move `ConnectorMetadata` map from `PartiQLPlanner` to `PartiQLPlanner.Session` for planner re-use. + - Deprecates 2 APIs in `org.partiql.planner.PartiQLPlannerBuilder` in favor of using the ConnectorMetadata map in `PartiQLPlanner.Session`. ### Changed @@ -44,6 +45,7 @@ Thank you to all who have contributed! ### Contributors Thank you to all who have contributed! - @rchowell +- @johnedquinn ## [0.14.0-alpha] - 2023-12-15 diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerBuilder.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerBuilder.kt index 0a3ba812df..fde724a58f 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerBuilder.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerBuilder.kt @@ -1,5 +1,7 @@ package org.partiql.planner +import org.partiql.spi.connector.ConnectorMetadata + /** * PartiQLPlannerBuilder is used to programmatically construct a [PartiQLPlanner] implementation. * @@ -38,4 +40,29 @@ public class PartiQLPlannerBuilder { public fun addPasses(vararg passes: PartiQLPlannerPass): PartiQLPlannerBuilder = this.apply { this.passes.addAll(passes) } + + /** + * Java style method for assigning a Catalog name to [ConnectorMetadata]. + * + * @param catalog + * @param metadata + * @return + */ + @Deprecated("This will be removed in v0.15.0+.", ReplaceWith("Please use org.partiql.planner.PartiQLPlanner.Session")) + public fun addCatalog(catalog: String, metadata: ConnectorMetadata): PartiQLPlannerBuilder = this + + /** + * Kotlin style method for assigning Catalog names to [ConnectorMetadata]. + * + * @param catalogs + * @return + */ + @Deprecated("This will be removed in v0.15.0+.", ReplaceWith("Please use org.partiql.planner.PartiQLPlanner.Session")) + public fun catalogs(vararg catalogs: Pair): PartiQLPlannerBuilder = this + + @Deprecated("This will be removed in v0.15.0+.", ReplaceWith("addPasses")) + public fun passes(passes: List): PartiQLPlannerBuilder = this.apply { + this.passes.clear() + this.passes.addAll(passes) + } }