From b7852b7271b91a8c1d2449cc6caf033cadbd3bd3 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Tue, 10 Dec 2024 09:23:56 -0800 Subject: [PATCH 1/4] Removes PartiQLValue from public API Removes PartiQLValueType from public API Removes PartiQLValueExperimental from public API Removes PartiQLValue reader/writer from public API Moves public and internal APIs to textFixtures until testing can be fully migrated --- .../tutorials/Pluggable Functions Tutorial.md | 3 +- partiql-cli/build.gradle.kts | 1 + .../src/main/kotlin/org/partiql/cli/Main.kt | 8 +- .../kotlin/org/partiql/cli/shell/Shell.kt | 8 +- partiql-eval/build.gradle.kts | 1 + .../eval/internal/helpers/ValueUtility.kt | 10 +- .../internal/operator/rel/RelOpExclude.kt | 6 +- .../internal/operator/rex/ExprCallDynamic.kt | 3 +- .../internal/operator/rex/ExprCoalesce.kt | 2 - .../eval/internal/operator/rex/ExprPathKey.kt | 8 +- .../internal/operator/rex/ExprPathSymbol.kt | 6 +- .../eval/internal/operator/rex/ExprSelect.kt | 3 - .../eval/internal/operator/rex/ExprSpread.kt | 5 +- .../eval/internal/PartiQLEvaluatorTest.kt | 2 - .../partiql/eval/internal/SuccessTestCase.kt | 5 +- .../partiql/eval/internal/TypingTestCase.kt | 10 +- .../operator/rex/ExprCallDynamicTest.kt | 6 +- .../parser/internal/PartiQLParserDDLTests.kt | 2 - partiql-planner/build.gradle.kts | 1 - .../org/partiql/planner/internal/ir/Nodes.kt | 14 +- .../internal/transforms/PlanTransform.kt | 15 +- .../internal/transforms/RelConverter.kt | 13 +- .../internal/transforms/RexConverter.kt | 103 ++- .../planner/internal/typer/DynamicTyper.kt | 69 +- .../planner/internal/typer/PlanTyper.kt | 24 +- .../partiql/planner/internal/typer/Scope.kt | 6 +- .../main/resources/partiql_plan_internal.ion | 2 +- .../planner/internal/typer/PlanTyperTest.kt | 21 +- partiql-spi/api/partiql-spi.api | 590 +----------------- partiql-spi/build.gradle.kts | 7 + .../java/org/partiql/spi/value/Datum.java | 226 +------ .../java/org/partiql/spi/value/DatumTime.java | 9 +- .../org/partiql/spi/value/DatumTimestamp.java | 9 +- .../java/org/partiql/spi/value/Field.java | 2 +- .../partiql/spi/value/ion/IonDatumReader.kt | 85 ++- .../partiql/value/PartiQLValueExperimental.kt | 21 - .../value/PartiQLValueComparatorTest.kt | 1 - .../value/io/PartiQLValueIonSerdeTest.kt | 4 +- .../value/io/PartiQLValueTextWriterTest.kt | 6 +- .../org/partiql/spi/value/DatumUtils.java | 195 ++++++ .../spi/value/PQLToPartiQLIterable.java | 3 +- .../partiql/spi/value/PQLToPartiQLStruct.java | 3 +- .../spi/value/PartiQLToPQLIterable.java | 2 +- .../partiql/spi/value/PartiQLToPQLStruct.java | 2 +- .../spi}/value/io/PartiQLValueIonReader.kt | 5 +- .../spi}/value/io/PartiQLValueIonWriter.kt | 5 +- .../spi}/value/io/PartiQLValueReader.kt | 4 +- .../spi}/value/io/PartiQLValueTextWriter.kt | 5 +- .../spi}/value/io/PartiQLValueWriter.kt | 4 +- .../kotlin/org/partiql/value/PartiQL.kt | 32 - .../kotlin/org/partiql/value/PartiQLValue.kt | 35 +- .../value/PartiQLValueComparatorInternal.kt | 1 - .../org/partiql/value/PartiQLValueType.kt | 3 +- .../kotlin/org/partiql/value/helpers/ToIon.kt | 2 - .../org/partiql/value/impl/Annotations.kt | 5 - .../org/partiql/value/impl/BagValueImpl.kt | 2 - .../org/partiql/value/impl/BinaryValueImpl.kt | 2 - .../org/partiql/value/impl/BlobValueImpl.kt | 2 - .../org/partiql/value/impl/BoolValueImpl.kt | 2 - .../org/partiql/value/impl/ByteValueImpl.kt | 2 - .../org/partiql/value/impl/CharValueImpl.kt | 2 - .../org/partiql/value/impl/ClobValueImpl.kt | 2 - .../org/partiql/value/impl/DateValueImpl.kt | 2 - .../partiql/value/impl/DecimalValueImpl.kt | 2 - .../partiql/value/impl/Float32ValueImpl.kt | 2 - .../partiql/value/impl/Float64ValueImpl.kt | 2 - .../org/partiql/value/impl/Int16ValueImpl.kt | 2 - .../org/partiql/value/impl/Int32ValueImpl.kt | 2 - .../org/partiql/value/impl/Int64ValueImpl.kt | 2 - .../org/partiql/value/impl/Int8ValueImpl.kt | 2 - .../org/partiql/value/impl/IntValueImpl.kt | 2 - .../partiql/value/impl/IntervalValueImpl.kt | 2 - .../org/partiql/value/impl/ListValueImpl.kt | 2 - .../partiql/value/impl/MissingValueImpl.kt | 2 - .../org/partiql/value/impl/NullValueImpl.kt | 2 - .../org/partiql/value/impl/SexpValueImpl.kt | 2 - .../org/partiql/value/impl/StringValueImpl.kt | 2 - .../org/partiql/value/impl/StructValueImpl.kt | 4 - .../org/partiql/value/impl/SymbolValueImpl.kt | 2 - .../org/partiql/value/impl/TimeValueImpl.kt | 2 - .../partiql/value/impl/TimestampValueImpl.kt | 2 - .../value/util/PartiQLValueBaseVisitor.kt | 2 - .../partiql/value/util/PartiQLValueVisitor.kt | 2 - partiql-types/api/partiql-types.api | 1 + .../main/java/org/partiql/types/PType.java | 66 ++ test/partiql-randomized-tests/build.gradle | 1 + .../org/partiql/lang/randomized/eval/Utils.kt | 7 +- test/partiql-tests-runner/build.gradle.kts | 1 + .../partiql/runner/executor/EvalExecutor.kt | 7 +- .../org/partiql/runner/util/ValueEquals.kt | 3 - 90 files changed, 481 insertions(+), 1286 deletions(-) delete mode 100644 partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValueExperimental.kt create mode 100644 partiql-spi/src/testFixtures/java/org/partiql/spi/value/DatumUtils.java rename partiql-spi/src/{main => testFixtures}/java/org/partiql/spi/value/PQLToPartiQLIterable.java (91%) rename partiql-spi/src/{main => testFixtures}/java/org/partiql/spi/value/PQLToPartiQLStruct.java (89%) rename partiql-spi/src/{main => testFixtures}/java/org/partiql/spi/value/PartiQLToPQLIterable.java (95%) rename partiql-spi/src/{main => testFixtures}/java/org/partiql/spi/value/PartiQLToPQLStruct.java (95%) rename partiql-spi/src/{main/kotlin/org/partiql => testFixtures/java/org/partiql/spi}/value/io/PartiQLValueIonReader.kt (99%) rename partiql-spi/src/{main/kotlin/org/partiql => testFixtures/java/org/partiql/spi}/value/io/PartiQLValueIonWriter.kt (90%) rename partiql-spi/src/{main/kotlin/org/partiql => testFixtures/java/org/partiql/spi}/value/io/PartiQLValueReader.kt (88%) rename partiql-spi/src/{main/kotlin/org/partiql => testFixtures/java/org/partiql/spi}/value/io/PartiQLValueTextWriter.kt (98%) rename partiql-spi/src/{main/kotlin/org/partiql => testFixtures/java/org/partiql/spi}/value/io/PartiQLValueWriter.kt (89%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/PartiQL.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/PartiQLValue.kt (95%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/PartiQLValueComparatorInternal.kt (99%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/PartiQLValueType.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/helpers/ToIon.kt (99%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Annotations.kt (86%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/BagValueImpl.kt (95%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/BinaryValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/BlobValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/BoolValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/ByteValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/CharValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/ClobValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/DateValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/DecimalValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Float32ValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Float64ValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Int16ValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Int32ValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Int64ValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/Int8ValueImpl.kt (96%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/IntValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/IntervalValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/ListValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/MissingValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/NullValueImpl.kt (97%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/SexpValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/StringValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/StructValueImpl.kt (96%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/SymbolValueImpl.kt (93%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/TimeValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/impl/TimestampValueImpl.kt (94%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/util/PartiQLValueBaseVisitor.kt (98%) rename partiql-spi/src/{main => testFixtures}/kotlin/org/partiql/value/util/PartiQLValueVisitor.kt (97%) diff --git a/docs/wiki/tutorials/Pluggable Functions Tutorial.md b/docs/wiki/tutorials/Pluggable Functions Tutorial.md index 6bd965070..54f4747b8 100644 --- a/docs/wiki/tutorials/Pluggable Functions Tutorial.md +++ b/docs/wiki/tutorials/Pluggable Functions Tutorial.md @@ -27,7 +27,7 @@ import org.partiql.types.PartiQLValueType import org.partiql.types.function.FunctionParameter import org.partiql.types.function.FunctionSignature import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental + import org.partiql.value.StringValue import org.partiql.value.stringValue @@ -43,7 +43,6 @@ object TrimLead : PartiQLFunction { description = "Trims leading whitespace of a [str]." // A brief description of your function ) - @OptIn(PartiQLValueExperimental::class) override operator fun invoke(session: ConnectorSession, arguments: List): PartiQLValue { // Implement the function logic here val str = (arguments[0] as? StringValue)?.string ?: "" diff --git a/partiql-cli/build.gradle.kts b/partiql-cli/build.gradle.kts index ed163fa5a..e10d9ebe3 100644 --- a/partiql-cli/build.gradle.kts +++ b/partiql-cli/build.gradle.kts @@ -26,6 +26,7 @@ dependencies { implementation(project(":partiql-planner")) implementation(project(":partiql-types")) implementation(project(":partiql-spi")) + implementation(testFixtures(project(":partiql-spi"))) 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 878409a77..bd57d7f7f 100644 --- a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt +++ b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt @@ -24,8 +24,8 @@ 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.value.PartiQLValueExperimental -import org.partiql.value.io.PartiQLValueTextWriter +import org.partiql.spi.value.DatumUtils +import org.partiql.spi.value.io.PartiQLValueTextWriter import picocli.CommandLine import java.io.File import java.io.InputStream @@ -187,7 +187,6 @@ internal class MainCommand : Runnable { Shell(pipeline, session(), debug).start() } - @OptIn(PartiQLValueExperimental::class) private fun run(statement: String) { val config = getPipelineConfig() val pipeline = when (strict) { @@ -206,7 +205,8 @@ internal class MainCommand : Runnable { // TODO add format support checkFormat(format) val writer = PartiQLValueTextWriter(System.out) - writer.append(result.toPartiQLValue()) // TODO: Create a Datum writer + val p = DatumUtils.toPartiQLValue(result) + writer.append(p) // TODO: Create a Datum writer println() } diff --git a/partiql-cli/src/main/kotlin/org/partiql/cli/shell/Shell.kt b/partiql-cli/src/main/kotlin/org/partiql/cli/shell/Shell.kt index 2f036a71d..d696d714a 100644 --- a/partiql-cli/src/main/kotlin/org/partiql/cli/shell/Shell.kt +++ b/partiql-cli/src/main/kotlin/org/partiql/cli/shell/Shell.kt @@ -31,8 +31,8 @@ import org.jline.utils.InfoCmp import org.joda.time.Duration import org.partiql.cli.pipeline.Pipeline import org.partiql.spi.catalog.Session -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.io.PartiQLValueTextWriter +import org.partiql.spi.value.DatumUtils +import org.partiql.spi.value.io.PartiQLValueTextWriter import java.io.Closeable import java.io.PrintStream import java.nio.file.Path @@ -161,7 +161,6 @@ internal class Shell( } } - @OptIn(PartiQLValueExperimental::class) private fun run(exiting: AtomicBoolean) = TerminalBuilder.builder() .name("PartiQL") .nativeSignals(true) @@ -276,7 +275,8 @@ internal class Shell( out.appendLine() out.info("=== RESULT ===") val writer = PartiQLValueTextWriter(out) - writer.append(result.toPartiQLValue()) // TODO: Create a Datum writer + val p = DatumUtils.toPartiQLValue(result) + writer.append(p) // TODO: Create a Datum writer out.appendLine() out.appendLine() out.success("OK!") diff --git a/partiql-eval/build.gradle.kts b/partiql-eval/build.gradle.kts index 17f013af7..4771c998e 100644 --- a/partiql-eval/build.gradle.kts +++ b/partiql-eval/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { // Test testImplementation(project(":partiql-parser")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType + testImplementation(testFixtures(project(":partiql-spi"))) testImplementation(Deps.junit4) testImplementation(Deps.junit4Params) testImplementation(Deps.junitVintage) // Enables JUnit4 diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/helpers/ValueUtility.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/helpers/ValueUtility.kt index 08d5ea4cf..7418616c0 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/helpers/ValueUtility.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/helpers/ValueUtility.kt @@ -3,13 +3,10 @@ package org.partiql.eval.internal.helpers import org.partiql.errors.TypeCheckException import org.partiql.spi.value.Datum import org.partiql.types.PType -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.PartiQLValueType import java.math.BigInteger /** - * Holds helper functions for [PartiQLValue]. + * Holds helper functions for [Datum]. */ internal object ValueUtility { @@ -21,11 +18,6 @@ internal object ValueUtility { return this.type.code() == PType.BOOL && !this.isNull && !this.isMissing && this.boolean } - @OptIn(PartiQLValueExperimental::class) - fun Datum.check(type: PartiQLValueType): Datum { - return this.check(type.toPType()) - } - /** * Asserts that [this] is of a specific type. Note that, if [this] value is null ([Datum.isNull]), then the null * value is coerced to the expected type. diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelOpExclude.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelOpExclude.kt index 2d48ce430..f98b3d579 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelOpExclude.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rel/RelOpExclude.kt @@ -7,8 +7,6 @@ import org.partiql.plan.Exclusion import org.partiql.spi.value.Datum import org.partiql.spi.value.Field import org.partiql.types.PType -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueType /** * Implementation of the EXCLUDE clause; there are good opportunities to tune/optimize this. @@ -133,8 +131,8 @@ internal class RelOpExclude( } /** - * Returns a [PartiQLValue] created from an iterable of [coll]. Requires [type] to be a collection type - * (i.e. [PartiQLValueType.LIST] or [PartiQLValueType.BAG].). + * Returns a [Datum] created from an iterable of [coll]. Requires [type] to be a collection type + * (i.e. [PType.ARRAY] or [PType.BAG].). */ private fun newCollValue(type: PType, coll: Iterable): Datum { return when (type.code()) { diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamic.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamic.kt index d75b283c3..a8abb07bb 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamic.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamic.kt @@ -10,7 +10,6 @@ import org.partiql.eval.internal.operator.rex.ExprCallDynamic.CoercionFamily.UNK import org.partiql.spi.function.Function import org.partiql.spi.value.Datum import org.partiql.types.PType -import org.partiql.value.PartiQLValue /** * Implementation of Dynamic Dispatch. @@ -23,7 +22,7 @@ import org.partiql.value.PartiQLValue * 3. Lookup the candidate to dispatch to and invoke. * * This implementation can evaluate ([eval]) the input [Row], execute and gather the - * arguments, and pass the [PartiQLValue]s directly to the [Candidate.eval]. + * arguments, and pass the values directly to the [Candidate.eval]. * * This implementation also caches previously resolved candidates. * diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCoalesce.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCoalesce.kt index 96f84b016..e05895192 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCoalesce.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprCoalesce.kt @@ -3,13 +3,11 @@ package org.partiql.eval.internal.operator.rex import org.partiql.eval.Environment import org.partiql.eval.ExprValue import org.partiql.spi.value.Datum -import org.partiql.value.PartiQLValueExperimental internal class ExprCoalesce( private val args: Array ) : ExprValue { - @PartiQLValueExperimental override fun eval(env: Environment): Datum { for (arg in args) { val result = arg.eval(env) diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathKey.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathKey.kt index 6a99487de..6a4cb61f1 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathKey.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathKey.kt @@ -5,18 +5,16 @@ import org.partiql.eval.Environment import org.partiql.eval.ExprValue import org.partiql.eval.internal.helpers.ValueUtility.check import org.partiql.spi.value.Datum -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.PartiQLValueType +import org.partiql.types.PType internal class ExprPathKey( @JvmField val root: ExprValue, @JvmField val key: ExprValue ) : ExprValue { - @OptIn(PartiQLValueExperimental::class) override fun eval(env: Environment): Datum { - val rootEvaluated = root.eval(env).check(PartiQLValueType.STRUCT) - val keyEvaluated = key.eval(env).check(PartiQLValueType.STRING) + val rootEvaluated = root.eval(env).check(PType.struct()) + val keyEvaluated = key.eval(env).check(PType.string()) if (rootEvaluated.isNull || keyEvaluated.isNull) { return Datum.nullValue() } diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathSymbol.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathSymbol.kt index 5b3cda14b..1b8339883 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathSymbol.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprPathSymbol.kt @@ -5,17 +5,15 @@ import org.partiql.eval.Environment import org.partiql.eval.ExprValue import org.partiql.eval.internal.helpers.ValueUtility.check import org.partiql.spi.value.Datum -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.PartiQLValueType +import org.partiql.types.PType internal class ExprPathSymbol( @JvmField val root: ExprValue, @JvmField val symbol: String, ) : ExprValue { - @OptIn(PartiQLValueExperimental::class) override fun eval(env: Environment): Datum { - val struct = root.eval(env).check(PartiQLValueType.STRUCT) + val struct = root.eval(env).check(PType.struct()) if (struct.isNull) { return Datum.nullValue() } diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSelect.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSelect.kt index 1ef8d1ee6..2d9788d3b 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSelect.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSelect.kt @@ -4,7 +4,6 @@ import org.partiql.eval.Environment import org.partiql.eval.ExprRelation import org.partiql.eval.ExprValue import org.partiql.spi.value.Datum -import org.partiql.value.PartiQLValueExperimental /** * Invoke the constructor over all inputs. @@ -18,7 +17,6 @@ internal class ExprSelect( private val ordered: Boolean, ) : ExprValue { - @OptIn(PartiQLValueExperimental::class) class Elements( private val input: ExprRelation, private val constructor: ExprValue, @@ -49,7 +47,6 @@ internal class ExprSelect( } } - @PartiQLValueExperimental override fun eval(env: Environment): Datum { val elements = Elements(input, constructor, env) return when (ordered) { diff --git a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSpread.kt b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSpread.kt index 03fc9ef87..734cde82f 100644 --- a/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSpread.kt +++ b/partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprSpread.kt @@ -5,17 +5,14 @@ import org.partiql.eval.ExprValue import org.partiql.eval.internal.helpers.ValueUtility.check import org.partiql.spi.value.Datum import org.partiql.types.PType -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.PartiQLValueType internal class ExprSpread( val args: Array ) : ExprValue { - @OptIn(PartiQLValueExperimental::class) override fun eval(env: Environment): Datum { val tuples = args.map { - it.eval(env).check(PartiQLValueType.STRUCT) + it.eval(env).check(PType.struct()) } // Return NULL if any arguments are NULL diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/PartiQLEvaluatorTest.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/PartiQLEvaluatorTest.kt index c2535b420..7d4a60cdd 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/PartiQLEvaluatorTest.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/PartiQLEvaluatorTest.kt @@ -9,7 +9,6 @@ import org.junit.jupiter.params.provider.MethodSource import org.partiql.eval.Mode import org.partiql.eval.compiler.PartiQLCompiler import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.bagValue import org.partiql.value.boolValue import org.partiql.value.decimalValue @@ -25,7 +24,6 @@ import java.math.BigDecimal /** * This holds sanity tests during the development of the [PartiQLCompiler.standard] implementation. */ -@OptIn(PartiQLValueExperimental::class) class PartiQLEvaluatorTest { @ParameterizedTest 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 32bd8d72b..fcfeb8986 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 @@ -12,10 +12,10 @@ 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.spi.value.DatumUtils import org.partiql.types.StaticType import org.partiql.types.fromStaticType import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import kotlin.test.assertEquals public class SuccessTestCase( @@ -26,13 +26,12 @@ public class SuccessTestCase( val jvmEquality: Boolean = false ) : PTestCase { - @OptIn(PartiQLValueExperimental::class) constructor( input: String, expected: PartiQLValue, mode: Mode = Mode.PERMISSIVE(), globals: List = emptyList(), - ) : this(input, Datum.of(expected), mode, globals) + ) : this(input, DatumUtils.toDatum(expected), mode, globals) private val compiler = PartiQLCompiler.standard() private val parser = PartiQLParser.standard() 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 dda974399..4810731e5 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 @@ -9,15 +9,15 @@ 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.spi.value.DatumUtils +import org.partiql.spi.value.io.PartiQLValueIonWriterBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.io.PartiQLValueIonWriterBuilder import java.io.ByteArrayOutputStream import kotlin.test.assertEquals import kotlin.test.assertNotNull -public class TypingTestCase @OptIn(PartiQLValueExperimental::class) constructor( +public class TypingTestCase( val name: String, val input: String, val expectedPermissive: PartiQLValue, @@ -27,10 +27,9 @@ public class TypingTestCase @OptIn(PartiQLValueExperimental::class) constructor( private val parser = PartiQLParser.standard() private val planner = PartiQLPlanner.standard() - @OptIn(PartiQLValueExperimental::class) override fun run() { val (permissiveResult, plan) = run(mode = Mode.PERMISSIVE()) - val permissiveResultPValue = permissiveResult.toPartiQLValue() + val permissiveResultPValue = DatumUtils.toPartiQLValue(permissiveResult) val assertionCondition = try { expectedPermissive == permissiveResultPValue // TODO: Assert using Datum } catch (t: Throwable) { @@ -71,7 +70,6 @@ public class TypingTestCase @OptIn(PartiQLValueExperimental::class) constructor( return result to plan } - @OptIn(PartiQLValueExperimental::class) private fun comparisonString(expected: PartiQLValue, actual: PartiQLValue, plan: Plan): String { val expectedBuffer = ByteArrayOutputStream() val expectedWriter = PartiQLValueIonWriterBuilder.standardIonTextBuilder().build(expectedBuffer) diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamicTest.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamicTest.kt index 72735cc10..840aa5fd7 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamicTest.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/operator/rex/ExprCallDynamicTest.kt @@ -16,7 +16,6 @@ import org.partiql.spi.value.Datum.bool import org.partiql.spi.value.Datum.integer import org.partiql.spi.value.Datum.string import org.partiql.types.PType -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.PartiQLValueType class ExprCallDynamicTest { @@ -32,20 +31,18 @@ class ExprCallDynamicTest { val expectedIndex: Int, ) { - @OptIn(PartiQLValueExperimental::class) fun assert() { val expr = ExprCallDynamic( name = "example_function", functions = functions, args = arrayOf(ExprLit(lhs), ExprLit(rhs)), ) - val result = expr.eval(Environment()).check(PartiQLValueType.INT32) + val result = expr.eval(Environment()).check(PType.integer()) assertEquals(expectedIndex, result.int) } companion object { - @OptIn(PartiQLValueExperimental::class) private val params = listOf( PartiQLValueType.LIST to PartiQLValueType.LIST, // Index 0 PartiQLValueType.BAG to PartiQLValueType.BAG, // Index 1 @@ -62,7 +59,6 @@ class ExprCallDynamicTest { PartiQLValueType.ANY to PartiQLValueType.ANY, // Index 12 ) - @OptIn(PartiQLValueExperimental::class) internal val functions: Array = params.mapIndexed { index, it -> object : Function { diff --git a/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt b/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt index 4999e5b88..4f32c83fb 100644 --- a/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt +++ b/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt @@ -22,7 +22,6 @@ import org.partiql.ast.AstNode import org.partiql.ast.DataType import org.partiql.ast.Literal.intNum import org.partiql.ast.expr.Scope -import org.partiql.value.PartiQLValueExperimental import java.util.stream.Stream import kotlin.test.assertEquals @@ -116,7 +115,6 @@ class PartiQLParserDDLTests { ), ) - @OptIn(PartiQLValueExperimental::class) val createTableTests_addition = listOf( // // Column Constraints diff --git a/partiql-planner/build.gradle.kts b/partiql-planner/build.gradle.kts index 88a0586b8..25cd111d6 100644 --- a/partiql-planner/build.gradle.kts +++ b/partiql-planner/build.gradle.kts @@ -115,7 +115,6 @@ tasks.register("codegen") { "--poems", "visitor", "--poems", "builder", "--poems", "util", - "--opt-in", "org.partiql.value.PartiQLValueExperimental", "./src/main/resources/partiql_plan_internal.ion" ) } diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt index ad5f69a85..3330e3ced 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt @@ -1,5 +1,3 @@ -@file:OptIn(PartiQLValueExperimental::class) - package org.partiql.planner.`internal`.ir import org.partiql.planner.internal.ir.builder.PartiQlPlanBuilder @@ -70,8 +68,7 @@ import org.partiql.spi.catalog.Name import org.partiql.spi.catalog.Table import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Function -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental +import org.partiql.spi.value.Datum import kotlin.random.Random internal abstract class PlanNode { @@ -231,12 +228,19 @@ internal data class Rex( } internal data class Lit( - @JvmField internal val `value`: PartiQLValue, + @JvmField internal val `value`: Datum, ) : Op() { public override val children: List = emptyList() override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpLit(this, ctx) + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Lit) return false + val result = Datum.comparator().compare(value, other.value) + return result == 0 + } + internal companion object { @JvmStatic internal fun builder(): RexOpLitBuilder = RexOpLitBuilder() diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/PlanTransform.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/PlanTransform.kt index 8d1537e38..5c2405235 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/PlanTransform.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/PlanTransform.kt @@ -18,11 +18,8 @@ import org.partiql.planner.internal.ir.Rel import org.partiql.planner.internal.ir.SetQuantifier import org.partiql.planner.internal.ir.visitor.PlanBaseVisitor import org.partiql.spi.errors.PErrorListener -import org.partiql.spi.value.Datum import org.partiql.types.Field import org.partiql.types.PType -import org.partiql.value.DecimalValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.planner.internal.ir.PartiQLPlan as IPlan import org.partiql.planner.internal.ir.PlanNode as INode import org.partiql.planner.internal.ir.Rel as IRel @@ -221,18 +218,8 @@ internal class PlanTransform(private val flags: Set) { return operators.variable(depth, offset, ctx) } - @OptIn(PartiQLValueExperimental::class) override fun visitRexOpLit(node: IRex.Op.Lit, ctx: PType): Any { - val value = node.value - // TODO: PartiQLValue doesn't have a finite decimal type, so we need to specially handle this until we remove - // PartiQLValue. - if (value is DecimalValue && ctx.code() == PType.DECIMAL) { - return when (val dec = value.value) { - null -> operators.lit(Datum.nullValue(ctx)) - else -> operators.lit(Datum.decimal(dec, ctx.precision, ctx.scale)) - } - } - return operators.lit(Datum.of(node.value)) + return operators.lit(node.value) } // RELATION OPERATORS diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt index bbc99472d..511fb6ecd 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt @@ -86,10 +86,8 @@ import org.partiql.planner.internal.ir.rexOpStruct import org.partiql.planner.internal.ir.rexOpStructField import org.partiql.planner.internal.ir.rexOpVarLocal import org.partiql.planner.internal.typer.CompilerType +import org.partiql.spi.value.Datum import org.partiql.types.PType -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.boolValue -import org.partiql.value.stringValue /** * Lexically scoped state for use in translating an individual SELECT statement. @@ -255,12 +253,11 @@ internal object RelConverter { return rel(type, op) } - @OptIn(PartiQLValueExperimental::class) override fun visitFrom(node: From, ctx: Rel): Rel { val tableRefs = node.tableRefs.map { visitFromTableRef(it, ctx) } return tableRefs.drop(1).fold(tableRefs.first()) { acc, tRef -> val joinType = Rel.Op.Join.Type.INNER - val condition = rex(BOOL, rexOpLit(boolValue(true))) + val condition = rex(BOOL, rexOpLit(Datum.bool(true))) val schema = acc.type.schema + tRef.type.schema val props = emptySet() val type = relType(schema, props) @@ -310,13 +307,12 @@ internal object RelConverter { * * TODO compute basic schema */ - @OptIn(PartiQLValueExperimental::class) override fun visitFromJoin(node: FromJoin, nil: Rel): Rel { val lhs = visitFromTableRef(node.lhs, nil) val rhs = visitFromTableRef(node.rhs, nil) val schema = lhs.type.schema + rhs.type.schema // Note: This gets more specific in PlanTyper. It is only used to find binding names here. val props = emptySet() - val condition = node.condition?.let { RexConverter.apply(it, env) } ?: rex(BOOL, rexOpLit(boolValue(true))) + val condition = node.condition?.let { RexConverter.apply(it, env) } ?: rex(BOOL, rexOpLit(Datum.bool(true))) val joinType = when (node.joinType?.code()) { JoinType.LEFT_OUTER, JoinType.LEFT, JoinType.LEFT_CROSS -> Rel.Op.Join.Type.LEFT JoinType.RIGHT_OUTER, JoinType.RIGHT -> Rel.Op.Join.Type.RIGHT @@ -406,7 +402,6 @@ internal object RelConverter { * 1. Ast.Expr.SFW has every Ast.Expr.CallAgg replaced by a synthetic Ast.Expr.Var * 2. Rel which has the appropriate Rex.Agg calls and groups */ - @OptIn(PartiQLValueExperimental::class) private fun convertAgg(input: Rel, select: QueryBody.SFW, groupBy: GroupBy?): Pair { // Rewrite and extract all aggregations in the SELECT clause val (sel, aggregations) = AggregationTransform.apply(select) @@ -459,7 +454,7 @@ internal object RelConverter { schema.add(binding) val fields = input.type.schema.mapIndexed { bindingIndex, currBinding -> rexOpStructField( - k = rex(STRING, rexOpLit(stringValue(currBinding.name))), + k = rex(STRING, rexOpLit(Datum.string(currBinding.name))), v = rex(ANY, rexOpVarLocal(0, bindingIndex)) ) } diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt index 0f8fab3ae..6938b9f75 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt @@ -16,7 +16,6 @@ package org.partiql.planner.internal.transforms -import com.amazon.ionelement.api.loadSingleElement import org.partiql.ast.AstNode import org.partiql.ast.AstVisitor import org.partiql.ast.DataType @@ -89,24 +88,11 @@ import org.partiql.planner.internal.typer.CompilerType import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType import org.partiql.planner.internal.utils.DateTimeUtils import org.partiql.spi.catalog.Identifier +import org.partiql.spi.value.Datum +import org.partiql.spi.value.DatumReader import org.partiql.types.PType -import org.partiql.value.DecimalValue -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.boolValue -import org.partiql.value.dateValue import org.partiql.value.datetime.DateTimeValue -import org.partiql.value.decimalValue -import org.partiql.value.float64Value -import org.partiql.value.int32Value -import org.partiql.value.int64Value -import org.partiql.value.intValue -import org.partiql.value.io.PartiQLValueIonReaderBuilder -import org.partiql.value.missingValue -import org.partiql.value.nullValue -import org.partiql.value.stringValue -import org.partiql.value.timeValue -import org.partiql.value.timestampValue +import java.math.BigDecimal import java.math.BigInteger import java.math.MathContext import java.math.RoundingMode @@ -123,7 +109,6 @@ internal object RexConverter { internal fun applyRel(expr: Expr, context: Env): Rex = expr.accept(ToRex, context) - @OptIn(PartiQLValueExperimental::class) @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE") private object ToRex : AstVisitor() { @@ -148,51 +133,34 @@ internal object RexConverter { } override fun visitExprLit(node: ExprLit, context: Env): Rex { - val pValue = node.lit.toPartiQLValue() - val type = when (pValue) { - // Specifically handle the lack of an infinite precision/scale - // TODO: PartiQLValue won't be in AST soon - is DecimalValue -> { - when (val decimal = pValue.value) { - null -> PType.decimal(38, 19) - else -> PType.decimal(decimal.precision(), decimal.scale()) - } - } - else -> pValue.type.toPType() - } + val datum = node.lit.toDatum() + val type = datum.type val cType = CompilerType( _delegate = type, isNullValue = node.lit.code() == Literal.NULL, isMissingValue = node.lit.code() == Literal.MISSING ) - val op = rexOpLit(pValue) + val op = rexOpLit(datum) return rex(cType, op) } - private fun Literal.toPartiQLValue(): PartiQLValue { + private fun Literal.toDatum(): Datum { val lit = this return when (lit.code()) { - Literal.NULL -> nullValue() - Literal.MISSING -> missingValue() - Literal.STRING -> stringValue(lit.stringValue()) - Literal.BOOL -> boolValue(lit.booleanValue()) + Literal.NULL -> Datum.nullValue() + Literal.MISSING -> Datum.missing() + Literal.STRING -> Datum.string(lit.stringValue()) + Literal.BOOL -> Datum.bool(lit.booleanValue()) Literal.EXACT_NUM -> { - // TODO previous behavior inferred decimals with scale = 0 to be a PartiQLValue.IntValue with - // PType of numeric. Since we're keeping numeric and decimal, need to take another look at - // whether the literal should have type decimal or numeric. val dec = lit.bigDecimalValue().round(MathContext(38, RoundingMode.HALF_EVEN)) - if (dec.scale() == 0) { - intValue(dec.toBigInteger()) - } else { - decimalValue(dec) - } + Datum.decimal(dec, dec.precision(), dec.scale()) } Literal.INT_NUM -> { val n = lit.numberValue() // 1st, try parse as int try { val v = n.toInt(10) - return int32Value(v) + return Datum.integer(v) } catch (ex: NumberFormatException) { // ignore } @@ -200,7 +168,7 @@ internal object RexConverter { // 2nd, try parse as long try { val v = n.toLong(10) - return int64Value(v) + return Datum.bigint(v) } catch (ex: NumberFormatException) { // ignore } @@ -208,13 +176,14 @@ internal object RexConverter { // 3rd, try parse as BigInteger try { val v = BigInteger(n) - return intValue(v) + val vDecimal = BigDecimal(v) + return Datum.decimal(vDecimal, vDecimal.precision(), vDecimal.scale()) } catch (ex: NumberFormatException) { throw ex } } Literal.APPROX_NUM -> { - float64Value(lit.numberValue().toDouble()) + return Datum.doublePrecision(lit.numberValue().toDouble()) } Literal.TYPED_STRING -> { val type = this.dataType() @@ -223,18 +192,18 @@ internal object RexConverter { DataType.DATE -> { val value = LocalDate.parse(typedString, DateTimeFormatter.ISO_LOCAL_DATE) val date = DateTimeValue.date(value.year, value.monthValue, value.dayOfMonth) - dateValue(date) + return Datum.date(date) } DataType.TIME, DataType.TIME_WITH_TIME_ZONE -> { val time = DateTimeUtils.parseTimeLiteral(typedString) val precision = type.precision ?: 6 - timeValue(time.toPrecision(precision)) + return Datum.time(time, precision) } DataType.TIMESTAMP, DataType.TIMESTAMP_WITH_TIME_ZONE -> { val timestamp = DateTimeUtils.parseTimestamp(typedString) val precision = type.precision ?: 6 val value = timestamp.toPrecision(precision) - timestampValue(value) + return Datum.timestamp(value) } else -> error("Unsupported typed literal string: $this") } @@ -243,17 +212,16 @@ internal object RexConverter { } } - /** - * TODO PartiQLValue will be replaced by Datum (i.e. IonDatum) is a subsequent PR. - */ override fun visitExprVariant(node: ExprVariant, ctx: Env): Rex { if (node.encoding != "ion") { throw IllegalArgumentException("unsupported encoding ${node.encoding}") } - val ion = loadSingleElement(node.value) - val value = PartiQLValueIonReaderBuilder.standard().build(ion).read() - val type = CompilerType(value.type.toPType()) - return rex(type, rexOpLit(value)) + // TODO: Does this result in a Datum of type variant? + val v = DatumReader.ion(node.value.byteInputStream()) + val datum = v.next() ?: error("Expected a single value") + v.next()?.let { throw TypeCheckException("Expected a single value") } + val type = CompilerType(datum.type) + return rex(type, rexOpLit(datum)) } /** @@ -561,7 +529,7 @@ internal object RexConverter { val schema = acc.type.schema + scan.type.schema val props = emptySet() val type = relType(schema, props) - rel(type, relOpJoin(acc, scan, rex(BOOL, rexOpLit(boolValue(true))), Rel.Op.Join.Type.INNER)) + rel(type, relOpJoin(acc, scan, rex(BOOL, rexOpLit(Datum.bool(true))), Rel.Op.Join.Type.INNER)) } // compute the ref used by select construct @@ -622,7 +590,7 @@ internal object RexConverter { return rel(relType, relOpUnpivot(path)) } - private fun rexString(str: String) = rex(STRING, rexOpLit(stringValue(str))) + private fun rexString(str: String) = rex(STRING, rexOpLit(Datum.string(str))) override fun visitExprCall(node: ExprCall, context: Env): Rex { val type = (ANY) @@ -737,7 +705,7 @@ internal object RexConverter { }.toMutableList() val defaultRex = when (val default = node.defaultExpr) { - null -> rex(type = ANY, op = rexOpLit(value = nullValue())) + null -> rex(type = ANY, op = rexOpLit(value = Datum.nullValue())) else -> visitExprCoerce(default, context) } val op = rexOpCase(branches = branches, default = defaultRex) @@ -926,7 +894,7 @@ internal object RexConverter { val type = ANY // Args val arg0 = visitExprCoerce(node.value, ctx) - val arg1 = node.start?.let { visitExprCoerce(it, ctx) } ?: rex(INT, rexOpLit(int64Value(1))) + val arg1 = node.start?.let { visitExprCoerce(it, ctx) } ?: rex(INT, rexOpLit(Datum.bigint(1L))) val arg2 = node.length?.let { visitExprCoerce(it, ctx) } // Call Variants val call = when (arg2) { @@ -1004,8 +972,8 @@ internal object RexConverter { call( "substring", cv, - rex(INT4, rexOpLit(int32Value(1))), - rex(ANY, call("minus", sp, rex(INT4, rexOpLit(int32Value(1))))) + rex(INT4, rexOpLit(Datum.integer(1))), + rex(ANY, call("minus", sp, rex(INT4, rexOpLit(Datum.integer(1))))) ) ) val p2 = rex(ANY, call("concat", p1, rs)) @@ -1173,7 +1141,12 @@ internal object RexConverter { return rexOpCallUnresolved(id, args.toList()) } - private fun Int?.toRex() = rex(INT4, rexOpLit(int32Value(this))) + private fun Int?.toRex(): Rex { + return when (this) { + null -> rex(INT4, rexOpLit(Datum.nullValue(PType.integer()))) + else -> rex(INT4, rexOpLit(Datum.integer(this))) + } + } private val ANY: CompilerType = CompilerType(PType.dynamic()) private val BOOL: CompilerType = CompilerType(PType.bool()) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt index 3475090f0..d0f65c17c 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt @@ -3,31 +3,8 @@ package org.partiql.planner.internal.typer import org.partiql.planner.internal.ir.Rex import org.partiql.planner.internal.typer.PlanTyper.Companion.anyOf import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType +import org.partiql.spi.value.Datum import org.partiql.types.PType -import org.partiql.value.MissingValue -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.bagValue -import org.partiql.value.blobValue -import org.partiql.value.boolValue -import org.partiql.value.charValue -import org.partiql.value.clobValue -import org.partiql.value.dateValue -import org.partiql.value.decimalValue -import org.partiql.value.float32Value -import org.partiql.value.float64Value -import org.partiql.value.int16Value -import org.partiql.value.int32Value -import org.partiql.value.int64Value -import org.partiql.value.int8Value -import org.partiql.value.intValue -import org.partiql.value.listValue -import org.partiql.value.missingValue -import org.partiql.value.nullValue -import org.partiql.value.stringValue -import org.partiql.value.structValue -import org.partiql.value.timeValue -import org.partiql.value.timestampValue /** * Graph of super types for quick lookup because we don't have a tree. @@ -63,7 +40,6 @@ internal class DynamicTyper { /** * Checks for literal NULL */ - @OptIn(PartiQLValueExperimental::class) private fun Rex.isLiteralNull(): Boolean { val op = this.op return op is Rex.Op.Lit && op.value.isNull @@ -72,10 +48,9 @@ internal class DynamicTyper { /** * Checks for literal MISSING */ - @OptIn(PartiQLValueExperimental::class) private fun Rex.isLiteralMissing(): Boolean { val op = this.op - return op is Rex.Op.Lit && op.value is MissingValue + return op is Rex.Op.Lit && op.value.isMissing } /** @@ -104,7 +79,6 @@ internal class DynamicTyper { * * @return */ - @OptIn(PartiQLValueExperimental::class) fun mapping(): Pair?> { var s = supertype ?: return CompilerType(PType.dynamic()) to null val superTypeBase = s.code() @@ -134,8 +108,8 @@ internal class DynamicTyper { // Otherwise, return the supertype along with the coercion mapping val mapping = args.map { when { - it.isLiteralNull() -> Mapping.Replacement(Rex(s, Rex.Op.Lit(nullValue(s.code())))) - it.isLiteralMissing() -> Mapping.Replacement(Rex(s, Rex.Op.Lit(missingValue()))) + it.isLiteralNull() -> Mapping.Replacement(Rex(s, Rex.Op.Lit(Datum.nullValue(PType.of(s.code()))))) + it.isLiteralMissing() -> Mapping.Replacement(Rex(s, Rex.Op.Lit(Datum.missing(PType.of(s.code()))))) it.type == s -> Mapping.Coercion(s) else -> null } @@ -416,40 +390,5 @@ internal class DynamicTyper { PType.VARIANT -> TODO("variant in dynamic typer") else -> error("Unknown type: $this") }.toCType() - - @OptIn(PartiQLValueExperimental::class) - private fun nullValue(kind: Int): PartiQLValue { - return when (kind) { - PType.DYNAMIC -> nullValue() - PType.BOOL -> boolValue(null) - PType.TINYINT -> int8Value(null) - PType.SMALLINT -> int16Value(null) - PType.INTEGER -> int32Value(null) - PType.BIGINT -> int64Value(null) - PType.NUMERIC -> intValue(null) - PType.DECIMAL -> decimalValue(null) - PType.REAL -> float32Value(null) - PType.DOUBLE -> float64Value(null) - PType.CHAR -> charValue(null) - PType.VARCHAR -> TODO("No implementation of VAR CHAR") - PType.STRING -> stringValue(null) - PType.BLOB -> blobValue(null) - PType.CLOB -> clobValue(null) - PType.DATE -> dateValue(null) - PType.TIMEZ, - PType.TIME -> timeValue(null) - - PType.TIMESTAMPZ, - PType.TIMESTAMP -> timestampValue(null) - - PType.BAG -> bagValue(null) - PType.ARRAY -> listValue(null) - PType.ROW -> structValue(null) - PType.STRUCT -> structValue() - PType.UNKNOWN -> nullValue() - PType.VARIANT -> TODO("variant in dynamic typer") - else -> error("Unknown type: $kind") - } - } } } diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/PlanTyper.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/PlanTyper.kt index 260876cd6..c054d5a93 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/PlanTyper.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/PlanTyper.kt @@ -55,13 +55,9 @@ import org.partiql.spi.Context import org.partiql.spi.catalog.Identifier import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener +import org.partiql.spi.value.Datum import org.partiql.types.Field import org.partiql.types.PType -import org.partiql.value.BoolValue -import org.partiql.value.MissingValue -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.TextValue -import org.partiql.value.stringValue import kotlin.math.max /** @@ -69,7 +65,6 @@ import kotlin.math.max * * @property env */ -@OptIn(PartiQLValueExperimental::class) internal class PlanTyper(private val env: Env, config: Context) { private val _listener = config.errorListener @@ -575,7 +570,6 @@ internal class PlanTyper(private val env: Env, config: Context) { * * @property typeEnv TypeEnv in which this rex tree is evaluated. */ - @OptIn(PartiQLValueExperimental::class) private inner class RexTyper( private val typeEnv: TypeEnv, private val strategy: Strategy, @@ -647,7 +641,7 @@ internal class PlanTyper(private val env: Env, config: Context) { return rex(root.type.typeParameter, rexOpPathIndex(root, key)) } - private fun Rex.isLiteralMissing(): Boolean = this.op is Rex.Op.Lit && this.op.value is MissingValue + private fun Rex.isLiteralMissing(): Boolean = this.op is Rex.Op.Lit && this.op.value.isMissing override fun visitRexOpPathKey(node: Rex.Op.Path.Key, ctx: CompilerType?): Rex { val root = visitRex(node.root, node.root.type) @@ -670,7 +664,7 @@ internal class PlanTyper(private val env: Env, config: Context) { // Get Literal Key val keyOp = key.op - val keyLiteral = when (keyOp is Rex.Op.Lit && keyOp.value is TextValue<*> && !keyOp.value.isNull) { + val keyLiteral = when (keyOp is Rex.Op.Lit && keyOp.value.isTextValue() && !keyOp.value.isNull) { true -> keyOp.value.string!! false -> return rex(CompilerType(PType.dynamic()), rexOpPathKey(root, key)) } @@ -683,6 +677,10 @@ internal class PlanTyper(private val env: Env, config: Context) { return rex(elementType, rexOpPathKey(root, key)) } + private fun Datum.isTextValue(): Boolean { + return this.type.code() in setOf(PType.STRING, PType.CHAR, PType.VARCHAR) + } + override fun visitRexOpPathSymbol(node: Rex.Op.Path.Symbol, ctx: CompilerType?): Rex { val root = visitRex(node.root, node.root.type) @@ -729,7 +727,7 @@ internal class PlanTyper(private val env: Env, config: Context) { } } - private fun rexString(str: String) = rex(CompilerType(PType.string()), Rex.Op.Lit(stringValue(str))) + private fun rexString(str: String) = rex(CompilerType(PType.string()), Rex.Op.Lit(Datum.string(str))) override fun visitRexOpCastUnresolved(node: Rex.Op.Cast.Unresolved, ctx: CompilerType?): Rex { val arg = visitRex(node.arg, null) @@ -931,9 +929,8 @@ internal class PlanTyper(private val env: Env, config: Context) { /** * Returns the boolean value of the expression. For now, only handle literals. */ - @OptIn(PartiQLValueExperimental::class) private fun boolOrNull(op: Rex.Op): Boolean? { - return if (op is Rex.Op.Lit && op.value is BoolValue) op.value.value else null + return if (op is Rex.Op.Lit && op.value.type.code() == PType.BOOL) op.value.boolean else null } /** @@ -972,7 +969,6 @@ internal class PlanTyper(private val env: Env, config: Context) { return rex(CompilerType(type), rexOpCollection(values)) } - @OptIn(PartiQLValueExperimental::class) override fun visitRexOpStruct(node: Rex.Op.Struct, ctx: CompilerType?): Rex { val fields = node.fields.map { val k = visitRex(it.k, it.k.type) @@ -984,7 +980,7 @@ internal class PlanTyper(private val env: Env, config: Context) { for (field in fields) { val keyOp = field.k.op // TODO: Check key type - if (keyOp !is Rex.Op.Lit || keyOp.value !is TextValue<*>) { + if (keyOp !is Rex.Op.Lit || !keyOp.value.isTextValue()) { structIsClosed = false continue } diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/Scope.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/Scope.kt index 7c6752c35..153efac74 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/Scope.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/Scope.kt @@ -9,9 +9,8 @@ import org.partiql.planner.internal.ir.rexOpPathSymbol import org.partiql.planner.internal.ir.rexOpVarLocal import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType import org.partiql.spi.catalog.Identifier +import org.partiql.spi.value.Datum import org.partiql.types.PType -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.stringValue /** * Represents local variable scopes. @@ -171,7 +170,6 @@ internal data class Scope( rex(type, op) } - @OptIn(PartiQLValueExperimental::class) - private fun string(text: String) = rex(CompilerType(PType.string()), rexOpLit(stringValue(text))) + private fun string(text: String) = rex(CompilerType(PType.string()), rexOpLit(Datum.string(text))) } } diff --git a/partiql-planner/src/main/resources/partiql_plan_internal.ion b/partiql-planner/src/main/resources/partiql_plan_internal.ion index efc9b4560..f101659ff 100644 --- a/partiql-planner/src/main/resources/partiql_plan_internal.ion +++ b/partiql-planner/src/main/resources/partiql_plan_internal.ion @@ -2,7 +2,7 @@ imports::{ kotlin: [ identifier::'org.partiql.spi.catalog.Identifier', name::'org.partiql.spi.catalog.Name', - partiql_value::'org.partiql.value.PartiQLValue', + partiql_value::'org.partiql.spi.value.Datum', partiql_value_type::'org.partiql.planner.internal.typer.CompilerType', static_type::'org.partiql.planner.internal.typer.CompilerType', fn_signature::'org.partiql.spi.function.Function', 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 6d6d12f03..fa8301fd5 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 @@ -23,10 +23,8 @@ 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.value.Datum import org.partiql.types.PType -import org.partiql.value.PartiQLValueExperimental -import org.partiql.value.int32Value -import org.partiql.value.stringValue import kotlin.io.path.toPath class PlanTyperTest { @@ -41,20 +39,19 @@ class PlanTyperTest { private val DOUBLE_PRECISION = PType.doublePrecision().toCType() private val DECIMAL = PType.decimal(38, 0).toCType() - @OptIn(PartiQLValueExperimental::class) private val LITERAL_STRUCT_1 = rex( ANY, rexOpStruct( fields = listOf( rexOpStructField( - k = rex(STRING, rexOpLit(stringValue("FiRsT_KeY"))), + k = rex(STRING, rexOpLit(Datum.string("FiRsT_KeY"))), v = rex( ANY, rexOpStruct( fields = listOf( rexOpStructField( - k = rex(STRING, rexOpLit(stringValue("sEcoNd_KEY"))), - v = rex(INT4, rexOpLit(int32Value(5))) + k = rex(STRING, rexOpLit(Datum.string("sEcoNd_KEY"))), + v = rex(INT4, rexOpLit(Datum.integer(5))) ) ) ) @@ -68,7 +65,6 @@ class PlanTyperTest { listOf(CompilerType.Field("sEcoNd_KEY", INT4)), ).toCType() - @OptIn(PartiQLValueExperimental::class) private val LITERAL_STRUCT_1_TYPED: Rex get() { val topLevelStruct = PType.row( @@ -79,14 +75,14 @@ class PlanTyperTest { rexOpStruct( fields = listOf( rexOpStructField( - k = rex(STRING, rexOpLit(stringValue("FiRsT_KeY"))), + k = rex(STRING, rexOpLit(Datum.string("FiRsT_KeY"))), v = rex( type = LITERAL_STRUCT_1_FIRST_KEY_TYPE, rexOpStruct( fields = listOf( rexOpStructField( - k = rex(STRING, rexOpLit(stringValue("sEcoNd_KEY"))), - v = rex(INT4, rexOpLit(int32Value(5))) + k = rex(STRING, rexOpLit(Datum.string("sEcoNd_KEY"))), + v = rex(INT4, rexOpLit(Datum.integer(5))) ) ) ) @@ -308,8 +304,7 @@ class PlanTyperTest { assertEquals(expected, actual) } - @OptIn(PartiQLValueExperimental::class) - private fun rexString(str: String) = rex(STRING, rexOpLit(stringValue(str))) + private fun rexString(str: String) = rex(STRING, rexOpLit(Datum.string(str))) private fun Rex.pathKey(key: String, type: CompilerType = ANY): Rex = Rex(type, rexOpPathKey(this, rexString(key))) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 4d308d4b5..cec1f2fd7 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -510,7 +510,6 @@ public abstract interface class org/partiql/spi/value/Datum : java/lang/Iterable public static fun nullValue ()Lorg/partiql/spi/value/Datum; public static fun nullValue (Lorg/partiql/types/PType;)Lorg/partiql/spi/value/Datum; public static fun numeric (Ljava/math/BigInteger;)Lorg/partiql/spi/value/Datum; - public static fun of (Lorg/partiql/value/PartiQLValue;)Lorg/partiql/spi/value/Datum; public fun pack (Ljava/nio/charset/Charset;)[B public static fun real (F)Lorg/partiql/spi/value/Datum; public static fun smallint (S)Lorg/partiql/spi/value/Datum; @@ -518,9 +517,10 @@ public abstract interface class org/partiql/spi/value/Datum : java/lang/Iterable public static fun struct ()Lorg/partiql/spi/value/Datum; public static fun struct (Ljava/lang/Iterable;)Lorg/partiql/spi/value/Datum; public static fun time (Lorg/partiql/value/datetime/Time;)Lorg/partiql/spi/value/Datum; + public static fun time (Lorg/partiql/value/datetime/Time;I)Lorg/partiql/spi/value/Datum; public static fun timestamp (Lorg/partiql/value/datetime/Timestamp;)Lorg/partiql/spi/value/Datum; + public static fun timestamp (Lorg/partiql/value/datetime/Timestamp;I)Lorg/partiql/spi/value/Datum; public static fun tinyint (B)Lorg/partiql/spi/value/Datum; - public fun toPartiQLValue ()Lorg/partiql/value/PartiQLValue; public static fun varchar (Ljava/lang/String;)Lorg/partiql/spi/value/Datum; public static fun varchar (Ljava/lang/String;I)Lorg/partiql/spi/value/Datum; } @@ -555,453 +555,6 @@ public abstract interface class org/partiql/spi/value/Field { public static fun of (Ljava/lang/String;Lorg/partiql/spi/value/Datum;)Lorg/partiql/spi/value/Field; } -public abstract class org/partiql/value/BagValue : org/partiql/value/CollectionValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/BagValue; - public fun equals (Ljava/lang/Object;)Z - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun hashCode ()I - public fun iterator ()Ljava/util/Iterator; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/BagValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/BagValue; -} - -public abstract class org/partiql/value/BinaryValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/BinaryValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/BinaryValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/BinaryValue; -} - -public abstract class org/partiql/value/BlobValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/BlobValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/BlobValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/BlobValue; -} - -public abstract class org/partiql/value/BoolValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/BoolValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/BoolValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/BoolValue; -} - -public abstract class org/partiql/value/ByteValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/ByteValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/ByteValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/ByteValue; -} - -public abstract class org/partiql/value/CharValue : org/partiql/value/TextValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/CharValue; - public fun getString ()Ljava/lang/String; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/CharValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/CharValue; -} - -public abstract class org/partiql/value/ClobValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/ClobValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/ClobValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/ClobValue; -} - -public abstract interface class org/partiql/value/CollectionValue : java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker, org/partiql/value/PartiQLValue { - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/CollectionValue; - public abstract fun isNull ()Z - public abstract fun iterator ()Ljava/util/Iterator; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/CollectionValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/CollectionValue; -} - -public abstract class org/partiql/value/DateValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/DateValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/DateValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/DateValue; -} - -public abstract class org/partiql/value/DecimalValue : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/DecimalValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/DecimalValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/DecimalValue; -} - -public abstract class org/partiql/value/Float32Value : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/Float32Value; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/Float32Value; - public abstract fun withoutAnnotations ()Lorg/partiql/value/Float32Value; -} - -public abstract class org/partiql/value/Float64Value : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/Float64Value; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/Float64Value; - public abstract fun withoutAnnotations ()Lorg/partiql/value/Float64Value; -} - -public abstract class org/partiql/value/Int16Value : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/Int16Value; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/Int16Value; - public abstract fun withoutAnnotations ()Lorg/partiql/value/Int16Value; -} - -public abstract class org/partiql/value/Int32Value : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/Int32Value; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/Int32Value; - public abstract fun withoutAnnotations ()Lorg/partiql/value/Int32Value; -} - -public abstract class org/partiql/value/Int64Value : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/Int64Value; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/Int64Value; - public abstract fun withoutAnnotations ()Lorg/partiql/value/Int64Value; -} - -public abstract class org/partiql/value/Int8Value : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/Int8Value; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/Int8Value; - public abstract fun withoutAnnotations ()Lorg/partiql/value/Int8Value; -} - -public abstract class org/partiql/value/IntValue : org/partiql/value/NumericValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/IntValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/IntValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/IntValue; -} - -public abstract class org/partiql/value/IntervalValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/IntervalValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/IntervalValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/IntervalValue; -} - -public abstract class org/partiql/value/ListValue : org/partiql/value/CollectionValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/ListValue; - public fun equals (Ljava/lang/Object;)Z - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun hashCode ()I - public fun iterator ()Ljava/util/Iterator; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/ListValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/ListValue; -} - -public abstract class org/partiql/value/MissingValue : org/partiql/value/PartiQLValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/MissingValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/MissingValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/MissingValue; -} - -public abstract class org/partiql/value/NullValue : org/partiql/value/PartiQLValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/NullValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/NullValue; - public abstract fun withType (Lorg/partiql/value/PartiQLValueType;)Lorg/partiql/value/PartiQLValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/NullValue; -} - -public abstract class org/partiql/value/NumericValue : org/partiql/value/ScalarValue { - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/NumericValue; - public fun isNull ()Z - public abstract fun toDecimal ()Lorg/partiql/value/DecimalValue; - public abstract fun toFloat32 ()Lorg/partiql/value/Float32Value; - public abstract fun toFloat64 ()Lorg/partiql/value/Float64Value; - public abstract fun toInt ()Lorg/partiql/value/IntValue; - public abstract fun toInt16 ()Lorg/partiql/value/Int16Value; - public abstract fun toInt32 ()Lorg/partiql/value/Int32Value; - public abstract fun toInt64 ()Lorg/partiql/value/Int64Value; - public abstract fun toInt8 ()Lorg/partiql/value/Int8Value; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/NumericValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/NumericValue; -} - -public final class org/partiql/value/PartiQL { - public static final fun bagValue (Ljava/lang/Iterable;)Lorg/partiql/value/BagValue; - public static final fun bagValue (Ljava/lang/Iterable;Ljava/util/List;)Lorg/partiql/value/BagValue; - public static final fun bagValue ([Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/BagValue; - public static final fun bagValue ([Lorg/partiql/value/PartiQLValue;Ljava/util/List;)Lorg/partiql/value/BagValue; - public static synthetic fun bagValue$default (Ljava/lang/Iterable;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/BagValue; - public static synthetic fun bagValue$default ([Lorg/partiql/value/PartiQLValue;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/BagValue; - public static final fun binaryValue (Ljava/util/BitSet;)Lorg/partiql/value/BinaryValue; - public static final fun binaryValue (Ljava/util/BitSet;Ljava/util/List;)Lorg/partiql/value/BinaryValue; - public static synthetic fun binaryValue$default (Ljava/util/BitSet;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/BinaryValue; - public static final fun blobValue ([B)Lorg/partiql/value/BlobValue; - public static final fun blobValue ([BLjava/util/List;)Lorg/partiql/value/BlobValue; - public static synthetic fun blobValue$default ([BLjava/util/List;ILjava/lang/Object;)Lorg/partiql/value/BlobValue; - public static final fun boolValue (Ljava/lang/Boolean;)Lorg/partiql/value/BoolValue; - public static final fun boolValue (Ljava/lang/Boolean;Ljava/util/List;)Lorg/partiql/value/BoolValue; - public static synthetic fun boolValue$default (Ljava/lang/Boolean;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/BoolValue; - public static final fun byteValue (Ljava/lang/Byte;)Lorg/partiql/value/ByteValue; - public static final fun byteValue (Ljava/lang/Byte;Ljava/util/List;)Lorg/partiql/value/ByteValue; - public static synthetic fun byteValue$default (Ljava/lang/Byte;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/ByteValue; - public static final fun charValue (Ljava/lang/Character;)Lorg/partiql/value/CharValue; - public static final fun charValue (Ljava/lang/Character;Ljava/util/List;)Lorg/partiql/value/CharValue; - public static synthetic fun charValue$default (Ljava/lang/Character;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/CharValue; - public static final fun clobValue ([B)Lorg/partiql/value/ClobValue; - public static final fun clobValue ([BLjava/util/List;)Lorg/partiql/value/ClobValue; - public static synthetic fun clobValue$default ([BLjava/util/List;ILjava/lang/Object;)Lorg/partiql/value/ClobValue; - public static final fun dateValue (Lorg/partiql/value/datetime/Date;)Lorg/partiql/value/DateValue; - public static final fun dateValue (Lorg/partiql/value/datetime/Date;Ljava/util/List;)Lorg/partiql/value/DateValue; - public static synthetic fun dateValue$default (Lorg/partiql/value/datetime/Date;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/DateValue; - public static final fun decimalValue (Ljava/math/BigDecimal;)Lorg/partiql/value/DecimalValue; - public static final fun decimalValue (Ljava/math/BigDecimal;Ljava/util/List;)Lorg/partiql/value/DecimalValue; - public static synthetic fun decimalValue$default (Ljava/math/BigDecimal;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/DecimalValue; - public static final fun float32Value (Ljava/lang/Float;)Lorg/partiql/value/Float32Value; - public static final fun float32Value (Ljava/lang/Float;Ljava/util/List;)Lorg/partiql/value/Float32Value; - public static synthetic fun float32Value$default (Ljava/lang/Float;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/Float32Value; - public static final fun float64Value (Ljava/lang/Double;)Lorg/partiql/value/Float64Value; - public static final fun float64Value (Ljava/lang/Double;Ljava/util/List;)Lorg/partiql/value/Float64Value; - public static synthetic fun float64Value$default (Ljava/lang/Double;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/Float64Value; - public static final fun int16Value (Ljava/lang/Short;)Lorg/partiql/value/Int16Value; - public static final fun int16Value (Ljava/lang/Short;Ljava/util/List;)Lorg/partiql/value/Int16Value; - public static synthetic fun int16Value$default (Ljava/lang/Short;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/Int16Value; - public static final fun int32Value (Ljava/lang/Integer;)Lorg/partiql/value/Int32Value; - public static final fun int32Value (Ljava/lang/Integer;Ljava/util/List;)Lorg/partiql/value/Int32Value; - public static synthetic fun int32Value$default (Ljava/lang/Integer;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/Int32Value; - public static final fun int64Value (Ljava/lang/Long;)Lorg/partiql/value/Int64Value; - public static final fun int64Value (Ljava/lang/Long;Ljava/util/List;)Lorg/partiql/value/Int64Value; - public static synthetic fun int64Value$default (Ljava/lang/Long;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/Int64Value; - public static final fun int8Value (Ljava/lang/Byte;)Lorg/partiql/value/Int8Value; - public static final fun int8Value (Ljava/lang/Byte;Ljava/util/List;)Lorg/partiql/value/Int8Value; - public static synthetic fun int8Value$default (Ljava/lang/Byte;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/Int8Value; - public static final fun intValue (Ljava/math/BigInteger;)Lorg/partiql/value/IntValue; - public static final fun intValue (Ljava/math/BigInteger;Ljava/util/List;)Lorg/partiql/value/IntValue; - public static synthetic fun intValue$default (Ljava/math/BigInteger;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/IntValue; - public static final fun intervalValue (Ljava/lang/Long;)Lorg/partiql/value/IntervalValue; - public static final fun intervalValue (Ljava/lang/Long;Ljava/util/List;)Lorg/partiql/value/IntervalValue; - public static synthetic fun intervalValue$default (Ljava/lang/Long;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/IntervalValue; - public static final fun listValue (Ljava/lang/Iterable;)Lorg/partiql/value/ListValue; - public static final fun listValue (Ljava/lang/Iterable;Ljava/util/List;)Lorg/partiql/value/ListValue; - public static final fun listValue ([Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/ListValue; - public static final fun listValue ([Lorg/partiql/value/PartiQLValue;Ljava/util/List;)Lorg/partiql/value/ListValue; - public static synthetic fun listValue$default (Ljava/lang/Iterable;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/ListValue; - public static synthetic fun listValue$default ([Lorg/partiql/value/PartiQLValue;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/ListValue; - public static final fun missingValue ()Lorg/partiql/value/MissingValue; - public static final fun missingValue (Ljava/util/List;)Lorg/partiql/value/MissingValue; - public static synthetic fun missingValue$default (Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/MissingValue; - public static final fun nullValue ()Lorg/partiql/value/NullValue; - public static final fun nullValue (Ljava/util/List;)Lorg/partiql/value/NullValue; - public static synthetic fun nullValue$default (Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/NullValue; - public static final fun sexpValue (Ljava/lang/Iterable;)Lorg/partiql/value/SexpValue; - public static final fun sexpValue (Ljava/lang/Iterable;Ljava/util/List;)Lorg/partiql/value/SexpValue; - public static final fun sexpValue ([Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/SexpValue; - public static final fun sexpValue ([Lorg/partiql/value/PartiQLValue;Ljava/util/List;)Lorg/partiql/value/SexpValue; - public static synthetic fun sexpValue$default (Ljava/lang/Iterable;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/SexpValue; - public static synthetic fun sexpValue$default ([Lorg/partiql/value/PartiQLValue;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/SexpValue; - public static final fun stringValue (Ljava/lang/String;)Lorg/partiql/value/StringValue; - public static final fun stringValue (Ljava/lang/String;Ljava/util/List;)Lorg/partiql/value/StringValue; - public static synthetic fun stringValue$default (Ljava/lang/String;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/StringValue; - public static final fun structValue (Ljava/lang/Iterable;)Lorg/partiql/value/StructValue; - public static final fun structValue (Ljava/lang/Iterable;Ljava/util/List;)Lorg/partiql/value/StructValue; - public static final fun structValue ([Lkotlin/Pair;)Lorg/partiql/value/StructValue; - public static final fun structValue ([Lkotlin/Pair;Ljava/util/List;)Lorg/partiql/value/StructValue; - public static synthetic fun structValue$default (Ljava/lang/Iterable;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/StructValue; - public static synthetic fun structValue$default ([Lkotlin/Pair;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/StructValue; - public static final fun structValueMap (Ljava/util/Map;)Lorg/partiql/value/StructValue; - public static final fun structValueMap (Ljava/util/Map;Ljava/util/List;)Lorg/partiql/value/StructValue; - public static synthetic fun structValueMap$default (Ljava/util/Map;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/StructValue; - public static final fun structValueMultiMap (Ljava/util/Map;)Lorg/partiql/value/StructValue; - public static final fun structValueMultiMap (Ljava/util/Map;Ljava/util/List;)Lorg/partiql/value/StructValue; - public static synthetic fun structValueMultiMap$default (Ljava/util/Map;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/StructValue; - public static final fun symbolValue (Ljava/lang/String;)Lorg/partiql/value/SymbolValue; - public static final fun symbolValue (Ljava/lang/String;Ljava/util/List;)Lorg/partiql/value/SymbolValue; - public static synthetic fun symbolValue$default (Ljava/lang/String;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/SymbolValue; - public static final fun timeValue (Lorg/partiql/value/datetime/Time;)Lorg/partiql/value/TimeValue; - public static final fun timeValue (Lorg/partiql/value/datetime/Time;Ljava/util/List;)Lorg/partiql/value/TimeValue; - public static synthetic fun timeValue$default (Lorg/partiql/value/datetime/Time;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/TimeValue; - public static final fun timestampValue (Lorg/partiql/value/datetime/Timestamp;)Lorg/partiql/value/TimestampValue; - public static final fun timestampValue (Lorg/partiql/value/datetime/Timestamp;Ljava/util/List;)Lorg/partiql/value/TimestampValue; - public static synthetic fun timestampValue$default (Lorg/partiql/value/datetime/Timestamp;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/TimestampValue; -} - -public abstract interface class org/partiql/value/PartiQLValue { - public static final field Companion Lorg/partiql/value/PartiQLValue$Companion; - public abstract fun accept (Lorg/partiql/value/util/PartiQLValueVisitor;Ljava/lang/Object;)Ljava/lang/Object; - public static fun comparator ()Ljava/util/Comparator; - public static fun comparator (Z)Ljava/util/Comparator; - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/PartiQLValue; - public abstract fun getAnnotations ()Ljava/util/List; - public abstract fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/PartiQLValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/PartiQLValue; -} - -public final class org/partiql/value/PartiQLValue$Companion { - public final fun comparator ()Ljava/util/Comparator; - public final fun comparator (Z)Ljava/util/Comparator; - public static synthetic fun comparator$default (Lorg/partiql/value/PartiQLValue$Companion;ZILjava/lang/Object;)Ljava/util/Comparator; -} - -public final class org/partiql/value/PartiQLValue$DefaultImpls { - public static synthetic fun copy$default (Lorg/partiql/value/PartiQLValue;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/value/PartiQLValue; -} - -public abstract interface annotation class org/partiql/value/PartiQLValueExperimental : java/lang/annotation/Annotation { -} - -public final class org/partiql/value/PartiQLValueKt { - public static final fun toIon (Lorg/partiql/value/PartiQLValue;)Lcom/amazon/ionelement/api/IonElement; -} - -public final class org/partiql/value/PartiQLValueType : java/lang/Enum { - public static final field ANY Lorg/partiql/value/PartiQLValueType; - public static final field BAG Lorg/partiql/value/PartiQLValueType; - public static final field BINARY Lorg/partiql/value/PartiQLValueType; - public static final field BLOB Lorg/partiql/value/PartiQLValueType; - public static final field BOOL Lorg/partiql/value/PartiQLValueType; - public static final field BYTE Lorg/partiql/value/PartiQLValueType; - public static final field CHAR Lorg/partiql/value/PartiQLValueType; - public static final field CLOB Lorg/partiql/value/PartiQLValueType; - public static final field DATE Lorg/partiql/value/PartiQLValueType; - public static final field DECIMAL Lorg/partiql/value/PartiQLValueType; - public static final field DECIMAL_ARBITRARY Lorg/partiql/value/PartiQLValueType; - public static final field FLOAT32 Lorg/partiql/value/PartiQLValueType; - public static final field FLOAT64 Lorg/partiql/value/PartiQLValueType; - public static final field INT Lorg/partiql/value/PartiQLValueType; - public static final field INT16 Lorg/partiql/value/PartiQLValueType; - public static final field INT32 Lorg/partiql/value/PartiQLValueType; - public static final field INT64 Lorg/partiql/value/PartiQLValueType; - public static final field INT8 Lorg/partiql/value/PartiQLValueType; - public static final field INTERVAL Lorg/partiql/value/PartiQLValueType; - public static final field LIST Lorg/partiql/value/PartiQLValueType; - public static final field MISSING Lorg/partiql/value/PartiQLValueType; - public static final field NULL Lorg/partiql/value/PartiQLValueType; - public static final field SEXP Lorg/partiql/value/PartiQLValueType; - public static final field STRING Lorg/partiql/value/PartiQLValueType; - public static final field STRUCT Lorg/partiql/value/PartiQLValueType; - public static final field SYMBOL Lorg/partiql/value/PartiQLValueType; - public static final field TIME Lorg/partiql/value/PartiQLValueType; - public static final field TIMESTAMP Lorg/partiql/value/PartiQLValueType; - public static fun getEntries ()Lkotlin/enums/EnumEntries; - public final fun toPType ()Lorg/partiql/types/PType; - public static fun valueOf (Ljava/lang/String;)Lorg/partiql/value/PartiQLValueType; - public static fun values ()[Lorg/partiql/value/PartiQLValueType; -} - -public abstract interface class org/partiql/value/ScalarValue : org/partiql/value/PartiQLValue { - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/ScalarValue; - public abstract fun getValue ()Ljava/lang/Object; - public abstract fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/ScalarValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/ScalarValue; -} - -public final class org/partiql/value/ScalarValue$DefaultImpls { - public static fun isNull (Lorg/partiql/value/ScalarValue;)Z -} - -public abstract class org/partiql/value/SexpValue : org/partiql/value/CollectionValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/SexpValue; - public fun equals (Ljava/lang/Object;)Z - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun hashCode ()I - public fun iterator ()Ljava/util/Iterator; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/SexpValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/SexpValue; -} - -public abstract class org/partiql/value/StringValue : org/partiql/value/TextValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/StringValue; - public fun getString ()Ljava/lang/String; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/StringValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/StringValue; -} - -public abstract class org/partiql/value/StructValue : org/partiql/value/PartiQLValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/StructValue; - public fun equals (Ljava/lang/Object;)Z - public abstract fun get (Ljava/lang/String;)Lorg/partiql/value/PartiQLValue; - public abstract fun getAll (Ljava/lang/String;)Ljava/lang/Iterable; - public abstract fun getEntries ()Ljava/lang/Iterable; - public abstract fun getFields ()Ljava/lang/Iterable; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun getValues ()Ljava/lang/Iterable; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/StructValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/StructValue; -} - -public abstract class org/partiql/value/SymbolValue : org/partiql/value/TextValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/SymbolValue; - public fun getString ()Ljava/lang/String; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/SymbolValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/SymbolValue; -} - -public abstract class org/partiql/value/TextValue : org/partiql/value/ScalarValue { - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/TextValue; - public abstract fun getString ()Ljava/lang/String; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/TextValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/TextValue; -} - -public abstract class org/partiql/value/TimeValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/TimeValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/TimeValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/TimeValue; -} - -public abstract class org/partiql/value/TimestampValue : org/partiql/value/ScalarValue { - public fun ()V - public abstract fun copy (Ljava/util/List;)Lorg/partiql/value/TimestampValue; - public fun getType ()Lorg/partiql/value/PartiQLValueType; - public fun isNull ()Z - public abstract fun withAnnotations (Ljava/util/List;)Lorg/partiql/value/TimestampValue; - public abstract fun withoutAnnotations ()Lorg/partiql/value/TimestampValue; -} - public abstract interface class org/partiql/value/datetime/Date : java/lang/Comparable, org/partiql/value/datetime/DateTime { public abstract fun atTime (Lorg/partiql/value/datetime/Time;)Lorg/partiql/value/datetime/Timestamp; public abstract fun compareTo (Lorg/partiql/value/datetime/Date;)I @@ -1268,146 +821,7 @@ public abstract class org/partiql/value/datetime/TimestampWithoutTimeZone : org/ public abstract fun withTimeZone (Lorg/partiql/value/datetime/TimeZone;)Lorg/partiql/value/datetime/TimestampWithTimeZone; } -public final class org/partiql/value/io/PartiQLValueIonReaderBuilder { - public static final field Companion Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$Companion; - public synthetic fun (Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat;Lcom/amazon/ion/system/IonReaderBuilder;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun build (Lcom/amazon/ionelement/api/IonElement;)Lorg/partiql/value/io/PartiQLValueReader; - public final fun build (Ljava/io/InputStream;)Lorg/partiql/value/io/PartiQLValueReader; - public final fun ionReaderBuilder (Lcom/amazon/ion/system/IonReaderBuilder;)Lorg/partiql/value/io/PartiQLValueIonReaderBuilder; - public final fun sourceDataFormat (Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat;)Lorg/partiql/value/io/PartiQLValueIonReaderBuilder; - public static final fun standard ()Lorg/partiql/value/io/PartiQLValueIonReaderBuilder; -} - -public final class org/partiql/value/io/PartiQLValueIonReaderBuilder$Companion { - public final fun standard ()Lorg/partiql/value/io/PartiQLValueIonReaderBuilder; -} - -public final class org/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat : java/lang/Enum { - public static final field IonForPartiQL Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat; - public static final field IonGeneric Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat; - public static fun getEntries ()Lkotlin/enums/EnumEntries; - public static fun valueOf (Ljava/lang/String;)Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat; - public static fun values ()[Lorg/partiql/value/io/PartiQLValueIonReaderBuilder$SourceDataFormat; -} - -public final class org/partiql/value/io/PartiQLValueIonWriter : org/partiql/value/io/PartiQLValueWriter { - public fun append (Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/io/PartiQLValueWriter; - public fun close ()V -} - -public final class org/partiql/value/io/PartiQLValueIonWriterBuilder { - public static final field Companion Lorg/partiql/value/io/PartiQLValueIonWriterBuilder$Companion; - public synthetic fun (Lcom/amazon/ion/system/IonWriterBuilder;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun build (Ljava/io/OutputStream;)Lorg/partiql/value/io/PartiQLValueWriter; - public final fun ionWriterBuilder (Lcom/amazon/ion/system/IonWriterBuilder;)Lorg/partiql/value/io/PartiQLValueIonWriterBuilder; - public static final fun standardIonBinaryBuilder ()Lorg/partiql/value/io/PartiQLValueIonWriterBuilder; - public static final fun standardIonTextBuilder ()Lorg/partiql/value/io/PartiQLValueIonWriterBuilder; -} - -public final class org/partiql/value/io/PartiQLValueIonWriterBuilder$Companion { - public final fun standardIonBinaryBuilder ()Lorg/partiql/value/io/PartiQLValueIonWriterBuilder; - public final fun standardIonTextBuilder ()Lorg/partiql/value/io/PartiQLValueIonWriterBuilder; -} - -public abstract interface class org/partiql/value/io/PartiQLValueReader : java/lang/AutoCloseable { - public abstract fun read ()Lorg/partiql/value/PartiQLValue; -} - -public final class org/partiql/value/io/PartiQLValueTextWriter : org/partiql/value/io/PartiQLValueWriter { - public fun (Ljava/io/PrintStream;ZLjava/lang/String;)V - public synthetic fun (Ljava/io/PrintStream;ZLjava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun append (Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/io/PartiQLValueWriter; - public fun close ()V -} - -public abstract interface class org/partiql/value/io/PartiQLValueWriter : java/lang/AutoCloseable { - public abstract fun append (Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/io/PartiQLValueWriter; -} - -public final class org/partiql/value/io/PartiQLValueWriterBuilder { - public static final field Companion Lorg/partiql/value/io/PartiQLValueWriterBuilder$Companion; - public final fun build (Ljava/io/OutputStream;)Lorg/partiql/value/io/PartiQLValueWriter; - public final fun formatted (Z)Lorg/partiql/value/io/PartiQLValueWriterBuilder; - public static synthetic fun formatted$default (Lorg/partiql/value/io/PartiQLValueWriterBuilder;ZILjava/lang/Object;)Lorg/partiql/value/io/PartiQLValueWriterBuilder; - public static final fun standard ()Lorg/partiql/value/io/PartiQLValueWriterBuilder; -} - -public final class org/partiql/value/io/PartiQLValueWriterBuilder$Companion { - public final fun standard ()Lorg/partiql/value/io/PartiQLValueWriterBuilder; -} - public final class org/partiql/value/util/NumberExtensionsKt { public static final fun coerceNumbers (Ljava/lang/Number;Ljava/lang/Number;)Lkotlin/Pair; } -public abstract class org/partiql/value/util/PartiQLValueBaseVisitor : org/partiql/value/util/PartiQLValueVisitor { - public fun ()V - public abstract fun defaultReturn (Lorg/partiql/value/PartiQLValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun defaultVisit (Lorg/partiql/value/PartiQLValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visit (Lorg/partiql/value/PartiQLValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitBag (Lorg/partiql/value/BagValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitBinary (Lorg/partiql/value/BinaryValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitBlob (Lorg/partiql/value/BlobValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitBool (Lorg/partiql/value/BoolValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitByte (Lorg/partiql/value/ByteValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitChar (Lorg/partiql/value/CharValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitClob (Lorg/partiql/value/ClobValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitCollection (Lorg/partiql/value/CollectionValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitDate (Lorg/partiql/value/DateValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitDecimal (Lorg/partiql/value/DecimalValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitFloat32 (Lorg/partiql/value/Float32Value;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitFloat64 (Lorg/partiql/value/Float64Value;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitInt (Lorg/partiql/value/IntValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitInt16 (Lorg/partiql/value/Int16Value;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitInt32 (Lorg/partiql/value/Int32Value;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitInt64 (Lorg/partiql/value/Int64Value;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitInt8 (Lorg/partiql/value/Int8Value;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitInterval (Lorg/partiql/value/IntervalValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitList (Lorg/partiql/value/ListValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitMissing (Lorg/partiql/value/MissingValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitNull (Lorg/partiql/value/NullValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitNumeric (Lorg/partiql/value/NumericValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitScalar (Lorg/partiql/value/ScalarValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitSexp (Lorg/partiql/value/SexpValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitString (Lorg/partiql/value/StringValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitStruct (Lorg/partiql/value/StructValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitSymbol (Lorg/partiql/value/SymbolValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitText (Lorg/partiql/value/TextValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitTime (Lorg/partiql/value/TimeValue;Ljava/lang/Object;)Ljava/lang/Object; - public fun visitTimestamp (Lorg/partiql/value/TimestampValue;Ljava/lang/Object;)Ljava/lang/Object; -} - -public abstract interface class org/partiql/value/util/PartiQLValueVisitor { - public abstract fun visit (Lorg/partiql/value/PartiQLValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitBag (Lorg/partiql/value/BagValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitBinary (Lorg/partiql/value/BinaryValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitBlob (Lorg/partiql/value/BlobValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitBool (Lorg/partiql/value/BoolValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitByte (Lorg/partiql/value/ByteValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitChar (Lorg/partiql/value/CharValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitClob (Lorg/partiql/value/ClobValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitCollection (Lorg/partiql/value/CollectionValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitDate (Lorg/partiql/value/DateValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitDecimal (Lorg/partiql/value/DecimalValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitFloat32 (Lorg/partiql/value/Float32Value;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitFloat64 (Lorg/partiql/value/Float64Value;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitInt (Lorg/partiql/value/IntValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitInt16 (Lorg/partiql/value/Int16Value;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitInt32 (Lorg/partiql/value/Int32Value;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitInt64 (Lorg/partiql/value/Int64Value;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitInt8 (Lorg/partiql/value/Int8Value;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitInterval (Lorg/partiql/value/IntervalValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitList (Lorg/partiql/value/ListValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitMissing (Lorg/partiql/value/MissingValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitNull (Lorg/partiql/value/NullValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitNumeric (Lorg/partiql/value/NumericValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitScalar (Lorg/partiql/value/ScalarValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitSexp (Lorg/partiql/value/SexpValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitString (Lorg/partiql/value/StringValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitStruct (Lorg/partiql/value/StructValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitSymbol (Lorg/partiql/value/SymbolValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitText (Lorg/partiql/value/TextValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitTime (Lorg/partiql/value/TimeValue;Ljava/lang/Object;)Ljava/lang/Object; - public abstract fun visitTimestamp (Lorg/partiql/value/TimestampValue;Ljava/lang/Object;)Ljava/lang/Object; -} - diff --git a/partiql-spi/build.gradle.kts b/partiql-spi/build.gradle.kts index 8564fb52e..78168f48f 100644 --- a/partiql-spi/build.gradle.kts +++ b/partiql-spi/build.gradle.kts @@ -16,6 +16,7 @@ plugins { id(Plugins.conventions) id(Plugins.publish) + id(Plugins.testFixtures) } dependencies { @@ -58,6 +59,12 @@ components.withType(AdhocComponentWithVariants::class.java).forEach { c -> } } +tasks.compileTestFixturesKotlin { + kotlinOptions.jvmTarget = Versions.jvmTarget + kotlinOptions.apiVersion = Versions.kotlinApi + kotlinOptions.languageVersion = Versions.kotlinLanguage +} + publish { artifactId = "partiql-spi" name = "PartiQL SPI" diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java b/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java index 0f3647a8c..06e31786b 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java +++ b/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java @@ -1,14 +1,9 @@ package org.partiql.spi.value; -import kotlin.NotImplementedError; -import kotlin.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.partiql.errors.DataException; import org.partiql.types.PType; -import org.partiql.value.PartiQL; -import org.partiql.value.PartiQLValue; -import org.partiql.value.PartiQLValueType; import org.partiql.value.datetime.Date; import org.partiql.value.datetime.Time; import org.partiql.value.datetime.Timestamp; @@ -21,55 +16,13 @@ import java.util.Collections; import java.util.Comparator; import java.util.Iterator; -import java.util.Objects; - -import static org.partiql.types.PType.DYNAMIC; -import static org.partiql.types.PType.BOOL; -import static org.partiql.types.PType.TINYINT; -import static org.partiql.types.PType.SMALLINT; -import static org.partiql.types.PType.INTEGER; -import static org.partiql.types.PType.BIGINT; -import static org.partiql.types.PType.NUMERIC; -import static org.partiql.types.PType.DECIMAL; -import static org.partiql.types.PType.REAL; -import static org.partiql.types.PType.DOUBLE; -import static org.partiql.types.PType.CHAR; -import static org.partiql.types.PType.STRING; -import static org.partiql.types.PType.BLOB; -import static org.partiql.types.PType.CLOB; -import static org.partiql.types.PType.DATE; -import static org.partiql.types.PType.TIME; -import static org.partiql.types.PType.TIMEZ; -import static org.partiql.types.PType.TIMESTAMP; -import static org.partiql.types.PType.TIMESTAMPZ; -import static org.partiql.types.PType.ARRAY; -import static org.partiql.types.PType.BAG; -import static org.partiql.types.PType.ROW; -import static org.partiql.types.PType.STRUCT; -import static org.partiql.types.PType.UNKNOWN; /** - * This is an EXPERIMENTAL representation of a value in PartiQL's type system. The intention of this modeling is to + * This is a representation of a value in PartiQL's type system. The intention of this modeling is to * provide a layer of indirection between PartiQL's type semantics and Java's type semantics. - *

- * ! EXPERIMENTAL ! This API is experimental and may be removed/modified without prior notice. - *

- *

- * INTERNAL DEVELOPER NOTES: - *

- * This is intended to completely replace {@link org.partiql.value.PartiQLValue} in the future (for evaluation). As it - * stands, this implementation will initially be used solely for the evaluator. {@link org.partiql.value.PartiQLValue} - * may be modified to be solely used for the plan representation (DOM). - *

- * Note that this is public, however, it will not be released until it replaces {@link org.partiql.value.PartiQLValue} - * for evaluation. - *

- * There are some pre-requisites to actually replacing {@link PartiQLValue} for evaluation including, but not limited to: - * - The comparator for ordering and aggregations - * - Equality - * - Adding support for annotations */ public interface Datum extends Iterable { + // TODO: Annotations? /** * Determines whether the current value is a null value of any type (for example, null or null.int). It should be @@ -393,168 +346,6 @@ default Datum lower() { throw new UnsupportedOperationException(); } - /** - * Converts a {@link Datum} into a {@link PartiQLValue}. - * - * @return the equivalent {@link PartiQLValue} - * @deprecated this is an experimental API and is designed for use by the internal PartiQL library. This may - * be modified/removed at any time. - */ - @NotNull - @Deprecated - default PartiQLValue toPartiQLValue() { - PType type = this.getType(); - if (this.isMissing()) { - return PartiQL.missingValue(); - } - switch (type.code()) { - case BOOL: - return this.isNull() ? PartiQL.boolValue(null) : PartiQL.boolValue(this.getBoolean()); - case TINYINT: - return this.isNull() ? PartiQL.int8Value(null) : PartiQL.int8Value(this.getByte()); - case SMALLINT: - return this.isNull() ? PartiQL.int16Value(null) : PartiQL.int16Value(this.getShort()); - case INTEGER: - return this.isNull() ? PartiQL.int32Value(null) : PartiQL.int32Value(this.getInt()); - case BIGINT: - return this.isNull() ? PartiQL.int64Value(null) : PartiQL.int64Value(this.getLong()); - case NUMERIC: - return this.isNull() ? PartiQL.intValue(null) : PartiQL.intValue(this.getBigInteger()); - case DECIMAL: - return this.isNull() ? PartiQL.decimalValue(null) : PartiQL.decimalValue(this.getBigDecimal()); - case REAL: - return this.isNull() ? PartiQL.float32Value(null) : PartiQL.float32Value(this.getFloat()); - case DOUBLE: - return this.isNull() ? PartiQL.float64Value(null) : PartiQL.float64Value(this.getDouble()); - case CHAR: - return this.isNull() ? PartiQL.charValue(null) : PartiQL.charValue(this.getString().charAt(0)); - case STRING: - return this.isNull() ? PartiQL.stringValue(null) : PartiQL.stringValue(this.getString()); - case BLOB: - return this.isNull() ? PartiQL.blobValue(null) : PartiQL.blobValue(this.getBytes()); - case CLOB: - return this.isNull() ? PartiQL.clobValue(null) : PartiQL.clobValue(this.getBytes()); - case DATE: - return this.isNull() ? PartiQL.dateValue(null) : PartiQL.dateValue(this.getDate()); - case TIMEZ: - case TIME: // TODO - return this.isNull() ? PartiQL.timeValue(null) : PartiQL.timeValue(this.getTime()); - case TIMESTAMPZ: - case TIMESTAMP: - return this.isNull() ? PartiQL.timestampValue(null) : PartiQL.timestampValue(this.getTimestamp()); - case BAG: - return this.isNull() ? PartiQL.bagValue((Iterable) null) : PartiQL.bagValue(new PQLToPartiQLIterable(this)); - case ARRAY: - return this.isNull() ? PartiQL.listValue((Iterable) null) : PartiQL.listValue(new PQLToPartiQLIterable(this)); - case STRUCT: - case ROW: - return this.isNull() ? PartiQL.structValue((Iterable>) null) : PartiQL.structValue(new PQLToPartiQLStruct(this)); - case DYNAMIC: - case UNKNOWN: - if (this.isNull()) { - return PartiQL.nullValue(); - } else if (this.isMissing()) { - return PartiQL.missingValue(); - } - default: - throw new UnsupportedOperationException("Unsupported datum type: " + type); - } - } - - /** - * Converts a {@link PartiQLValue} into {@link Datum}. - * - * @return the equivalent {@link Datum} - */ - @NotNull - @Deprecated - static Datum of(PartiQLValue value) { - PartiQLValueType type = value.getType(); - if (value.isNull()) { - return new DatumNull(type.toPType()); - } - switch (type) { - case MISSING: - return new DatumMissing(); - case NULL: - return new DatumNull(); - case INT8: - org.partiql.value.Int8Value int8Value = (org.partiql.value.Int8Value) value; - return new DatumByte(Objects.requireNonNull(int8Value.getValue()), PType.tinyint()); - case STRUCT: - @SuppressWarnings("unchecked") org.partiql.value.StructValue STRUCTValue = (org.partiql.value.StructValue) value; - return new DatumStruct(new PartiQLToPQLStruct(Objects.requireNonNull(STRUCTValue))); - case STRING: - org.partiql.value.StringValue STRINGValue = (org.partiql.value.StringValue) value; - return new DatumString(Objects.requireNonNull(STRINGValue.getValue()), PType.string()); - case INT64: - org.partiql.value.Int64Value INT64Value = (org.partiql.value.Int64Value) value; - return new DatumLong(Objects.requireNonNull(INT64Value.getValue())); - case INT32: - org.partiql.value.Int32Value INT32Value = (org.partiql.value.Int32Value) value; - return new DatumInt(Objects.requireNonNull(INT32Value.getValue())); - case INT16: - org.partiql.value.Int16Value INT16Value = (org.partiql.value.Int16Value) value; - return new DatumShort(Objects.requireNonNull(INT16Value.getValue())); - case SEXP: - throw new IllegalStateException("SEXP is not supported."); - case LIST: - @SuppressWarnings("unchecked") org.partiql.value.ListValue LISTValue = (org.partiql.value.ListValue) value; - return new DatumCollection(new PartiQLToPQLIterable(Objects.requireNonNull(LISTValue)), PType.array()); - case BOOL: - org.partiql.value.BoolValue BOOLValue = (org.partiql.value.BoolValue) value; - return new DatumBoolean(Objects.requireNonNull(BOOLValue.getValue())); - case INT: - org.partiql.value.IntValue INTValue = (org.partiql.value.IntValue) value; - return new DatumBigInteger(Objects.requireNonNull(INTValue.getValue())); - case BAG: - @SuppressWarnings("unchecked") org.partiql.value.BagValue BAGValue = (org.partiql.value.BagValue) value; - return new DatumCollection(new PartiQLToPQLIterable(Objects.requireNonNull(BAGValue)), PType.bag()); - case BINARY: - throw new UnsupportedOperationException(); - case DATE: - org.partiql.value.DateValue DATEValue = (org.partiql.value.DateValue) value; - return new DatumDate(Objects.requireNonNull(DATEValue.getValue())); - case INTERVAL: - org.partiql.value.IntervalValue INTERVALValue = (org.partiql.value.IntervalValue) value; - return new DatumInterval(Objects.requireNonNull(INTERVALValue.getValue())); - case TIMESTAMP: - org.partiql.value.TimestampValue TIMESTAMPValue = (org.partiql.value.TimestampValue) value; - return new DatumTimestamp(Objects.requireNonNull(TIMESTAMPValue.getValue())); - case TIME: - org.partiql.value.TimeValue TIMEValue = (org.partiql.value.TimeValue) value; - return new DatumTime(Objects.requireNonNull(TIMEValue.getValue())); - case FLOAT32: - org.partiql.value.Float32Value FLOAT32Value = (org.partiql.value.Float32Value) value; - return new DatumFloat(Objects.requireNonNull(FLOAT32Value.getValue())); - case FLOAT64: - org.partiql.value.Float64Value FLOAT64Value = (org.partiql.value.Float64Value) value; - return new DatumDouble(Objects.requireNonNull(FLOAT64Value.getValue())); - case DECIMAL: - case DECIMAL_ARBITRARY: - org.partiql.value.DecimalValue DECIMALValue = (org.partiql.value.DecimalValue) value; - BigDecimal d = Objects.requireNonNull(DECIMALValue.getValue()); - return Datum.decimal(d, d.precision(), d.scale()); - case CHAR: - org.partiql.value.CharValue CHARValue = (org.partiql.value.CharValue) value; - String charString = Objects.requireNonNull(CHARValue.getValue()).toString(); - return new DatumChars(charString, charString.length()); - case SYMBOL: - throw new IllegalStateException("SYMBOL not supported."); - case CLOB: - org.partiql.value.ClobValue CLOBValue = (org.partiql.value.ClobValue) value; - return new DatumBytes(Objects.requireNonNull(CLOBValue.getValue()), PType.clob(Integer.MAX_VALUE)); // TODO - case BLOB: - org.partiql.value.BlobValue BLOBValue = (org.partiql.value.BlobValue) value; - return new DatumBytes(Objects.requireNonNull(BLOBValue.getValue()), PType.blob(Integer.MAX_VALUE)); // TODO - case BYTE: - throw new UnsupportedOperationException(); - case ANY: - default: - throw new NotImplementedError(); - } - } - @NotNull static Datum nullValue() { return new DatumNull(); @@ -572,12 +363,9 @@ static Datum nullValue(@NotNull PType type) { /** * Returns a typed missing value - * ! EXPERIMENTAL ! This is subject to breaking changes and/or removal without prior notice. * @param type the type of the value * @return a typed missing value - * @deprecated this may not be required. This is subject to removal. */ - @Deprecated @NotNull static Datum missing(@NotNull PType type) { return new DatumMissing(type); @@ -745,11 +533,21 @@ static Datum time(@NotNull Time value) { return new DatumTime(value); } + @NotNull + static Datum time(@NotNull Time value, int precision) { + return new DatumTime(value, precision); + } + @NotNull static Datum timestamp(@NotNull Timestamp value) { return new DatumTimestamp(value); } + @NotNull + static Datum timestamp(@NotNull Timestamp value, int precision) { + return new DatumTimestamp(value, precision); + } + // COLLECTIONS @NotNull diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/DatumTime.java b/partiql-spi/src/main/java/org/partiql/spi/value/DatumTime.java index 1a2391e66..77519937b 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/DatumTime.java +++ b/partiql-spi/src/main/java/org/partiql/spi/value/DatumTime.java @@ -12,12 +12,17 @@ class DatumTime implements Datum { @NotNull private final Time _value; - // TODO: Pass precision to constructor. // TODO: Create a variant specifically for without TZ - private final static PType _type = PType.timez(6); + private final PType _type; DatumTime(@NotNull Time value) { _value = value; + _type = PType.timez(6); + } + + DatumTime(@NotNull Time value, int precision) { + _value = value; + _type = PType.timez(precision); } @Override diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/DatumTimestamp.java b/partiql-spi/src/main/java/org/partiql/spi/value/DatumTimestamp.java index bc72fa684..77079577b 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/DatumTimestamp.java +++ b/partiql-spi/src/main/java/org/partiql/spi/value/DatumTimestamp.java @@ -12,12 +12,17 @@ class DatumTimestamp implements Datum { @NotNull private final Timestamp _value; - // TODO: Pass precision to constructor. // TODO: Create a variant specifically for without TZ - private final static PType _type = PType.timestampz(6); + private final PType _type; DatumTimestamp(@NotNull Timestamp value) { _value = value; + _type = PType.timestampz(6); + } + + DatumTimestamp(@NotNull Timestamp value, int precision) { + _value = value; + _type = PType.timestampz(precision); } @Override diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/Field.java b/partiql-spi/src/main/java/org/partiql/spi/value/Field.java index 8c6ea2802..b7b833359 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/Field.java +++ b/partiql-spi/src/main/java/org/partiql/spi/value/Field.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.NotNull; /** - * Represents a field within a PartiQL {@link org.partiql.value.PartiQLValueType#STRUCT}. + * Represents a field within a PartiQL {@link org.partiql.types.PType#STRUCT}. */ public interface Field { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/value/ion/IonDatumReader.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/value/ion/IonDatumReader.kt index 085be8d3e..61f3e00d5 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/value/ion/IonDatumReader.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/value/ion/IonDatumReader.kt @@ -10,6 +10,7 @@ import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader import org.partiql.spi.value.Encoding import org.partiql.spi.value.Field +import org.partiql.types.PType import org.partiql.value.datetime.DateTimeUtil.toBigDecimal import java.io.IOException import java.io.InputStream @@ -66,36 +67,64 @@ internal class IonDatumReader internal constructor( /** * Read without any explicit PartiQL type information. */ - private fun read(): Datum = when (reader.type) { - IonType.NULL -> Datum.nullValue() - IonType.BOOL -> bool() - IonType.INT -> bigint() - IonType.FLOAT -> double() - IonType.DECIMAL -> decimal0() - IonType.TIMESTAMP -> TODO("timestamp without annotation") - IonType.STRING -> varchar0() - IonType.CLOB -> clob0() - IonType.BLOB -> clob0() - IonType.LIST -> array() - IonType.STRUCT -> struct() - IonType.SYMBOL -> missing() - IonType.SEXP -> { - reader.stepIn() - if (reader.next() == null) { - throw IonDatumException("expected type, was null", null, span()) - } - val method = method() - if (reader.next() == null) { - throw IonDatumException("expected value, was null", null, span()) - } - val value = method() - if (reader.next() != null) { - throw IonDatumException("expected end of s-expression pair", null, span()) + private fun read(): Datum { + if (reader.isNullValue) { + return Datum.nullValue(reader.type.toPTypeDefault()) + } + return when (reader.type) { + IonType.NULL -> Datum.nullValue() + IonType.BOOL -> bool() + IonType.INT -> bigint() + IonType.FLOAT -> double() + IonType.DECIMAL -> decimal0() + IonType.TIMESTAMP -> TODO("timestamp without annotation") + IonType.STRING -> varchar0() + IonType.CLOB -> clob0() + IonType.BLOB -> clob0() + IonType.LIST -> array() + IonType.STRUCT -> struct() + IonType.SYMBOL -> missing() + IonType.SEXP -> { + reader.stepIn() + if (reader.next() == null) { + throw IonDatumException("expected type, was null", null, span()) + } + val method = method() + if (reader.next() == null) { + throw IonDatumException("expected value, was null", null, span()) + } + val value = method() + if (reader.next() != null) { + throw IonDatumException("expected end of s-expression pair", null, span()) + } + reader.stepOut() + value } - reader.stepOut() - value + else -> throw IonDatumException("unknown type", null, span()) + } + } + + /** + * Returns the default [PType] for the given [IonType]. + */ + private fun IonType.toPTypeDefault(): PType { + val code = when (this) { + IonType.NULL -> PType.UNKNOWN + IonType.BOOL -> PType.BOOL + IonType.INT -> PType.BIGINT + IonType.FLOAT -> PType.DOUBLE + IonType.DECIMAL -> PType.DECIMAL + IonType.TIMESTAMP -> PType.TIMESTAMP + IonType.STRING -> PType.STRING + IonType.CLOB -> PType.CLOB + IonType.BLOB -> PType.BLOB + IonType.LIST -> PType.ARRAY + IonType.STRUCT -> PType.STRUCT + IonType.SYMBOL -> PType.STRING + IonType.SEXP -> PType.ARRAY + else -> throw IonDatumException("Unknown type", null, span()) } - else -> throw IonDatumException("unknown type", null, span()) + return PType.of(code) } /** diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValueExperimental.kt b/partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValueExperimental.kt deleted file mode 100644 index 175e27e2a..000000000 --- a/partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValueExperimental.kt +++ /dev/null @@ -1,21 +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://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. - */ - -package org.partiql.value - -@RequiresOptIn( - message = "PartiQL Value requires explicit opt-in", - level = RequiresOptIn.Level.ERROR, -) -public annotation class PartiQLValueExperimental diff --git a/partiql-spi/src/test/kotlin/org/partiql/value/PartiQLValueComparatorTest.kt b/partiql-spi/src/test/kotlin/org/partiql/value/PartiQLValueComparatorTest.kt index b0a23be17..8bb163586 100644 --- a/partiql-spi/src/test/kotlin/org/partiql/value/PartiQLValueComparatorTest.kt +++ b/partiql-spi/src/test/kotlin/org/partiql/value/PartiQLValueComparatorTest.kt @@ -10,7 +10,6 @@ import java.math.BigDecimal import java.util.Base64 import java.util.Random -@OptIn(PartiQLValueExperimental::class) class PartiQLValueComparatorTest { class EquivValues(vararg val values: PartiQLValue) diff --git a/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueIonSerdeTest.kt b/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueIonSerdeTest.kt index 3b4437fe0..39e9fb615 100644 --- a/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueIonSerdeTest.kt +++ b/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueIonSerdeTest.kt @@ -11,9 +11,10 @@ import org.junit.jupiter.api.parallel.Execution import org.junit.jupiter.api.parallel.ExecutionMode import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource +import org.partiql.spi.value.io.PartiQLValueIonReaderBuilder +import org.partiql.spi.value.io.PartiQLValueIonWriterBuilder import org.partiql.value.Annotations import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.bagValue import org.partiql.value.blobValue import org.partiql.value.boolValue @@ -44,7 +45,6 @@ import java.math.BigDecimal import java.math.BigInteger import kotlin.test.assertEquals -@OptIn(PartiQLValueExperimental::class) class PartiQLValueIonSerdeTest { @ParameterizedTest diff --git a/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueTextWriterTest.kt b/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueTextWriterTest.kt index 6d0783f1f..8b7d471ab 100644 --- a/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueTextWriterTest.kt +++ b/partiql-spi/src/test/kotlin/org/partiql/value/io/PartiQLValueTextWriterTest.kt @@ -1,5 +1,3 @@ -@file:OptIn(PartiQLValueExperimental::class) - package org.partiql.value.io import org.junit.jupiter.api.Assertions @@ -7,9 +5,9 @@ import org.junit.jupiter.api.parallel.Execution import org.junit.jupiter.api.parallel.ExecutionMode import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.MethodSource +import org.partiql.spi.value.io.PartiQLValueTextWriter import org.partiql.value.Annotations import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.bagValue import org.partiql.value.boolValue import org.partiql.value.charValue @@ -86,7 +84,6 @@ class PartiQLValueTextWriterTest { @Execution(ExecutionMode.CONCURRENT) fun testAnnotations(case: Case) = case.assert() - @OptIn(PartiQLValueExperimental::class) companion object { private val annotations: Annotations = listOf("x", "y") @@ -759,7 +756,6 @@ class PartiQLValueTextWriterTest { ) } - @OptIn(PartiQLValueExperimental::class) class Case( private val value: PartiQLValue, private val expected: String, diff --git a/partiql-spi/src/testFixtures/java/org/partiql/spi/value/DatumUtils.java b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/DatumUtils.java new file mode 100644 index 000000000..54beeb963 --- /dev/null +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/DatumUtils.java @@ -0,0 +1,195 @@ +package org.partiql.spi.value; + +import kotlin.NotImplementedError; +import kotlin.Pair; +import org.jetbrains.annotations.NotNull; +import org.partiql.types.PType; +import org.partiql.value.PartiQL; +import org.partiql.value.PartiQLValue; +import org.partiql.value.PartiQLValueType; +import java.math.BigDecimal; +import java.util.Objects; +import static org.partiql.types.PType.ARRAY; +import static org.partiql.types.PType.BAG; +import static org.partiql.types.PType.BIGINT; +import static org.partiql.types.PType.BLOB; +import static org.partiql.types.PType.BOOL; +import static org.partiql.types.PType.CHAR; +import static org.partiql.types.PType.CLOB; +import static org.partiql.types.PType.DATE; +import static org.partiql.types.PType.DECIMAL; +import static org.partiql.types.PType.DOUBLE; +import static org.partiql.types.PType.DYNAMIC; +import static org.partiql.types.PType.INTEGER; +import static org.partiql.types.PType.NUMERIC; +import static org.partiql.types.PType.REAL; +import static org.partiql.types.PType.ROW; +import static org.partiql.types.PType.SMALLINT; +import static org.partiql.types.PType.STRING; +import static org.partiql.types.PType.STRUCT; +import static org.partiql.types.PType.TIME; +import static org.partiql.types.PType.TIMESTAMP; +import static org.partiql.types.PType.TIMESTAMPZ; +import static org.partiql.types.PType.TIMEZ; +import static org.partiql.types.PType.TINYINT; +import static org.partiql.types.PType.UNKNOWN; + +public class DatumUtils { + + /** + * Converts a {@link Datum} into a {@link PartiQLValue}. + * @return the equivalent {@link PartiQLValue} + */ + @NotNull + public static PartiQLValue toPartiQLValue(@NotNull Datum datum) { + PType type = datum.getType(); + if (datum.isMissing()) { + return PartiQL.missingValue(); + } + switch (type.code()) { + case BOOL: + return datum.isNull() ? PartiQL.boolValue(null) : PartiQL.boolValue(datum.getBoolean()); + case TINYINT: + return datum.isNull() ? PartiQL.int8Value(null) : PartiQL.int8Value(datum.getByte()); + case SMALLINT: + return datum.isNull() ? PartiQL.int16Value(null) : PartiQL.int16Value(datum.getShort()); + case INTEGER: + return datum.isNull() ? PartiQL.int32Value(null) : PartiQL.int32Value(datum.getInt()); + case BIGINT: + return datum.isNull() ? PartiQL.int64Value(null) : PartiQL.int64Value(datum.getLong()); + case NUMERIC: + return datum.isNull() ? PartiQL.intValue(null) : PartiQL.intValue(datum.getBigInteger()); + case DECIMAL: + return datum.isNull() ? PartiQL.decimalValue(null) : PartiQL.decimalValue(datum.getBigDecimal()); + case REAL: + return datum.isNull() ? PartiQL.float32Value(null) : PartiQL.float32Value(datum.getFloat()); + case DOUBLE: + return datum.isNull() ? PartiQL.float64Value(null) : PartiQL.float64Value(datum.getDouble()); + case CHAR: + return datum.isNull() ? PartiQL.charValue(null) : PartiQL.charValue(datum.getString().charAt(0)); + case STRING: + return datum.isNull() ? PartiQL.stringValue(null) : PartiQL.stringValue(datum.getString()); + case BLOB: + return datum.isNull() ? PartiQL.blobValue(null) : PartiQL.blobValue(datum.getBytes()); + case CLOB: + return datum.isNull() ? PartiQL.clobValue(null) : PartiQL.clobValue(datum.getBytes()); + case DATE: + return datum.isNull() ? PartiQL.dateValue(null) : PartiQL.dateValue(datum.getDate()); + case TIMEZ: + case TIME: // TODO + return datum.isNull() ? PartiQL.timeValue(null) : PartiQL.timeValue(datum.getTime()); + case TIMESTAMPZ: + case TIMESTAMP: + return datum.isNull() ? PartiQL.timestampValue(null) : PartiQL.timestampValue(datum.getTimestamp()); + case BAG: + return datum.isNull() ? PartiQL.bagValue((Iterable) null) : PartiQL.bagValue(new PQLToPartiQLIterable(datum)); + case ARRAY: + return datum.isNull() ? PartiQL.listValue((Iterable) null) : PartiQL.listValue(new PQLToPartiQLIterable(datum)); + case STRUCT: + case ROW: + return datum.isNull() ? PartiQL.structValue((Iterable>) null) : PartiQL.structValue(new PQLToPartiQLStruct(datum)); + case DYNAMIC: + case UNKNOWN: + if (datum.isNull()) { + return PartiQL.nullValue(); + } else if (datum.isMissing()) { + return PartiQL.missingValue(); + } + default: + throw new UnsupportedOperationException("Unsupported datum type: " + type); + } + } + + /** + * Converts a {@link PartiQLValue} into {@link Datum}. + * + * @return the equivalent {@link Datum} + */ + @NotNull + public static Datum toDatum(PartiQLValue value) { + PartiQLValueType type = value.getType(); + if (value.isNull()) { + return new DatumNull(type.toPType()); + } + switch (type) { + case MISSING: + return new DatumMissing(); + case NULL: + return new DatumNull(); + case INT8: + org.partiql.value.Int8Value int8Value = (org.partiql.value.Int8Value) value; + return new DatumByte(Objects.requireNonNull(int8Value.getValue()), PType.tinyint()); + case STRUCT: + @SuppressWarnings("unchecked") org.partiql.value.StructValue STRUCTValue = (org.partiql.value.StructValue) value; + return new DatumStruct(new PartiQLToPQLStruct(Objects.requireNonNull(STRUCTValue))); + case STRING: + org.partiql.value.StringValue STRINGValue = (org.partiql.value.StringValue) value; + return new DatumString(Objects.requireNonNull(STRINGValue.getValue()), PType.string()); + case INT64: + org.partiql.value.Int64Value INT64Value = (org.partiql.value.Int64Value) value; + return new DatumLong(Objects.requireNonNull(INT64Value.getValue())); + case INT32: + org.partiql.value.Int32Value INT32Value = (org.partiql.value.Int32Value) value; + return new DatumInt(Objects.requireNonNull(INT32Value.getValue())); + case INT16: + org.partiql.value.Int16Value INT16Value = (org.partiql.value.Int16Value) value; + return new DatumShort(Objects.requireNonNull(INT16Value.getValue())); + case SEXP: + throw new IllegalStateException("SEXP is not supported."); + case LIST: + @SuppressWarnings("unchecked") org.partiql.value.ListValue LISTValue = (org.partiql.value.ListValue) value; + return new DatumCollection(new PartiQLToPQLIterable(Objects.requireNonNull(LISTValue)), PType.array()); + case BOOL: + org.partiql.value.BoolValue BOOLValue = (org.partiql.value.BoolValue) value; + return new DatumBoolean(Objects.requireNonNull(BOOLValue.getValue())); + case INT: + org.partiql.value.IntValue INTValue = (org.partiql.value.IntValue) value; + return new DatumBigInteger(Objects.requireNonNull(INTValue.getValue())); + case BAG: + @SuppressWarnings("unchecked") org.partiql.value.BagValue BAGValue = (org.partiql.value.BagValue) value; + return new DatumCollection(new PartiQLToPQLIterable(Objects.requireNonNull(BAGValue)), PType.bag()); + case BINARY: + throw new UnsupportedOperationException(); + case DATE: + org.partiql.value.DateValue DATEValue = (org.partiql.value.DateValue) value; + return new DatumDate(Objects.requireNonNull(DATEValue.getValue())); + case INTERVAL: + org.partiql.value.IntervalValue INTERVALValue = (org.partiql.value.IntervalValue) value; + return new DatumInterval(Objects.requireNonNull(INTERVALValue.getValue())); + case TIMESTAMP: + org.partiql.value.TimestampValue TIMESTAMPValue = (org.partiql.value.TimestampValue) value; + return new DatumTimestamp(Objects.requireNonNull(TIMESTAMPValue.getValue())); + case TIME: + org.partiql.value.TimeValue TIMEValue = (org.partiql.value.TimeValue) value; + return new DatumTime(Objects.requireNonNull(TIMEValue.getValue())); + case FLOAT32: + org.partiql.value.Float32Value FLOAT32Value = (org.partiql.value.Float32Value) value; + return new DatumFloat(Objects.requireNonNull(FLOAT32Value.getValue())); + case FLOAT64: + org.partiql.value.Float64Value FLOAT64Value = (org.partiql.value.Float64Value) value; + return new DatumDouble(Objects.requireNonNull(FLOAT64Value.getValue())); + case DECIMAL: + case DECIMAL_ARBITRARY: + org.partiql.value.DecimalValue DECIMALValue = (org.partiql.value.DecimalValue) value; + BigDecimal d = Objects.requireNonNull(DECIMALValue.getValue()); + return Datum.decimal(d, d.precision(), d.scale()); + case CHAR: + org.partiql.value.CharValue CHARValue = (org.partiql.value.CharValue) value; + String charString = Objects.requireNonNull(CHARValue.getValue()).toString(); + return new DatumChars(charString, charString.length()); + case SYMBOL: + throw new IllegalStateException("SYMBOL not supported."); + case CLOB: + org.partiql.value.ClobValue CLOBValue = (org.partiql.value.ClobValue) value; + return new DatumBytes(Objects.requireNonNull(CLOBValue.getValue()), PType.clob(Integer.MAX_VALUE)); // TODO + case BLOB: + org.partiql.value.BlobValue BLOBValue = (org.partiql.value.BlobValue) value; + return new DatumBytes(Objects.requireNonNull(BLOBValue.getValue()), PType.blob(Integer.MAX_VALUE)); // TODO + case BYTE: + throw new UnsupportedOperationException(); + case ANY: + default: + throw new NotImplementedError(); + } + } +} diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/PQLToPartiQLIterable.java b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PQLToPartiQLIterable.java similarity index 91% rename from partiql-spi/src/main/java/org/partiql/spi/value/PQLToPartiQLIterable.java rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/PQLToPartiQLIterable.java index 16224d111..9a7355cf8 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/PQLToPartiQLIterable.java +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PQLToPartiQLIterable.java @@ -2,7 +2,6 @@ import org.jetbrains.annotations.NotNull; import org.partiql.value.PartiQLValue; - import java.util.Iterator; class PQLToPartiQLIterable implements Iterable { @@ -26,7 +25,7 @@ public boolean hasNext() { @Override public PartiQLValue next() { - return iter.next().toPartiQLValue(); + return DatumUtils.toPartiQLValue(iter.next()); } }; } diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/PQLToPartiQLStruct.java b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PQLToPartiQLStruct.java similarity index 89% rename from partiql-spi/src/main/java/org/partiql/spi/value/PQLToPartiQLStruct.java rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/PQLToPartiQLStruct.java index 18801eb7d..ea29f2d24 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/PQLToPartiQLStruct.java +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PQLToPartiQLStruct.java @@ -3,7 +3,6 @@ import kotlin.Pair; import org.jetbrains.annotations.NotNull; import org.partiql.value.PartiQLValue; - import java.util.Iterator; class PQLToPartiQLStruct implements Iterable> { @@ -28,7 +27,7 @@ public boolean hasNext() { @Override public Pair next() { Field field = _fields.next(); - return new Pair<>(field.getName(), field.getValue().toPartiQLValue()); + return new Pair<>(field.getName(), DatumUtils.toPartiQLValue(field.getValue())); } }; } diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/PartiQLToPQLIterable.java b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PartiQLToPQLIterable.java similarity index 95% rename from partiql-spi/src/main/java/org/partiql/spi/value/PartiQLToPQLIterable.java rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/PartiQLToPQLIterable.java index eb3d7cbfd..d835e9b4d 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/PartiQLToPQLIterable.java +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PartiQLToPQLIterable.java @@ -31,7 +31,7 @@ public boolean hasNext() { @Override public Datum next() { PartiQLValue value = _value.next(); - return Datum.of(value); + return DatumUtils.toDatum(value); } } } diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/PartiQLToPQLStruct.java b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PartiQLToPQLStruct.java similarity index 95% rename from partiql-spi/src/main/java/org/partiql/spi/value/PartiQLToPQLStruct.java rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/PartiQLToPQLStruct.java index 6d7bcbff0..06613f8c8 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/value/PartiQLToPQLStruct.java +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/PartiQLToPQLStruct.java @@ -42,7 +42,7 @@ public String getName() { @NotNull @Override public Datum getValue() { - return Datum.of(value.getSecond()); + return DatumUtils.toDatum(value.getSecond()); } }; } diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueIonReader.kt similarity index 99% rename from partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueIonReader.kt index 7c49b096c..cfc2b6a36 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueIonReader.kt +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueIonReader.kt @@ -1,4 +1,4 @@ -package org.partiql.value.io +package org.partiql.spi.value.io import com.amazon.ion.IonReader import com.amazon.ion.IonType @@ -8,7 +8,6 @@ import com.amazon.ionelement.api.IonElement import org.partiql.value.DecimalValue import org.partiql.value.IntValue import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.PartiQLValueType import org.partiql.value.bagValue import org.partiql.value.blobValue @@ -42,7 +41,6 @@ import java.math.BigDecimal * The reader will attempt to create a time value * */ -@OptIn(PartiQLValueExperimental::class) internal class PartiQLValueIonReader( private val ionReader: IonReader, private val sourceDataFormat: PartiQLValueIonReaderBuilder.SourceDataFormat @@ -544,7 +542,6 @@ internal class PartiQLValueIonReader( } } -@OptIn(PartiQLValueExperimental::class) public class PartiQLValueIonReaderBuilder private constructor( private var sourceDataFormat: SourceDataFormat = SourceDataFormat.IonForPartiQL, private var ionReaderBuilder: IonReaderBuilder, diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueIonWriter.kt b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueIonWriter.kt similarity index 90% rename from partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueIonWriter.kt rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueIonWriter.kt index b30900c4c..1a4fe4db7 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueIonWriter.kt +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueIonWriter.kt @@ -1,15 +1,13 @@ -package org.partiql.value.io +package org.partiql.spi.value.io import com.amazon.ion.IonWriter import com.amazon.ion.system.IonBinaryWriterBuilder import com.amazon.ion.system.IonTextWriterBuilder import com.amazon.ion.system.IonWriterBuilder import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.toIon import java.io.OutputStream -@OptIn(PartiQLValueExperimental::class) public class PartiQLValueIonWriter internal constructor( private val ionWriter: IonWriter, ) : PartiQLValueWriter { @@ -24,7 +22,6 @@ public class PartiQLValueIonWriter internal constructor( } } -@OptIn(PartiQLValueExperimental::class) public class PartiQLValueIonWriterBuilder private constructor( private var ionWriterBuilder: IonWriterBuilder, ) { diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueReader.kt b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueReader.kt similarity index 88% rename from partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueReader.kt rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueReader.kt index 50eae0757..18d41e0e7 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueReader.kt +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueReader.kt @@ -12,15 +12,13 @@ * language governing permissions and limitations under the License. */ -package org.partiql.value.io +package org.partiql.spi.value.io import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental /** * Basic PartiQLValueReader akin to java.io.Reader. */ -@PartiQLValueExperimental public interface PartiQLValueReader : AutoCloseable { /** diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueTextWriter.kt b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueTextWriter.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueTextWriter.kt rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueTextWriter.kt index 9ae8e49d0..3516e8d4d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueTextWriter.kt +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueTextWriter.kt @@ -12,7 +12,7 @@ * language governing permissions and limitations under the License. */ -package org.partiql.value.io +package org.partiql.spi.value.io import org.partiql.value.BagValue import org.partiql.value.BoolValue @@ -31,7 +31,6 @@ import org.partiql.value.ListValue import org.partiql.value.MissingValue import org.partiql.value.NullValue import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental import org.partiql.value.SexpValue import org.partiql.value.StringValue import org.partiql.value.StructValue @@ -55,7 +54,6 @@ import kotlin.math.abs * @property formatted Print with newlines and indents * @property indent Indent prefix, default is 2-spaces */ -@PartiQLValueExperimental public class PartiQLValueTextWriter( private val out: PrintStream, private val formatted: Boolean = true, @@ -350,7 +348,6 @@ public class PartiQLValueTextWriter( } } -@OptIn(PartiQLValueExperimental::class) public class PartiQLValueWriterBuilder private constructor() { private var formatted: Boolean = true diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueWriter.kt b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueWriter.kt similarity index 89% rename from partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueWriter.kt rename to partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueWriter.kt index 9d14e4d1f..7416f41d5 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/io/PartiQLValueWriter.kt +++ b/partiql-spi/src/testFixtures/java/org/partiql/spi/value/io/PartiQLValueWriter.kt @@ -12,15 +12,13 @@ * language governing permissions and limitations under the License. */ -package org.partiql.value.io +package org.partiql.spi.value.io import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental /** * Basic PartiQLValue Writer akin to java.io.Writer. */ -@PartiQLValueExperimental public interface PartiQLValueWriter : AutoCloseable { /** diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/PartiQL.kt b/partiql-spi/src/testFixtures/kotlin/org/partiql/value/PartiQL.kt similarity index 93% rename from partiql-spi/src/main/kotlin/org/partiql/value/PartiQL.kt rename to partiql-spi/src/testFixtures/kotlin/org/partiql/value/PartiQL.kt index 2f951db0f..aac067829 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/PartiQL.kt +++ b/partiql-spi/src/testFixtures/kotlin/org/partiql/value/PartiQL.kt @@ -61,7 +61,6 @@ import java.util.BitSet * @return */ @JvmOverloads -@PartiQLValueExperimental public fun boolValue( value: Boolean?, annotations: Annotations = emptyList(), @@ -75,7 +74,6 @@ public fun boolValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun int8Value( value: Byte?, annotations: Annotations = emptyList(), @@ -89,7 +87,6 @@ public fun int8Value( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun int16Value( value: Short?, annotations: Annotations = emptyList(), @@ -103,7 +100,6 @@ public fun int16Value( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun int32Value( value: Int?, annotations: Annotations = emptyList(), @@ -117,7 +113,6 @@ public fun int32Value( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun int64Value( value: Long?, annotations: Annotations = emptyList(), @@ -131,7 +126,6 @@ public fun int64Value( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun intValue( value: BigInteger?, annotations: Annotations = emptyList(), @@ -145,7 +139,6 @@ public fun intValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun decimalValue( value: BigDecimal?, annotations: Annotations = emptyList(), @@ -159,7 +152,6 @@ public fun decimalValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun float32Value( value: Float?, annotations: Annotations = emptyList(), @@ -173,7 +165,6 @@ public fun float32Value( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun float64Value( value: Double?, annotations: Annotations = emptyList(), @@ -187,7 +178,6 @@ public fun float64Value( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun charValue( value: Char?, annotations: Annotations = emptyList(), @@ -201,7 +191,6 @@ public fun charValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun stringValue( value: String?, annotations: Annotations = emptyList(), @@ -215,7 +204,6 @@ public fun stringValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun symbolValue( value: String?, annotations: Annotations = emptyList(), @@ -229,7 +217,6 @@ public fun symbolValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun clobValue( value: ByteArray?, annotations: Annotations = emptyList(), @@ -243,7 +230,6 @@ public fun clobValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun binaryValue( value: BitSet?, annotations: Annotations = emptyList(), @@ -257,7 +243,6 @@ public fun binaryValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun byteValue( value: Byte?, annotations: Annotations = emptyList(), @@ -271,7 +256,6 @@ public fun byteValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun blobValue( value: ByteArray?, annotations: Annotations = emptyList(), @@ -285,7 +269,6 @@ public fun blobValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun dateValue( value: Date?, annotations: Annotations = emptyList(), @@ -299,7 +282,6 @@ public fun dateValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun timeValue( value: Time?, annotations: Annotations = emptyList(), @@ -313,7 +295,6 @@ public fun timeValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun timestampValue( value: Timestamp?, annotations: Annotations = emptyList(), @@ -327,7 +308,6 @@ public fun timestampValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun intervalValue( value: Long?, annotations: Annotations = emptyList(), @@ -342,7 +322,6 @@ public fun intervalValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun bagValue( elements: Iterable?, annotations: Annotations = emptyList(), @@ -357,7 +336,6 @@ public fun bagValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun bagValue( vararg elements: T, annotations: Annotations = emptyList(), @@ -372,7 +350,6 @@ public fun bagValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun listValue( elements: Iterable?, annotations: Annotations = emptyList(), @@ -387,7 +364,6 @@ public fun listValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun listValue( vararg elements: T, annotations: Annotations = emptyList(), @@ -402,7 +378,6 @@ public fun listValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun sexpValue( elements: Iterable?, annotations: Annotations = emptyList(), @@ -417,7 +392,6 @@ public fun sexpValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun sexpValue( vararg elements: T, annotations: Annotations = emptyList(), @@ -432,7 +406,6 @@ public fun sexpValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun structValue( fields: Iterable>?, annotations: Annotations = emptyList(), @@ -447,7 +420,6 @@ public fun structValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun structValue( vararg fields: Pair, annotations: Annotations = emptyList(), @@ -463,7 +435,6 @@ public fun structValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun structValueMultiMap( fields: Map>?, annotations: Annotations = emptyList(), @@ -479,7 +450,6 @@ public fun structValueMultiMap( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun structValueMap( fields: Map?, annotations: Annotations = emptyList(), @@ -492,7 +462,6 @@ public fun structValueMap( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun nullValue( annotations: Annotations = emptyList(), ): NullValue = NullValueImpl(annotations.toPersistentList()) @@ -504,7 +473,6 @@ public fun nullValue( * @return */ @JvmOverloads -@PartiQLValueExperimental public fun missingValue( annotations: Annotations = emptyList(), ): MissingValue = MissingValueImpl(annotations.toPersistentList()) diff --git a/partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValue.kt b/partiql-spi/src/testFixtures/kotlin/org/partiql/value/PartiQLValue.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValue.kt rename to partiql-spi/src/testFixtures/kotlin/org/partiql/value/PartiQLValue.kt index 6be7e8fbe..dccb3e9dd 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/value/PartiQLValue.kt +++ b/partiql-spi/src/testFixtures/kotlin/org/partiql/value/PartiQLValue.kt @@ -25,14 +25,13 @@ import java.math.BigDecimal import java.math.BigInteger import java.util.BitSet -internal typealias Annotations = List +public typealias Annotations = List /** * TODO * - Implement ANY * - Implement comparators */ -@PartiQLValueExperimental public sealed interface PartiQLValue { public val type: PartiQLValueType @@ -90,7 +89,6 @@ public sealed interface PartiQLValue { } } -@PartiQLValueExperimental public sealed interface ScalarValue : PartiQLValue { public val value: T? @@ -105,7 +103,6 @@ public sealed interface ScalarValue : PartiQLValue { override fun withoutAnnotations(): ScalarValue } -@PartiQLValueExperimental public sealed interface CollectionValue : PartiQLValue, Iterable { override val isNull: Boolean @@ -119,7 +116,6 @@ public sealed interface CollectionValue : PartiQLValue, Iterab override fun withoutAnnotations(): CollectionValue } -@PartiQLValueExperimental public abstract class BoolValue : ScalarValue { override val type: PartiQLValueType = PartiQLValueType.BOOL @@ -131,7 +127,6 @@ public abstract class BoolValue : ScalarValue { abstract override fun withoutAnnotations(): BoolValue } -@PartiQLValueExperimental public sealed class NumericValue : ScalarValue { public abstract fun toInt8(): Int8Value @@ -157,7 +152,6 @@ public sealed class NumericValue : ScalarValue { abstract override fun withoutAnnotations(): NumericValue } -@PartiQLValueExperimental public abstract class Int8Value : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.INT8 @@ -169,7 +163,6 @@ public abstract class Int8Value : NumericValue() { abstract override fun withoutAnnotations(): Int8Value } -@PartiQLValueExperimental public abstract class Int16Value : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.INT16 @@ -181,7 +174,6 @@ public abstract class Int16Value : NumericValue() { abstract override fun withoutAnnotations(): Int16Value } -@PartiQLValueExperimental public abstract class Int32Value : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.INT32 @@ -193,7 +185,6 @@ public abstract class Int32Value : NumericValue() { abstract override fun withoutAnnotations(): Int32Value } -@PartiQLValueExperimental public abstract class Int64Value : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.INT64 @@ -205,7 +196,6 @@ public abstract class Int64Value : NumericValue() { abstract override fun withoutAnnotations(): Int64Value } -@PartiQLValueExperimental public abstract class IntValue : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.INT @@ -217,7 +207,6 @@ public abstract class IntValue : NumericValue() { abstract override fun withoutAnnotations(): IntValue } -@PartiQLValueExperimental public abstract class DecimalValue : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.DECIMAL @@ -229,7 +218,6 @@ public abstract class DecimalValue : NumericValue() { abstract override fun withoutAnnotations(): DecimalValue } -@PartiQLValueExperimental public abstract class Float32Value : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.FLOAT32 @@ -241,7 +229,6 @@ public abstract class Float32Value : NumericValue() { abstract override fun withoutAnnotations(): Float32Value } -@PartiQLValueExperimental public abstract class Float64Value : NumericValue() { override val type: PartiQLValueType = PartiQLValueType.FLOAT64 @@ -253,7 +240,6 @@ public abstract class Float64Value : NumericValue() { abstract override fun withoutAnnotations(): Float64Value } -@PartiQLValueExperimental public sealed class TextValue : ScalarValue { public abstract val string: String? @@ -265,7 +251,6 @@ public sealed class TextValue : ScalarValue { abstract override fun withoutAnnotations(): TextValue } -@PartiQLValueExperimental public abstract class CharValue : TextValue() { override val type: PartiQLValueType = PartiQLValueType.CHAR @@ -280,7 +265,6 @@ public abstract class CharValue : TextValue() { abstract override fun withoutAnnotations(): CharValue } -@PartiQLValueExperimental public abstract class StringValue : TextValue() { override val type: PartiQLValueType = PartiQLValueType.STRING @@ -295,7 +279,6 @@ public abstract class StringValue : TextValue() { abstract override fun withoutAnnotations(): StringValue } -@PartiQLValueExperimental public abstract class SymbolValue : TextValue() { override val type: PartiQLValueType = PartiQLValueType.SYMBOL @@ -310,7 +293,6 @@ public abstract class SymbolValue : TextValue() { abstract override fun withoutAnnotations(): SymbolValue } -@PartiQLValueExperimental public abstract class ClobValue : ScalarValue { override val type: PartiQLValueType = PartiQLValueType.CLOB @@ -322,7 +304,6 @@ public abstract class ClobValue : ScalarValue { abstract override fun withoutAnnotations(): ClobValue } -@PartiQLValueExperimental public abstract class BinaryValue : ScalarValue { override val type: PartiQLValueType = PartiQLValueType.BINARY @@ -334,7 +315,6 @@ public abstract class BinaryValue : ScalarValue { abstract override fun withoutAnnotations(): BinaryValue } -@PartiQLValueExperimental public abstract class ByteValue : ScalarValue { override val type: PartiQLValueType = PartiQLValueType.BYTE @@ -346,7 +326,6 @@ public abstract class ByteValue : ScalarValue { abstract override fun withoutAnnotations(): ByteValue } -@PartiQLValueExperimental public abstract class BlobValue : ScalarValue { override val type: PartiQLValueType = PartiQLValueType.BLOB @@ -358,7 +337,6 @@ public abstract class BlobValue : ScalarValue { abstract override fun withoutAnnotations(): BlobValue } -@PartiQLValueExperimental public abstract class DateValue : ScalarValue { override val type: PartiQLValueType = PartiQLValueType.DATE @@ -370,7 +348,6 @@ public abstract class DateValue : ScalarValue { abstract override fun withoutAnnotations(): DateValue } -@PartiQLValueExperimental public abstract class TimeValue : ScalarValue