diff --git a/partiql-cli/build.gradle.kts b/partiql-cli/build.gradle.kts index e1584e5e4..ed163fa5a 100644 --- a/partiql-cli/build.gradle.kts +++ b/partiql-cli/build.gradle.kts @@ -26,7 +26,6 @@ dependencies { implementation(project(":partiql-planner")) implementation(project(":partiql-types")) implementation(project(":partiql-spi")) - implementation(project(":partiql-system")) implementation(Deps.csv) implementation(Deps.awsSdkBom) implementation(Deps.awsSdkDynamodb) diff --git a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt index 403cdd3bb..878409a77 100644 --- a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt +++ b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt @@ -20,10 +20,10 @@ import org.partiql.cli.pipeline.Pipeline import org.partiql.cli.shell.Shell import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Name +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader -import org.partiql.system.PartiQLSessionBuilder import org.partiql.value.PartiQLValueExperimental import org.partiql.value.io.PartiQLValueTextWriter import picocli.CommandLine @@ -210,7 +210,7 @@ internal class MainCommand : Runnable { println() } - private fun session() = PartiQLSessionBuilder() + private fun session() = Session.builder() .identity(System.getProperty("user.name")) .namespace(emptyList()) .catalog("default") diff --git a/partiql-eval/build.gradle.kts b/partiql-eval/build.gradle.kts index d8642a856..17f013af7 100644 --- a/partiql-eval/build.gradle.kts +++ b/partiql-eval/build.gradle.kts @@ -33,7 +33,6 @@ dependencies { annotationProcessor(Deps.lombok) // Test testImplementation(project(":partiql-parser")) - testImplementation(project(":partiql-system")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType testImplementation(Deps.junit4) testImplementation(Deps.junit4Params) diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt index e571378ed..912b57887 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt @@ -9,7 +9,7 @@ import org.partiql.eval.Statement import org.partiql.parser.PartiQLParser import org.partiql.plan.rel.RelLimit import org.partiql.planner.PartiQLPlanner -import org.partiql.system.PartiQLSession +import org.partiql.spi.catalog.Session import kotlin.test.Test import kotlin.test.assertTrue @@ -20,7 +20,7 @@ public class StrategyTest { private val parser = PartiQLParser.standard() private val planner = PartiQLPlanner.standard() - private val session = PartiQLSession.empty() + private val session = Session.empty() private class MyLimit : ExprRelation { override fun open(env: Environment) = error("open") diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt index 5042435a1..32bd8d72b 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt @@ -8,10 +8,10 @@ import org.partiql.plan.Plan import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Name +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.StaticType import org.partiql.types.fromStaticType import org.partiql.value.PartiQLValue @@ -64,7 +64,7 @@ public class SuccessTestCase( } } .build() - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("memory") .catalogs(catalog) .build() diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt index de7f5ba4d..dda974399 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt @@ -7,8 +7,8 @@ import org.partiql.parser.PartiQLParser import org.partiql.plan.Plan import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog +import org.partiql.spi.catalog.Session import org.partiql.spi.value.Datum -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental @@ -62,7 +62,7 @@ public class TypingTestCase @OptIn(PartiQLValueExperimental::class) constructor( assertEquals(1, parseResult.statements.size) val statement = parseResult.statements[0] val catalog = Catalog.builder().name("memory").build() - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("memory") .catalogs(catalog) .build() diff --git a/partiql-planner/build.gradle.kts b/partiql-planner/build.gradle.kts index c54b040c1..88a0586b8 100644 --- a/partiql-planner/build.gradle.kts +++ b/partiql-planner/build.gradle.kts @@ -37,7 +37,6 @@ dependencies { annotationProcessor(Deps.lombok) // Test testImplementation(project(":partiql-parser")) - testImplementation(project(":partiql-system")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType testImplementation(Deps.kotlinReflect) // Test Fixtures diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt index 86c5ed70c..da8e6ed8f 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt @@ -102,25 +102,8 @@ internal class Env(private val session: Session) { error("Qualified functions are not supported.") } - // Search in SQL Path - session.getPath().forEach { catalogName -> - // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. - if (catalogName.getLength() != 1) { - return@forEach - } - val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach - val candidates = getCandidates(catalog, identifier, args) - if (candidates.isNotEmpty()) { - return candidates - } - } - return emptyList() - } - - /** - * Given a [catalog], searches for candidate functions. - */ - private fun getCandidates(catalog: Catalog, identifier: Identifier, args: List): List { + // 1. Search in the current catalog and namespace. + val catalog = default val name = identifier.getIdentifier().getText().lowercase() // CASE-NORMALIZED LOWER val variants = catalog.getFunctions(session, name).toList() val candidates = variants.filter { it.getParameters().size == args.size } @@ -135,35 +118,14 @@ internal class Env(private val session: Session) { * @return */ fun resolveFn(identifier: Identifier, args: List): Rex? { + // Reject qualified routine names. if (identifier.hasQualifier()) { error("Qualified functions are not supported.") } - // Search in SQL Path - session.getPath().forEach { catalogName -> - // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. - if (catalogName.getLength() != 1) { - return@forEach - } - val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach - val candidates = resolveFn(catalog, identifier, args) - if (candidates != null) { - return candidates - } - } - return null - } - - /** - * TODO leverage session PATH. - * - * @param identifier - * @param args - * @return - */ - private fun resolveFn(catalog: Catalog, identifier: Identifier, args: List): Rex? { // 1. Search in the current catalog and namespace. + val catalog = default val name = identifier.getIdentifier().getText().lowercase() // CASE-NORMALIZED LOWER val variants = catalog.getFunctions(session, name).toList() if (variants.isEmpty()) { @@ -208,25 +170,10 @@ internal class Env(private val session: Session) { } fun resolveAgg(path: String, setQuantifier: SetQuantifier, args: List): Rel.Op.Aggregate.Call.Resolved? { - // Search in SQL Path - session.getPath().forEach { catalogName -> - // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. - if (catalogName.getLength() != 1) { - return@forEach - } - val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach - val agg = resolveAgg(catalog, path, setQuantifier, args) - if (agg != null) { - return agg - } - } - return null - } - - private fun resolveAgg(catalog: Catalog, path: String, setQuantifier: SetQuantifier, args: List): Rel.Op.Aggregate.Call.Resolved? { // TODO: Eventually, do we want to support sensitive lookup? With a path? // 1. Search in the current catalog and namespace. + val catalog = default val name = path.lowercase() val candidates = catalog.getAggregations(session, name).toList() if (candidates.isEmpty()) { diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt index 355c154b8..edf5f02d1 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt @@ -11,7 +11,7 @@ import org.partiql.planner.internal.TestCatalog import org.partiql.planner.test.PartiQLTest import org.partiql.planner.test.PartiQLTestProvider import org.partiql.spi.catalog.Name -import org.partiql.system.PartiQLSessionBuilder +import org.partiql.spi.catalog.Session import org.partiql.types.BagType import org.partiql.types.StaticType import org.partiql.types.StructType @@ -66,7 +66,7 @@ class PlanTest { ) private val pipeline: (PartiQLTest, Boolean) -> PartiQLPlanner.Result = { test, isSignalMode -> - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("default") .catalogs( TestCatalog.builder() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt index 4740ce545..b426325d6 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt @@ -12,8 +12,8 @@ import org.partiql.planner.util.PErrorCollector import org.partiql.planner.util.PlanPrinter import org.partiql.spi.Context import org.partiql.spi.catalog.Catalog +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.Field import org.partiql.types.PType @@ -38,7 +38,7 @@ internal class PlannerPErrorReportingTests { .define(Table.empty("struct_with_missing", PType.row(listOf(Field.of("f1", PType.smallint()))))) .build() - private val session = PartiQLSessionBuilder() + private val session = Session.builder() .catalog(catalogName) .catalogs(catalog) .build() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt index 6e4d04461..191ccf921 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt @@ -17,7 +17,7 @@ import org.partiql.plan.rex.RexSelect import org.partiql.plan.rex.RexVar import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog -import org.partiql.system.PartiQLSessionBuilder +import org.partiql.spi.catalog.Session import java.util.stream.Stream import kotlin.test.assertEquals @@ -41,7 +41,7 @@ class SubsumptionTest { val parseResult = parser.parse(text) assertEquals(1, parseResult.statements.size) val statement = parseResult.statements[0] - val session = PartiQLSessionBuilder().catalog("default").catalogs(catalog).build() + val session = Session.builder().catalog("default").catalogs(catalog).build() val plan = planner.plan(statement, session).plan val excludeClause = getExcludeClause(plan.getOperation()).getExclusions() assertEquals(tc.expectedExcludeExprs, excludeClause) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt index decb32594..42d534ebd 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt @@ -16,7 +16,6 @@ import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.types.StaticType import org.partiql.types.fromStaticType @@ -43,7 +42,7 @@ abstract class PartiQLTyperTestBase { public val planner = PartiQLPlanner.standard() internal val session: ((String, Catalog) -> Session) = { catalog, metadata -> - PartiQLSessionBuilder() + Session.builder() .catalog(catalog) .catalogs(metadata) .build() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt index bc8ff98f5..6d6d12f03 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt @@ -21,8 +21,8 @@ import org.partiql.planner.util.PErrorCollector import org.partiql.spi.Context import org.partiql.spi.catalog.Identifier import org.partiql.spi.catalog.Name +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValueExperimental import org.partiql.value.int32Value @@ -120,7 +120,7 @@ class PlanTyperTest { private fun getTyper(): PlanTyperWrapper { val config = Context.of(PErrorCollector()) val env = Env( - PartiQLSessionBuilder() + Session.builder() .catalog("pql") .namespace("main") .catalogs( diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt index 04b4f0c73..13d06bd03 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt @@ -32,7 +32,6 @@ import org.partiql.spi.catalog.Name import org.partiql.spi.catalog.Session import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.DecimalType import org.partiql.types.Field @@ -3825,7 +3824,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: SuccessTestCase) { - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) @@ -3868,7 +3867,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: ErrorTestCase) { - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) @@ -3912,7 +3911,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: ThrowingExceptionTestCase) { - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt index 2d32bf9b5..276bda5cf 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt @@ -10,7 +10,7 @@ import org.partiql.planner.internal.ir.relBinding import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Identifier -import org.partiql.system.PartiQLSessionBuilder +import org.partiql.spi.catalog.Session import org.partiql.types.PType import kotlin.test.assertEquals import kotlin.test.fail @@ -36,7 +36,7 @@ internal class ScopeTest { @JvmStatic val locals = TypeEnv( Env( - PartiQLSessionBuilder() + Session.builder() .catalog("currentCatalog") .catalogs(catalog) .build() diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 020f1dabf..4baeaffee 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -202,7 +202,6 @@ public final class org/partiql/spi/catalog/Namespace : java/lang/Iterable, kotli public synthetic fun ([Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun append ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace; public final fun asIdentifier ()Lorg/partiql/spi/catalog/Identifier; - public static final fun empty ()Lorg/partiql/spi/catalog/Namespace; public fun equals (Ljava/lang/Object;)Z public fun forEach (Ljava/util/function/Consumer;)V public final fun get (I)Ljava/lang/String; @@ -262,6 +261,7 @@ public final class org/partiql/spi/catalog/Session$Builder { public final fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/spi/catalog/Session$Builder; public final fun namespace ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; public final fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; + public final fun systemCatalog (Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Session$Builder; } public final class org/partiql/spi/catalog/Session$Companion { diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java b/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java similarity index 80% rename from partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java rename to partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java index 980a78737..87cc927de 100644 --- a/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java +++ b/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java @@ -1,23 +1,22 @@ -package org.partiql.system; +package org.partiql.spi.catalog; -import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.partiql.spi.catalog.Catalog; -import org.partiql.spi.catalog.Identifier; -import org.partiql.spi.catalog.Name; -import org.partiql.spi.catalog.Session; -import org.partiql.spi.catalog.Table; import org.partiql.spi.function.Aggregation; +import org.partiql.spi.function.Builtins; import org.partiql.spi.function.Function; import java.util.Collection; /** - * This is a package-private class that implements the PartiQL System Catalog. + *

+ * This implements the PartiQL System Catalog. + *

+ *

* It provides the implementation for the PartiQL System Catalog, which is a built-in catalog * that provides access to the PartiQL language and its built-in functions and aggregations. - * @see PartiQLSessionBuilder + *

+ * @see Session.Builder */ final class PartiQLSystemCatalog implements Catalog { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt index 7f358a223..d7233390b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt @@ -2,6 +2,7 @@ package org.partiql.spi.catalog import org.partiql.spi.catalog.impl.StandardCatalog import org.partiql.spi.function.Aggregation +import org.partiql.spi.function.Builtins import org.partiql.spi.function.Function /** @@ -21,9 +22,7 @@ public interface Catalog { /** * Get a table by name. */ - public fun getTable(session: Session, name: Name): Table? { - return null - } + public fun getTable(session: Session, name: Name): Table? = null /** * Get a table by identifier. @@ -42,23 +41,17 @@ public interface Catalog { * 2. Invoke getTable("a"."b"."c"."Example"."x") * 3. The implementation MUST match "a"."b"."c"."Example" to a.b.c.Example (note "x" does not match a table) */ - public fun getTable(session: Session, identifier: Identifier): Table? { - return null - } + public fun getTable(session: Session, identifier: Identifier): Table? = null /** * Returns a collection of scalar functions in this catalog with the given name, or an empty list if none. */ - public fun getFunctions(session: Session, name: String): Collection { - return emptyList() - } + public fun getFunctions(session: Session, name: String): Collection = Builtins.getFunctions(name) /** * Returns a collection of aggregation functions in this catalog with the given name, or an empty list if none. */ - public fun getAggregations(session: Session, name: String): Collection { - return emptyList() - } + public fun getAggregations(session: Session, name: String): Collection = Builtins.getAggregations(name) public companion object { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt index a597dba25..170bf5b98 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt @@ -81,7 +81,6 @@ public class Namespace private constructor( private val EMPTY = Namespace(emptyArray()) - @JvmStatic public fun empty(): Namespace = EMPTY @JvmStatic diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index fd114a82f..cd2a50358 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -64,6 +64,8 @@ public interface Session { private var identity: String = "unknown" private var catalog: String? = null + private var systemCatalogName: String = "\$pql_system" + private var systemCatalog: Catalog = PartiQLSystemCatalog(systemCatalogName) private var catalogs: Catalogs.Builder = Catalogs.builder() private var namespace: Namespace = Namespace.empty() private var properties: MutableMap = mutableMapOf() @@ -98,6 +100,16 @@ public interface Session { return this } + /** + * Adds and designates a catalog to always be on the SQL-Path. This [catalog] provides all built-in functions + * to the system at hand. + * If this is never invoked, a default system catalog is provided. + */ + public fun systemCatalog(catalog: Catalog): Builder { + this.systemCatalogName = catalog.getName() + return this + } + /** * Adds catalogs to this session. */ @@ -110,16 +122,24 @@ public interface Session { public fun build(): Session = object : Session { - private val _catalogs = catalogs.build() + private val _catalogs: Catalogs + private val systemCatalogNamespace: Namespace = Namespace.of(systemCatalogName) init { require(catalog != null) { "Session catalog must be set" } + catalogs.add(systemCatalog) + _catalogs = catalogs.build() } override fun getIdentity(): String = identity override fun getCatalog(): String = catalog!! override fun getCatalogs(): Catalogs = _catalogs override fun getNamespace(): Namespace = namespace + + override fun getPath(): Path { + val currentNamespace = getNamespace() + return Path.of(currentNamespace, systemCatalogNamespace) + } } } } diff --git a/partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt index 5dec5232f..cdd7f2f47 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt @@ -1,9 +1,7 @@ -package org.partiql.system +package org.partiql.spi.function /* ktlint-disable no-wildcard-imports */ -import org.partiql.spi.function.Aggregation -import org.partiql.spi.function.Function -import org.partiql.system.builtins.* +import org.partiql.spi.function.builtins.* /** * This is where we will register all SQL builtins; consider raising a "library" interface. @@ -184,8 +182,8 @@ internal object Builtins { Fn_LIKE_ESCAPE__STRING_STRING_STRING__BOOL, Fn_LIKE_ESCAPE__CLOB_CLOB_CLOB__BOOL, - org.partiql.system.builtins.Fn_LOWER__STRING__STRING, - org.partiql.system.builtins.Fn_LOWER__CLOB__CLOB, + Fn_LOWER__STRING__STRING, + Fn_LOWER__CLOB__CLOB, FnLt, FnLte, diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt similarity index 83% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt index 105bb3f59..cadee2aaa 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorAnySome +import org.partiql.spi.function.builtins.internal.AccumulatorAnySome import org.partiql.types.PType internal val Agg_ANY__BOOL__BOOL = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt index 96c4e4331..d78de2bd4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorAvg +import org.partiql.spi.function.builtins.internal.AccumulatorAvg import org.partiql.types.PType // TODO: This needs to be formalized. See https://github.com/partiql/partiql-lang-kotlin/issues/1659 diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt similarity index 77% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt index 04967cc12..50abf3861 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorCount +import org.partiql.spi.function.builtins.internal.AccumulatorCount import org.partiql.types.PType internal val Agg_COUNT__ANY__INT64 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt similarity index 85% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt index f009d8d6a..6973374d0 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorEvery +import org.partiql.spi.function.builtins.internal.AccumulatorEvery import org.partiql.types.PType internal val Agg_EVERY__BOOL__BOOL = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt similarity index 78% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt index 11cff8fc9..90630e8cf 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorGroupAs +import org.partiql.spi.function.builtins.internal.AccumulatorGroupAs import org.partiql.types.PType internal val Agg_GROUP_AS__ANY__ANY = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt index 9d4ac8ad5..de8831d7b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorMax +import org.partiql.spi.function.builtins.internal.AccumulatorMax import org.partiql.types.PType internal val Agg_MAX__INT8__INT8 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt index 8ceddf8b1..140f569fe 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorMin +import org.partiql.spi.function.builtins.internal.AccumulatorMin import org.partiql.types.PType internal val Agg_MIN__INT8__INT8 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt similarity index 84% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt index 32dad874d..6b28cfaee 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorAnySome +import org.partiql.spi.function.builtins.internal.AccumulatorAnySome import org.partiql.types.PType internal val Agg_SOME__BOOL__BOOL = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt index af22fe007..b661e6dc7 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorSum +import org.partiql.spi.function.builtins.internal.AccumulatorSum import org.partiql.types.PType internal val Agg_SUM__INT8__INT8 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt similarity index 83% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt index 5bdd8c291..cb9d44a30 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt index 920fb0518..ff5ac52a6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt index 880c4cfcd..948d5af29 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt index 824340421..bd233083c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt @@ -1,10 +1,10 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter +import org.partiql.spi.function.builtins.TypePrecedence.TYPE_PRECEDENCE import org.partiql.spi.internal.SqlTypeFamily import org.partiql.spi.value.Datum -import org.partiql.system.builtins.TypePrecedence.TYPE_PRECEDENCE import org.partiql.types.PType /** diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt index caefef2f2..d97538786 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt index c5e16aacb..07399b386 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt index 161b21ec7..3df72bc16 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt index 897314947..ba477cdbf 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt index 379ae624a..f2e1db52b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt index a4a620dcf..8a37a7ea1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt index b92b0475e..ebb7b550c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt similarity index 81% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt index d571c6b94..09a09f782 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt @@ -1,20 +1,20 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter +import org.partiql.spi.function.builtins.internal.Accumulator +import org.partiql.spi.function.builtins.internal.AccumulatorAnySome +import org.partiql.spi.function.builtins.internal.AccumulatorAvg +import org.partiql.spi.function.builtins.internal.AccumulatorCount +import org.partiql.spi.function.builtins.internal.AccumulatorDistinct +import org.partiql.spi.function.builtins.internal.AccumulatorEvery +import org.partiql.spi.function.builtins.internal.AccumulatorMax +import org.partiql.spi.function.builtins.internal.AccumulatorMin +import org.partiql.spi.function.builtins.internal.AccumulatorSum import org.partiql.spi.value.Datum -import org.partiql.system.builtins.internal.Accumulator -import org.partiql.system.builtins.internal.AccumulatorAnySome -import org.partiql.system.builtins.internal.AccumulatorAvg -import org.partiql.system.builtins.internal.AccumulatorCount -import org.partiql.system.builtins.internal.AccumulatorDistinct -import org.partiql.system.builtins.internal.AccumulatorEvery -import org.partiql.system.builtins.internal.AccumulatorMax -import org.partiql.system.builtins.internal.AccumulatorMin -import org.partiql.system.builtins.internal.AccumulatorSum import org.partiql.types.PType internal abstract class Fn_COLL_AGG__BAG__ANY( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt index 33e3226d9..d8e90d651 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt index 4551bb3c6..3fe9cc2ae 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt index 20c9554a7..4b234ecec 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt index 8a67a8e16..98f9e4f5a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt index 96ca62229..be21e3c08 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt index 2aec5b557..9811538a9 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt index 3a30bb309..5a61e31c5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt index fc19f32c8..53c3415e5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt index 64256e509..4beae8cbb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt index d48c5d6c9..9b3ce54b0 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt index 759063645..f8bd4bada 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt index b938f39ed..3ec423190 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt index 33b9c79e1..634bb52e4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt index 377577842..e2cedd215 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt index d37cf0ab3..483f59e7d 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt index 4577294f3..cc1f6f1a2 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt index b5372e0fe..22d8582bb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt index 455489b15..09c2b06f8 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt index 22cb3d0fc..dfe6db4cb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt index 677029538..c0077be00 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnGt : DiadicComparisonOperator("gt") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt index dd3d0c775..9a581b5c2 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnGte : DiadicComparisonOperator("gte") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt index 0c926afc2..c54fe8f12 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName", "DEPRECATION") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt index b2b100e8e..c9ebf47aa 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt index 4628f8e0d..e35758ea2 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt index e4cf405c8..c92e3a3a6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt index 3134c4a5f..abefbf0bb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt index cc20b069f..2ca7040c4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt index fed6c6e66..45a710121 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt index 4f7f21b9e..ae1da6b8f 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt index 7672c439b..d88d0849e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt index 8cd774a50..adf281acd 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt index b3590fb99..3cc07bb7e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt index e83b10cf6..0f873d9f8 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt similarity index 92% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt index 63721bdea..424c0a86d 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt similarity index 93% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt index 194783dee..09bdf95c6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt index 0b5621131..8bf34170e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt index fc0790124..3c16b7383 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt index b49b0ca64..1a55a5155 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt index bb5b9c680..46379417b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt index 04a3e565e..2141027c1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt index 3201bdfa0..0bf3d3819 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt index 2b4d903e3..7acb5188c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt index 678c0a8e4..d3d258db8 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt index 5ca9d51af..2d6c98133 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt index 73a6fcdfc..e83155c0c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt index 1776e1ef7..ae3f6b36c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt index 46fe11abd..63f798281 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt index 3b56081df..7d2801dd0 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt index 6efcdd42e..88093f28a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt index e06a919cd..ebca15aee 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt index a9065acce..8e526a2be 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnLt : DiadicComparisonOperator("lt") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt index 6ce9316bb..35d6cba0e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnLte : DiadicComparisonOperator("lte") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt index fef010eaf..df7de273c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt index a40fcf8eb..a785a020e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt index 9f7c0f40a..0ebc9380c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt index 4f6b1437f..c605f7800 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt index ba630fa70..b4ea074e9 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt index c200a8cdf..e643d9eb1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt index ed88a8bd0..576951390 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt index 3ecf26782..bb0ab5085 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt index f6ae1e29d..27992ebc8 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt index f8e60c581..554dbd253 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt index b9ca5c041..1872b9ef5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt index a2490e0eb..9e3b00f64 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt index cdf0fc367..6da1ea25f 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt index 48620b725..1a57fc043 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt index 9dcad5894..c1452755a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt index c9ae36ae2..600e6003d 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt index b5c5fc306..2431ea54e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt index d74a659e9..d6895e14e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt index 0fa40694b..f5a118a13 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt index 7632c8753..988724510 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt index 193ff04a4..3cfc527e6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt index e22f21dbd..6e8ae0082 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt @@ -12,14 +12,14 @@ * language governing permissions and limitations under the License. */ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import com.amazon.ion.Decimal import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Aggregation import org.partiql.spi.value.Datum -import org.partiql.system.internal.coerceNumbers import org.partiql.types.PType +import org.partiql.value.util.coerceNumbers import java.math.BigDecimal import java.math.BigInteger import java.math.MathContext diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt similarity index 89% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt index 2768062fb..8e6c8ca29 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt index b170d72f2..1b5b6a462 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt similarity index 82% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt index d19bc28f7..fd18cbcc6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt similarity index 85% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt index a98795cf1..d45a9240f 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.function.Aggregation import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt similarity index 89% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt index a314b01f2..330b4858b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import java.util.TreeSet diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt index 88ca5454b..d7cb1d35a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt similarity index 83% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt index fb7791ee8..32da479b3 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt similarity index 86% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt index 73ca296ec..c1a147041 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt similarity index 86% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt index 580e75834..dbaf42801 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt index 7f555e76c..c293a66d3 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt similarity index 100% rename from partiql-system/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt similarity index 100% rename from partiql-system/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt diff --git a/partiql-system/api/partiql-system.api b/partiql-system/api/partiql-system.api deleted file mode 100644 index 53162b793..000000000 --- a/partiql-system/api/partiql-system.api +++ /dev/null @@ -1,28 +0,0 @@ -public final class org/partiql/system/PartiQLSession : org/partiql/spi/catalog/Session { - public static fun empty ()Lorg/partiql/spi/catalog/Session; - public fun getCatalog ()Ljava/lang/String; - public fun getCatalogs ()Lorg/partiql/spi/catalog/Catalogs; - public fun getIdentity ()Ljava/lang/String; - public fun getNamespace ()Lorg/partiql/spi/catalog/Namespace; - public fun getPath ()Lorg/partiql/spi/catalog/Path; - public fun getProperties ()Ljava/util/Map; -} - -public final class org/partiql/system/PartiQLSessionBuilder { - public fun ()V - public fun build ()Lorg/partiql/spi/catalog/Session; - public fun catalog (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun catalogs ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun identity (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun namespace (Ljava/util/Collection;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun namespace ([Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun noSystemCatalog ()Lorg/partiql/system/PartiQLSessionBuilder; - public fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun systemCatalogName (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; -} - -public final class org/partiql/system/internal/NumberExtensionsKt { - public static final fun coerceNumbers (Ljava/lang/Number;Ljava/lang/Number;)Lkotlin/Pair; -} - diff --git a/partiql-system/build.gradle.kts b/partiql-system/build.gradle.kts deleted file mode 100644 index 86ff4b227..000000000 --- a/partiql-system/build.gradle.kts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -plugins { - id(Plugins.conventions) - id(Plugins.publish) -} - -dependencies { - api(project(":partiql-spi")) - api(project(":partiql-types")) - compileOnly(Deps.lombok) - annotationProcessor(Deps.lombok) -} - -// TODO: Once we move to only public Java APIs, we can use Javadoc. -// Need to add this as we have both Java and Kotlin sources. Dokka already handles multi-language projects. If -// Javadoc is enabled, we end up overwriting index.html (causing compilation errors). -tasks.withType { - enabled = false -} - -tasks.withType { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - -publish { - artifactId = "partiql-catalog" - name = "PartiQL Catalog" - description = "Contains all of the PartiQL System's functions and operators." -} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java deleted file mode 100644 index 9ef1d96d9..000000000 --- a/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.partiql.system; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.partiql.spi.catalog.Catalogs; -import org.partiql.spi.catalog.Namespace; -import org.partiql.spi.catalog.Path; -import org.partiql.spi.catalog.Session; - -import java.util.HashMap; -import java.util.Map; - -/** - * This is a package-private implementation of {@link Session}. - * @see PartiQLSessionBuilder - */ -public final class PartiQLSession implements Session { - - @NotNull - private final Catalogs _catalogs; - - @NotNull - private final String identity; - - @Nullable - private final Namespace systemCatalogNamespace; - - @NotNull - private final String currentCatalog; - - @NotNull - private final Namespace namespace; - - @NotNull - private final Map properties; - - PartiQLSession(boolean usesSystemCatalog, @NotNull String systemCatalogName, @NotNull String identity, @NotNull String catalog, @NotNull Namespace namespace, @NotNull Catalogs.Builder catalogs, @NotNull Map properties) { - this.systemCatalogNamespace = usesSystemCatalog ? Namespace.of(systemCatalogName) : null; - this.identity = identity; - this.currentCatalog = catalog; - this.namespace = namespace; - this.properties = properties; - if (usesSystemCatalog) { - catalogs.add(new PartiQLSystemCatalog(systemCatalogName)); - } - this._catalogs = catalogs.build(); - } - - @NotNull - @Override - public Map getProperties() { - return properties; - } - - @NotNull - @Override - public Path getPath() { - return Path.of(getNamespace(), systemCatalogNamespace); - } - - @NotNull - @Override - public String getIdentity() { - return identity; - } - - @NotNull - @Override - public String getCatalog() { - return currentCatalog; - } - - @NotNull - @Override - public Catalogs getCatalogs() { - return _catalogs; - } - - @NotNull - @Override - public Namespace getNamespace() { - return namespace; - } - - /** - * - * @return a session only holding the system catalog. - */ - @NotNull - public static Session empty() { - return new PartiQLSession( - true, - "$pql_system", - "unknown", - "$pql_system", - Namespace.of(), - Catalogs.builder(), - new HashMap<>() - ); - } -} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java deleted file mode 100644 index 515672fcd..000000000 --- a/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.partiql.system; - -import org.jetbrains.annotations.NotNull; -import org.partiql.spi.catalog.Catalog; -import org.partiql.spi.catalog.Catalogs; -import org.partiql.spi.catalog.Namespace; -import org.partiql.spi.catalog.Session; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * This creates a {@link Session} while also installing the PartiQL System Catalog by default (unless - * {@link PartiQLSessionBuilder#noSystemCatalog()} is specified). The resulting {@link Session} will append the System - * Catalog to the end of the {@link Session#getPath()}. - * @see PartiQLSessionBuilder#noSystemCatalog() - * @see PartiQLSessionBuilder#systemCatalogName(String) - */ -public final class PartiQLSessionBuilder { - - private String identity = "unknown"; - private String catalog = null; - private final Catalogs.Builder catalogs = Catalogs.builder(); - private Namespace namespace = Namespace.empty(); - private final Map properties = new HashMap<>(); - private boolean usesSystemCatalog = true; - private String systemCatalogName = "$partiql_system"; - - /** - * TODO - * @param identity TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder identity(String identity) { - this.identity = identity; - return this; - } - - /** - * Removes the system catalog from the session. - * @return the builder - */ - @NotNull - public PartiQLSessionBuilder noSystemCatalog() { - this.usesSystemCatalog = false; - return this; - } - - /** - * Sets the name of the system catalog. - * @param name the desired name - * @return the builder - */ - @NotNull - public PartiQLSessionBuilder systemCatalogName(@NotNull String name) { - this.systemCatalogName = name; - return this; - } - - /** - * TODO - * @param catalog TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder catalog(String catalog) { - this.catalog = catalog; - return this; - } - - /** - * TODO - * @param namespace TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder namespace(Namespace namespace) { - this.namespace = namespace; - return this; - } - - /** - * TODO - * @param levels TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder namespace(String... levels) { - this.namespace = Namespace.of(levels); - return this; - } - - /** - * TODO - * @param levels TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder namespace(Collection levels) { - this.namespace = Namespace.of(levels); - return this; - } - - /** - * TODO - * @param name TODO - * @param value TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder property(String name, String value) { - this.properties.put(name, value); - return this; - } - - /** - * TODO - * @param catalogs TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder catalogs(Catalog... catalogs) { - for (Catalog catalog : catalogs) { - this.catalogs.add(catalog); - } - return this; - } - - /** - * TODO - * @return TODO - */ - @NotNull - public Session build() { - return new PartiQLSession(usesSystemCatalog, systemCatalogName, identity, catalog, namespace, catalogs, properties); - } -} diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt b/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt deleted file mode 100644 index cc2dabd86..000000000 --- a/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt +++ /dev/null @@ -1,75 +0,0 @@ -package org.partiql.spi.internal - -import org.partiql.types.PType - -/** - * A basic "set" representation for type categorization; perhaps we optimize later.. - * - * From Calcite, - * > SqlTypeFamily provides SQL type categorization. - * > Primary Families - * > CHARACTER, - * > BINARY, - * > NUMERIC, - * > DATE, - * > TIME, - * > TIMESTAMP, - * > BOOLEAN, - * > https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java - * - * - * From Postgres, - * > Data types are divided into several basic type categories, including boolean, numeric, string, bitstring, datetime, - * > timespan, geometric, network, and user-defined. Within each category there can be one or more preferred types, - * > which are preferred when there is a choice of possible types. - */ -internal class SqlTypeFamily private constructor( - @JvmField val preferred: PType, - @JvmField val members: Set, -) { - - /** - * Constructor a singleton [SqlTypeFamily]. - */ - constructor(preferred: PType) : this(preferred, setOf(preferred.code())) - - operator fun contains(type: PType) = type.code() in members - - companion object { - - @JvmStatic - val TEXT = SqlTypeFamily( - preferred = PType.string(), - members = setOf( - PType.CHAR, - PType.VARCHAR, - PType.STRING, - PType.CLOB, - ) - ) - - @JvmStatic - val COLLECTION = SqlTypeFamily( - preferred = PType.bag(), - members = setOf( - PType.ARRAY, - PType.BAG - ) - ) - - @JvmStatic - val NUMBER = SqlTypeFamily( - preferred = PType.decimal(38, 19), - members = setOf( - PType.TINYINT, - PType.SMALLINT, - PType.INTEGER, - PType.BIGINT, - PType.NUMERIC, - PType.REAL, - PType.DOUBLE, - PType.DECIMAL, - ) - ) - } -} diff --git a/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt b/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt deleted file mode 100644 index 811fa680d..000000000 --- a/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt +++ /dev/null @@ -1,202 +0,0 @@ -package org.partiql.system.internal - -/* - * Copyright 2019 Amazon.com, Inc. or its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at: - * - * http://aws.amazon.com/apache2.0/ - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific - * language governing permissions and limitations under the License. - */ - -import com.amazon.ion.Decimal -import java.math.BigDecimal -import java.math.BigInteger -import java.math.MathContext -import java.math.RoundingMode - -/** - * Essentially the same as partiql-lang's NumberExtensions.kt. Key differences are the following: - * - Adding [Int] and [Float] branch when casing on the [Number] - * - TODO support for integer types smaller than [Int] - */ - -// TODO should this be configurable? -private val MATH_CONTEXT = MathContext(38, RoundingMode.HALF_EVEN) - -/** - * Factory function to create a [BigDecimal] using correct precision, use it in favor of native BigDecimal constructors - * and factory methods - */ -internal fun bigDecimalOf(num: Number, mc: MathContext = MATH_CONTEXT): BigDecimal = when (num) { - is Decimal -> num - is Int -> BigDecimal(num, mc) - is Long -> BigDecimal(num, mc) - is Float -> BigDecimal(num.toDouble(), mc) - is Double -> BigDecimal(num, mc) - is BigInteger -> BigDecimal(num, mc) - is BigDecimal -> num - is BigInteger -> num.toBigDecimal() - else -> throw IllegalArgumentException("Unsupported number type: $num, ${num.javaClass}") -} - -/** - * This should handle Byte, Short, Int, Long, BigInteger, Float, Double, BigDecimal - */ -private val CONVERSION_MAP = mapOf>, Class>( - // BYTE - setOf(Byte::class.javaObjectType, Byte::class.javaObjectType) to Byte::class.javaObjectType, - setOf(Byte::class.javaObjectType, Short::class.javaObjectType) to Short::class.javaObjectType, - setOf(Byte::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, - setOf(Byte::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Byte::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Byte::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, - setOf(Byte::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Byte::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // SHORT - setOf(Short::class.javaObjectType, Byte::class.javaObjectType) to Short::class.javaObjectType, - setOf(Short::class.javaObjectType, Short::class.javaObjectType) to Short::class.javaObjectType, - setOf(Short::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, - setOf(Short::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Short::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Short::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, - setOf(Short::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Short::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // INT - setOf(Int::class.javaObjectType, Byte::class.javaObjectType) to Int::class.javaObjectType, - setOf(Int::class.javaObjectType, Short::class.javaObjectType) to Int::class.javaObjectType, - setOf(Int::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, - setOf(Int::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Int::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Int::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(Int::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Int::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // LONG - setOf(Long::class.javaObjectType, Byte::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, Short::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, Int::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Long::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(Long::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Long::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // FLOAT - setOf(Float::class.javaObjectType, Byte::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Short::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Int::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Long::class.javaObjectType) to Double::class.javaObjectType, - setOf(Float::class.javaObjectType, BigInteger::class.javaObjectType) to Double::class.javaObjectType, - setOf(Float::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Float::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // DOUBLE - setOf(Double::class.javaObjectType, Byte::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Short::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Int::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Long::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, BigInteger::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // BIG INTEGER - setOf(BigInteger::class.javaObjectType, Byte::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Short::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Int::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Long::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // BIG DECIMAL - setOf(BigDecimal::class.javaObjectType, Byte::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Short::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Int::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Long::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, BigInteger::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Float::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Double::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, -) - -private val CONVERTERS = mapOf, (Number) -> Number>( - Byte::class.javaObjectType to Number::toByte, - Short::class.javaObjectType to Number::toShort, - Int::class.javaObjectType to Number::toInt, - Long::class.javaObjectType to Number::toLong, - Float::class.javaObjectType to Number::toFloat, - Double::class.javaObjectType to Number::toDouble, - BigInteger::class.javaObjectType to { num -> - when (num) { - is Byte -> num.toInt().toBigInteger() - is Short -> num.toInt().toBigInteger() - is Int -> num.toBigInteger() - is Long -> num.toBigInteger() - is BigInteger -> num - else -> throw IllegalArgumentException( - "Unsupported number for BigInteger conversion: $num" - ) - } - }, - BigDecimal::class.java to { num -> - when (num) { - is Byte -> bigDecimalOf(num) - is Short -> bigDecimalOf(num) - is Int -> bigDecimalOf(num) - is Long -> bigDecimalOf(num) - is Float -> bigDecimalOf(num) - is Double -> bigDecimalOf(num) - is BigDecimal -> bigDecimalOf(num) - is BigInteger -> bigDecimalOf(num) - else -> throw IllegalArgumentException( - "Unsupported number for decimal conversion: $num (${num.javaClass.simpleName})" - ) - } - } -) - -@Suppress("UNCHECKED_CAST") -/** Provides a narrowing or widening operator on supported numbers. */ -internal fun Number.coerce(type: Class): T where T : Number { - val conv = CONVERTERS[type] ?: throw IllegalArgumentException("No converter for $type") - return conv(this) as T -} - -/** - * Implements a very simple number tower to convert two numbers to their arithmetic - * compatible type. - * - * This is only supported on limited types needed by the expression system. - * TODO: Make no longer public. - */ -public fun coerceNumbers(first: Number, second: Number): Pair { - fun typeFor(n: Number): Class<*> = if (n is Decimal) { - BigDecimal::class.javaObjectType - } else { - n.javaClass - } - - val type = CONVERSION_MAP[setOf(typeFor(first), typeFor(second))] - ?: throw IllegalArgumentException("No coercion support for ${typeFor(first)} to ${typeFor(second)}") - - return Pair(first.coerce(type), second.coerce(type)) -} - -internal operator fun Number.compareTo(other: Number): Int { - val (first, second) = coerceNumbers(this, other) - return when (first) { - is Byte -> first.compareTo(second as Byte) - is Short -> first.compareTo(second as Short) - is Int -> first.compareTo(second as Int) - is Long -> first.compareTo(second as Long) - is Float -> first.compareTo(second as Float) - is Double -> first.compareTo(second as Double) - is BigDecimal -> first.compareTo(second as BigDecimal) - is BigInteger -> first.compareTo(second as BigInteger) - else -> throw IllegalStateException() - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 88c7f09c7..82f037527 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,3 @@ -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" -} /* * Copyright Amazon.com, Inc. or its affiliates. All rights reserved. * @@ -28,7 +25,6 @@ include( "partiql-plan", "partiql-planner", "partiql-spi", - "partiql-system", "partiql-types", "lib:sprout", "test:coverage-tests", diff --git a/test/partiql-randomized-tests/build.gradle b/test/partiql-randomized-tests/build.gradle index 4434bd78f..dba6bb42c 100644 --- a/test/partiql-randomized-tests/build.gradle +++ b/test/partiql-randomized-tests/build.gradle @@ -23,7 +23,6 @@ dependencies { testImplementation project(':partiql-parser') testImplementation project(':partiql-plan') testImplementation project(':partiql-planner') - testImplementation project(':partiql-system') testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5' testImplementation 'pl.pragmatists:JUnitParams:[1.0.0,1.1.0)' diff --git a/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt b/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt index 604825bbf..432b7531a 100644 --- a/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt +++ b/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt @@ -4,8 +4,8 @@ import org.partiql.eval.compiler.PartiQLCompiler import org.partiql.parser.PartiQLParser import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog +import org.partiql.spi.catalog.Session import org.partiql.spi.value.Datum -import org.partiql.system.PartiQLSessionBuilder import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental import kotlin.test.assertEquals @@ -27,7 +27,7 @@ private fun execute(query: String): PartiQLValue { val catalog = object : Catalog { override fun getName(): String = "default" } - val session = PartiQLSessionBuilder().catalog("default").catalogs(catalog).build() + val session = Session.builder().catalog("default").catalogs(catalog).build() val engine = PartiQLCompiler.builder().build() // Execute diff --git a/test/partiql-tests-runner/build.gradle.kts b/test/partiql-tests-runner/build.gradle.kts index 5ffb99c09..0755f4ccc 100644 --- a/test/partiql-tests-runner/build.gradle.kts +++ b/test/partiql-tests-runner/build.gradle.kts @@ -29,7 +29,6 @@ dependencies { testImplementation(project(":partiql-eval")) testImplementation(project(":partiql-parser", configuration = "shadow")) testImplementation(project(":partiql-planner")) - testImplementation(project(":partiql-system")) } val tests = System.getenv()["PARTIQL_TESTS_DATA"] ?: "../partiql-tests/partiql-tests-data" diff --git a/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt b/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt index 603c5093f..f17b322a6 100644 --- a/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt +++ b/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt @@ -26,7 +26,6 @@ import org.partiql.spi.errors.PErrorException import org.partiql.spi.errors.PErrorListener import org.partiql.spi.errors.Severity import org.partiql.spi.value.Datum -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental @@ -153,7 +152,7 @@ class EvalExecutor( override fun create(env: IonStruct, options: CompileType): TestExecutor { // infer catalog from conformance test `env` val catalog = infer(env.toIonElement() as StructElement) - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("default") .catalogs(catalog) .build() @@ -186,7 +185,7 @@ class EvalExecutor( */ private fun inferEnv(env: AnyElement): PType { val catalog = Catalog.builder().name("default").build() - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("default") .catalogs(catalog) .build()