-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into partiql-eval
- Loading branch information
Showing
20 changed files
with
535 additions
and
99 deletions.
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
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
34 changes: 12 additions & 22 deletions
34
partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerBuilder.kt
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 |
---|---|---|
@@ -1,51 +1,41 @@ | ||
package org.partiql.planner | ||
|
||
import org.partiql.spi.connector.ConnectorMetadata | ||
|
||
/** | ||
* PartiQLPlannerBuilder is used to programmatically construct a [PartiQLPlanner] implementation. | ||
* | ||
* Usage: | ||
* PartiQLPlanner.builder() | ||
* .addCatalog("foo", FooConnector()) | ||
* .addCatalog("bar", BarConnector()) | ||
* .builder() | ||
* .addPass(myPass) | ||
* .build() | ||
*/ | ||
public class PartiQLPlannerBuilder { | ||
|
||
private var headers: MutableList<Header> = mutableListOf(PartiQLHeader) | ||
private var catalogs: MutableMap<String, ConnectorMetadata> = mutableMapOf() | ||
private var passes: List<PartiQLPlannerPass> = emptyList() | ||
private val passes: MutableList<PartiQLPlannerPass> = mutableListOf() | ||
|
||
/** | ||
* Build the builder, return an implementation of a [PartiQLPlanner]. | ||
* | ||
* @return | ||
*/ | ||
public fun build(): PartiQLPlanner = PartiQLPlannerDefault(headers, catalogs, passes) | ||
public fun build(): PartiQLPlanner = PartiQLPlannerDefault(passes) | ||
|
||
/** | ||
* Java style method for assigning a Catalog name to [ConnectorMetadata]. | ||
* Java style method for adding a planner pass to this planner builder. | ||
* | ||
* @param catalog | ||
* @param metadata | ||
* @param pass | ||
* @return | ||
*/ | ||
public fun addCatalog(catalog: String, metadata: ConnectorMetadata): PartiQLPlannerBuilder = this.apply { | ||
this.catalogs[catalog] = metadata | ||
public fun addPass(pass: PartiQLPlannerPass): PartiQLPlannerBuilder = this.apply { | ||
this.passes.add(pass) | ||
} | ||
|
||
/** | ||
* Kotlin style method for assigning Catalog names to [ConnectorMetadata]. | ||
* Kotlin style method for adding a list of planner passes to this planner builder. | ||
* | ||
* @param catalogs | ||
* @param passes | ||
* @return | ||
*/ | ||
public fun catalogs(vararg catalogs: Pair<String, ConnectorMetadata>): PartiQLPlannerBuilder = this.apply { | ||
this.catalogs = mutableMapOf(*catalogs) | ||
} | ||
|
||
public fun passes(passes: List<PartiQLPlannerPass>): PartiQLPlannerBuilder = this.apply { | ||
this.passes = passes | ||
public fun addPasses(vararg passes: PartiQLPlannerPass): PartiQLPlannerBuilder = this.apply { | ||
this.passes.addAll(passes) | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...main/kotlin/org/partiql/planner/Header.kt → ...in/org/partiql/planner/internal/Header.kt
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
2 changes: 1 addition & 1 deletion
2
...tlin/org/partiql/planner/PartiQLHeader.kt → ...partiql/planner/internal/PartiQLHeader.kt
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.