From 896e295349ba798f6ebc5647f6aadfc6d09e44ec Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Tue, 3 Dec 2024 15:08:43 -0800 Subject: [PATCH 01/13] Adds a built-in PartiQL System catalog --- partiql-cli/build.gradle.kts | 1 + .../src/main/kotlin/org/partiql/cli/Main.kt | 4 +- partiql-eval/build.gradle.kts | 1 + .../org/partiql/eval/compiler/StrategyTest.kt | 4 +- .../partiql/eval/internal/SuccessTestCase.kt | 4 +- .../partiql/eval/internal/TypingTestCase.kt | 4 +- partiql-planner/build.gradle.kts | 1 + .../org/partiql/planner/internal/Env.kt | 63 +++++- .../kotlin/org/partiql/planner/PlanTest.kt | 4 +- .../planner/PlannerPErrorReportingTests.kt | 4 +- .../internal/exclude/SubsumptionTest.kt | 4 +- .../internal/typer/PartiQLTyperTestBase.kt | 3 +- .../planner/internal/typer/PlanTyperTest.kt | 4 +- .../internal/typer/PlanTyperTestsPorted.kt | 7 +- .../planner/internal/typer/ScopeTest.kt | 4 +- partiql-spi/api/partiql-spi.api | 1 + .../kotlin/org/partiql/spi/catalog/Catalog.kt | 17 +- .../org/partiql/spi/catalog/Namespace.kt | 1 + partiql-system/api/partiql-system.api | 28 +++ partiql-system/build.gradle.kts | 43 ++++ .../org/partiql/system/PartiQLSession.java | 101 +++++++++ .../partiql/system/PartiQLSessionBuilder.java | 139 ++++++++++++ .../partiql/system/PartiQLSystemCatalog.java | 67 ++++++ .../spi/function/utils/PatternUtils.kt | 0 .../partiql/spi/function/utils/StringUtils.kt | 0 .../org/partiql/spi/internal/SqlTypeFamily.kt | 75 +++++++ .../kotlin/org/partiql/system}/Builtins.kt | 10 +- .../org/partiql/system}/builtins/AggAny.kt | 4 +- .../org/partiql/system}/builtins/AggAvg.kt | 4 +- .../org/partiql/system}/builtins/AggCount.kt | 4 +- .../org/partiql/system}/builtins/AggEvery.kt | 4 +- .../partiql/system}/builtins/AggGroupAs.kt | 4 +- .../org/partiql/system}/builtins/AggMax.kt | 4 +- .../org/partiql/system}/builtins/AggMin.kt | 4 +- .../org/partiql/system}/builtins/AggSome.kt | 4 +- .../org/partiql/system}/builtins/AggSum.kt | 4 +- .../system}/builtins/DefaultNumeric.kt | 2 +- .../builtins/DiadicArithmeticOperator.kt | 2 +- .../builtins/DiadicComparisonOperator.kt | 2 +- .../system}/builtins/DiadicOperator.kt | 4 +- .../org/partiql/system}/builtins/FnAbs.kt | 2 +- .../org/partiql/system}/builtins/FnAnd.kt | 2 +- .../org/partiql/system}/builtins/FnBetween.kt | 2 +- .../partiql/system}/builtins/FnBitLength.kt | 2 +- .../partiql/system}/builtins/FnBitwiseAnd.kt | 2 +- .../partiql/system}/builtins/FnCardinality.kt | 2 +- .../partiql/system}/builtins/FnCharLength.kt | 2 +- .../org/partiql/system}/builtins/FnCollAgg.kt | 20 +- .../org/partiql/system}/builtins/FnConcat.kt | 2 +- .../partiql/system}/builtins/FnCurrentDate.kt | 2 +- .../partiql/system}/builtins/FnCurrentUser.kt | 2 +- .../partiql/system}/builtins/FnDateAddDay.kt | 2 +- .../partiql/system}/builtins/FnDateAddHour.kt | 2 +- .../system}/builtins/FnDateAddMinute.kt | 2 +- .../system}/builtins/FnDateAddMonth.kt | 2 +- .../system}/builtins/FnDateAddSecond.kt | 2 +- .../partiql/system}/builtins/FnDateAddYear.kt | 2 +- .../partiql/system}/builtins/FnDateDiffDay.kt | 2 +- .../system}/builtins/FnDateDiffHour.kt | 2 +- .../system}/builtins/FnDateDiffMinute.kt | 2 +- .../system}/builtins/FnDateDiffMonth.kt | 2 +- .../system}/builtins/FnDateDiffSecond.kt | 2 +- .../system}/builtins/FnDateDiffYear.kt | 2 +- .../org/partiql/system}/builtins/FnDivide.kt | 2 +- .../org/partiql/system}/builtins/FnEq.kt | 2 +- .../org/partiql/system}/builtins/FnExists.kt | 2 +- .../org/partiql/system}/builtins/FnExtract.kt | 2 +- .../org/partiql/system}/builtins/FnGt.kt | 4 +- .../org/partiql/system}/builtins/FnGte.kt | 4 +- .../system}/builtins/FnInCollection.kt | 2 +- .../org/partiql/system}/builtins/FnIsAny.kt | 2 +- .../org/partiql/system}/builtins/FnIsBag.kt | 2 +- .../partiql/system}/builtins/FnIsBinary.kt | 2 +- .../org/partiql/system}/builtins/FnIsBlob.kt | 2 +- .../org/partiql/system}/builtins/FnIsBool.kt | 2 +- .../org/partiql/system}/builtins/FnIsByte.kt | 2 +- .../org/partiql/system}/builtins/FnIsChar.kt | 2 +- .../org/partiql/system}/builtins/FnIsClob.kt | 2 +- .../org/partiql/system}/builtins/FnIsDate.kt | 2 +- .../partiql/system}/builtins/FnIsDecimal.kt | 2 +- .../partiql/system}/builtins/FnIsFloat32.kt | 2 +- .../partiql/system}/builtins/FnIsFloat64.kt | 2 +- .../org/partiql/system}/builtins/FnIsInt.kt | 2 +- .../org/partiql/system}/builtins/FnIsInt16.kt | 2 +- .../org/partiql/system}/builtins/FnIsInt32.kt | 2 +- .../org/partiql/system}/builtins/FnIsInt64.kt | 2 +- .../org/partiql/system}/builtins/FnIsInt8.kt | 2 +- .../partiql/system}/builtins/FnIsInterval.kt | 2 +- .../org/partiql/system}/builtins/FnIsList.kt | 2 +- .../partiql/system}/builtins/FnIsMissing.kt | 2 +- .../org/partiql/system}/builtins/FnIsNull.kt | 2 +- .../partiql/system}/builtins/FnIsString.kt | 2 +- .../partiql/system}/builtins/FnIsStruct.kt | 2 +- .../org/partiql/system}/builtins/FnIsTime.kt | 2 +- .../partiql/system}/builtins/FnIsTimestamp.kt | 2 +- .../org/partiql/system}/builtins/FnLike.kt | 2 +- .../partiql/system}/builtins/FnLikeEscape.kt | 2 +- .../org/partiql/system}/builtins/FnLower.kt | 2 +- .../org/partiql/system}/builtins/FnLt.kt | 4 +- .../org/partiql/system}/builtins/FnLte.kt | 4 +- .../org/partiql/system}/builtins/FnMinus.kt | 2 +- .../org/partiql/system}/builtins/FnModulo.kt | 2 +- .../org/partiql/system}/builtins/FnNeg.kt | 2 +- .../org/partiql/system}/builtins/FnNot.kt | 2 +- .../partiql/system}/builtins/FnOctetLength.kt | 2 +- .../org/partiql/system}/builtins/FnOr.kt | 2 +- .../org/partiql/system}/builtins/FnPlus.kt | 2 +- .../org/partiql/system}/builtins/FnPos.kt | 2 +- .../partiql/system}/builtins/FnPosition.kt | 2 +- .../org/partiql/system}/builtins/FnSize.kt | 2 +- .../partiql/system}/builtins/FnSubstring.kt | 2 +- .../org/partiql/system}/builtins/FnTimes.kt | 2 +- .../org/partiql/system}/builtins/FnTrim.kt | 2 +- .../partiql/system}/builtins/FnTrimChars.kt | 2 +- .../partiql/system}/builtins/FnTrimLeading.kt | 2 +- .../system}/builtins/FnTrimLeadingChars.kt | 2 +- .../system}/builtins/FnTrimTrailing.kt | 2 +- .../system}/builtins/FnTrimTrailingChars.kt | 2 +- .../org/partiql/system}/builtins/FnUpper.kt | 2 +- .../org/partiql/system}/builtins/FnUtcnow.kt | 2 +- .../system}/builtins/TypePrecedence.kt | 2 +- .../system}/builtins/internal/Accumulator.kt | 4 +- .../builtins/internal/AccumulatorAnySome.kt | 2 +- .../builtins/internal/AccumulatorAvg.kt | 2 +- .../builtins/internal/AccumulatorCount.kt | 2 +- .../builtins/internal/AccumulatorCountStar.kt | 2 +- .../builtins/internal/AccumulatorDistinct.kt | 2 +- .../builtins/internal/AccumulatorEvery.kt | 2 +- .../builtins/internal/AccumulatorGroupAs.kt | 2 +- .../builtins/internal/AccumulatorMax.kt | 2 +- .../builtins/internal/AccumulatorMin.kt | 2 +- .../builtins/internal/AccumulatorSum.kt | 2 +- .../system/internal/NumberExtensions.kt | 202 ++++++++++++++++++ settings.gradle.kts | 4 + test/partiql-randomized-tests/build.gradle | 1 + .../org/partiql/lang/randomized/eval/Utils.kt | 4 +- test/partiql-tests-runner/build.gradle.kts | 1 + .../partiql/runner/executor/EvalExecutor.kt | 5 +- 138 files changed, 900 insertions(+), 169 deletions(-) create mode 100644 partiql-system/api/partiql-system.api create mode 100644 partiql-system/build.gradle.kts create mode 100644 partiql-system/src/main/java/org/partiql/system/PartiQLSession.java create mode 100644 partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java create mode 100644 partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java rename {partiql-spi => partiql-system}/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt (100%) rename {partiql-spi => partiql-system}/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt (100%) create mode 100644 partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/Builtins.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggAny.kt (83%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggAvg.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggCount.kt (77%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggEvery.kt (85%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggGroupAs.kt (78%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggMax.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggMin.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggSome.kt (84%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/AggSum.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/DefaultNumeric.kt (83%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/DiadicArithmeticOperator.kt (88%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/DiadicComparisonOperator.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/DiadicOperator.kt (99%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnAbs.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnAnd.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnBetween.kt (99%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnBitLength.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnBitwiseAnd.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnCardinality.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnCharLength.kt (94%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnCollAgg.kt (81%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnConcat.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnCurrentDate.kt (88%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnCurrentUser.kt (88%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateAddDay.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateAddHour.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateAddMinute.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateAddMonth.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateAddSecond.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateAddYear.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateDiffDay.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateDiffHour.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateDiffMinute.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateDiffMonth.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateDiffSecond.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDateDiffYear.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnDivide.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnEq.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnExists.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnExtract.kt (99%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnGt.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnGte.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnInCollection.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsAny.kt (90%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsBag.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsBinary.kt (90%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsBlob.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsBool.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsByte.kt (90%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsChar.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsClob.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsDate.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsDecimal.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsFloat32.kt (94%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsFloat64.kt (92%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsInt.kt (93%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsInt16.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsInt32.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsInt64.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsInt8.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsInterval.kt (90%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsList.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsMissing.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsNull.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsString.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsStruct.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsTime.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnIsTimestamp.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnLike.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnLikeEscape.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnLower.kt (94%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnLt.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnLte.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnMinus.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnModulo.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnNeg.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnNot.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnOctetLength.kt (94%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnOr.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnPlus.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnPos.kt (97%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnPosition.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnSize.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnSubstring.kt (99%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTimes.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTrim.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTrimChars.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTrimLeading.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTrimLeadingChars.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTrimTrailing.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnTrimTrailingChars.kt (96%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnUpper.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/FnUtcnow.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/TypePrecedence.kt (95%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/Accumulator.kt (98%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorAnySome.kt (89%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorAvg.kt (91%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorCount.kt (82%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorCountStar.kt (85%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorDistinct.kt (89%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorEvery.kt (88%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorGroupAs.kt (83%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorMax.kt (86%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorMin.kt (86%) rename {partiql-spi/src/main/kotlin/org/partiql/spi/function => partiql-system/src/main/kotlin/org/partiql/system}/builtins/internal/AccumulatorSum.kt (91%) create mode 100644 partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt diff --git a/partiql-cli/build.gradle.kts b/partiql-cli/build.gradle.kts index ed163fa5af..e1584e5e4e 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(project(":partiql-system")) implementation(Deps.csv) implementation(Deps.awsSdkBom) implementation(Deps.awsSdkDynamodb) diff --git a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt index 878409a776..403cdd3bb5 100644 --- a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt +++ b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt @@ -20,10 +20,10 @@ import org.partiql.cli.pipeline.Pipeline import org.partiql.cli.shell.Shell import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Name -import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader +import org.partiql.system.PartiQLSessionBuilder import org.partiql.value.PartiQLValueExperimental import org.partiql.value.io.PartiQLValueTextWriter import picocli.CommandLine @@ -210,7 +210,7 @@ internal class MainCommand : Runnable { println() } - private fun session() = Session.builder() + private fun session() = PartiQLSessionBuilder() .identity(System.getProperty("user.name")) .namespace(emptyList()) .catalog("default") diff --git a/partiql-eval/build.gradle.kts b/partiql-eval/build.gradle.kts index 17f013af7a..d8642a8567 100644 --- a/partiql-eval/build.gradle.kts +++ b/partiql-eval/build.gradle.kts @@ -33,6 +33,7 @@ dependencies { annotationProcessor(Deps.lombok) // Test testImplementation(project(":partiql-parser")) + testImplementation(project(":partiql-system")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType testImplementation(Deps.junit4) testImplementation(Deps.junit4Params) diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt index 912b578878..e571378ede 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt @@ -9,7 +9,7 @@ import org.partiql.eval.Statement import org.partiql.parser.PartiQLParser import org.partiql.plan.rel.RelLimit import org.partiql.planner.PartiQLPlanner -import org.partiql.spi.catalog.Session +import org.partiql.system.PartiQLSession import kotlin.test.Test import kotlin.test.assertTrue @@ -20,7 +20,7 @@ public class StrategyTest { private val parser = PartiQLParser.standard() private val planner = PartiQLPlanner.standard() - private val session = Session.empty() + private val session = PartiQLSession.empty() private class MyLimit : ExprRelation { override fun open(env: Environment) = error("open") diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt index 32bd8d72b8..5042435a10 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt @@ -8,10 +8,10 @@ import org.partiql.plan.Plan import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Name -import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.StaticType import org.partiql.types.fromStaticType import org.partiql.value.PartiQLValue @@ -64,7 +64,7 @@ public class SuccessTestCase( } } .build() - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog("memory") .catalogs(catalog) .build() diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt index dda9743990..de7f5ba4d3 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt @@ -7,8 +7,8 @@ import org.partiql.parser.PartiQLParser import org.partiql.plan.Plan import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog -import org.partiql.spi.catalog.Session import org.partiql.spi.value.Datum +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental @@ -62,7 +62,7 @@ public class TypingTestCase @OptIn(PartiQLValueExperimental::class) constructor( assertEquals(1, parseResult.statements.size) val statement = parseResult.statements[0] val catalog = Catalog.builder().name("memory").build() - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog("memory") .catalogs(catalog) .build() diff --git a/partiql-planner/build.gradle.kts b/partiql-planner/build.gradle.kts index 88a0586b80..c54b040c18 100644 --- a/partiql-planner/build.gradle.kts +++ b/partiql-planner/build.gradle.kts @@ -37,6 +37,7 @@ dependencies { annotationProcessor(Deps.lombok) // Test testImplementation(project(":partiql-parser")) + testImplementation(project(":partiql-system")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType testImplementation(Deps.kotlinReflect) // Test Fixtures diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt index da8e6ed8fb..86c5ed70cc 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt @@ -102,8 +102,25 @@ internal class Env(private val session: Session) { error("Qualified functions are not supported.") } - // 1. Search in the current catalog and namespace. - val catalog = default + // Search in SQL Path + session.getPath().forEach { catalogName -> + // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. + if (catalogName.getLength() != 1) { + return@forEach + } + val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach + val candidates = getCandidates(catalog, identifier, args) + if (candidates.isNotEmpty()) { + return candidates + } + } + return emptyList() + } + + /** + * Given a [catalog], searches for candidate functions. + */ + private fun getCandidates(catalog: Catalog, identifier: Identifier, args: List): List { val name = identifier.getIdentifier().getText().lowercase() // CASE-NORMALIZED LOWER val variants = catalog.getFunctions(session, name).toList() val candidates = variants.filter { it.getParameters().size == args.size } @@ -118,14 +135,35 @@ internal class Env(private val session: Session) { * @return */ fun resolveFn(identifier: Identifier, args: List): Rex? { - // Reject qualified routine names. if (identifier.hasQualifier()) { error("Qualified functions are not supported.") } + // Search in SQL Path + session.getPath().forEach { catalogName -> + // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. + if (catalogName.getLength() != 1) { + return@forEach + } + val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach + val candidates = resolveFn(catalog, identifier, args) + if (candidates != null) { + return candidates + } + } + return null + } + + /** + * TODO leverage session PATH. + * + * @param identifier + * @param args + * @return + */ + private fun resolveFn(catalog: Catalog, identifier: Identifier, args: List): Rex? { // 1. Search in the current catalog and namespace. - val catalog = default val name = identifier.getIdentifier().getText().lowercase() // CASE-NORMALIZED LOWER val variants = catalog.getFunctions(session, name).toList() if (variants.isEmpty()) { @@ -170,10 +208,25 @@ internal class Env(private val session: Session) { } fun resolveAgg(path: String, setQuantifier: SetQuantifier, args: List): Rel.Op.Aggregate.Call.Resolved? { + // Search in SQL Path + session.getPath().forEach { catalogName -> + // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. + if (catalogName.getLength() != 1) { + return@forEach + } + val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach + val agg = resolveAgg(catalog, path, setQuantifier, args) + if (agg != null) { + return agg + } + } + return null + } + + private fun resolveAgg(catalog: Catalog, path: String, setQuantifier: SetQuantifier, args: List): Rel.Op.Aggregate.Call.Resolved? { // TODO: Eventually, do we want to support sensitive lookup? With a path? // 1. Search in the current catalog and namespace. - val catalog = default val name = path.lowercase() val candidates = catalog.getAggregations(session, name).toList() if (candidates.isEmpty()) { diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt index edf5f02d12..355c154b89 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt @@ -11,7 +11,7 @@ import org.partiql.planner.internal.TestCatalog import org.partiql.planner.test.PartiQLTest import org.partiql.planner.test.PartiQLTestProvider import org.partiql.spi.catalog.Name -import org.partiql.spi.catalog.Session +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.StaticType import org.partiql.types.StructType @@ -66,7 +66,7 @@ class PlanTest { ) private val pipeline: (PartiQLTest, Boolean) -> PartiQLPlanner.Result = { test, isSignalMode -> - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog("default") .catalogs( TestCatalog.builder() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt index b426325d6b..4740ce545c 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt @@ -12,8 +12,8 @@ import org.partiql.planner.util.PErrorCollector import org.partiql.planner.util.PlanPrinter import org.partiql.spi.Context import org.partiql.spi.catalog.Catalog -import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.Field import org.partiql.types.PType @@ -38,7 +38,7 @@ internal class PlannerPErrorReportingTests { .define(Table.empty("struct_with_missing", PType.row(listOf(Field.of("f1", PType.smallint()))))) .build() - private val session = Session.builder() + private val session = PartiQLSessionBuilder() .catalog(catalogName) .catalogs(catalog) .build() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt index 191ccf9216..6e4d044617 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt @@ -17,7 +17,7 @@ import org.partiql.plan.rex.RexSelect import org.partiql.plan.rex.RexVar import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog -import org.partiql.spi.catalog.Session +import org.partiql.system.PartiQLSessionBuilder import java.util.stream.Stream import kotlin.test.assertEquals @@ -41,7 +41,7 @@ class SubsumptionTest { val parseResult = parser.parse(text) assertEquals(1, parseResult.statements.size) val statement = parseResult.statements[0] - val session = Session.builder().catalog("default").catalogs(catalog).build() + val session = PartiQLSessionBuilder().catalog("default").catalogs(catalog).build() val plan = planner.plan(statement, session).plan val excludeClause = getExcludeClause(plan.getOperation()).getExclusions() assertEquals(tc.expectedExcludeExprs, excludeClause) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt index 42d534ebd7..decb325940 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt @@ -16,6 +16,7 @@ import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.types.StaticType import org.partiql.types.fromStaticType @@ -42,7 +43,7 @@ abstract class PartiQLTyperTestBase { public val planner = PartiQLPlanner.standard() internal val session: ((String, Catalog) -> Session) = { catalog, metadata -> - Session.builder() + PartiQLSessionBuilder() .catalog(catalog) .catalogs(metadata) .build() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt index 6d6d12f037..bc8ff98f56 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt @@ -21,8 +21,8 @@ import org.partiql.planner.util.PErrorCollector import org.partiql.spi.Context import org.partiql.spi.catalog.Identifier import org.partiql.spi.catalog.Name -import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValueExperimental import org.partiql.value.int32Value @@ -120,7 +120,7 @@ class PlanTyperTest { private fun getTyper(): PlanTyperWrapper { val config = Context.of(PErrorCollector()) val env = Env( - Session.builder() + PartiQLSessionBuilder() .catalog("pql") .namespace("main") .catalogs( diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt index 13d06bd03b..04b4f0c733 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt @@ -32,6 +32,7 @@ import org.partiql.spi.catalog.Name import org.partiql.spi.catalog.Session import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.DecimalType import org.partiql.types.Field @@ -3824,7 +3825,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: SuccessTestCase) { - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) @@ -3867,7 +3868,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: ErrorTestCase) { - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) @@ -3911,7 +3912,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: ThrowingExceptionTestCase) { - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt index 276bda5cf8..2d32bf9b5b 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt @@ -10,7 +10,7 @@ import org.partiql.planner.internal.ir.relBinding import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Identifier -import org.partiql.spi.catalog.Session +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import kotlin.test.assertEquals import kotlin.test.fail @@ -36,7 +36,7 @@ internal class ScopeTest { @JvmStatic val locals = TypeEnv( Env( - Session.builder() + PartiQLSessionBuilder() .catalog("currentCatalog") .catalogs(catalog) .build() diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 7b9571a09f..020f1dabfe 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -202,6 +202,7 @@ public final class org/partiql/spi/catalog/Namespace : java/lang/Iterable, kotli public synthetic fun ([Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun append ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace; public final fun asIdentifier ()Lorg/partiql/spi/catalog/Identifier; + public static final fun empty ()Lorg/partiql/spi/catalog/Namespace; public fun equals (Ljava/lang/Object;)Z public fun forEach (Ljava/util/function/Consumer;)V public final fun get (I)Ljava/lang/String; diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt index d7233390bb..7f358a223c 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt @@ -2,7 +2,6 @@ package org.partiql.spi.catalog import org.partiql.spi.catalog.impl.StandardCatalog import org.partiql.spi.function.Aggregation -import org.partiql.spi.function.Builtins import org.partiql.spi.function.Function /** @@ -22,7 +21,9 @@ public interface Catalog { /** * Get a table by name. */ - public fun getTable(session: Session, name: Name): Table? = null + public fun getTable(session: Session, name: Name): Table? { + return null + } /** * Get a table by identifier. @@ -41,17 +42,23 @@ public interface Catalog { * 2. Invoke getTable("a"."b"."c"."Example"."x") * 3. The implementation MUST match "a"."b"."c"."Example" to a.b.c.Example (note "x" does not match a table) */ - public fun getTable(session: Session, identifier: Identifier): Table? = null + public fun getTable(session: Session, identifier: Identifier): Table? { + return null + } /** * Returns a collection of scalar functions in this catalog with the given name, or an empty list if none. */ - public fun getFunctions(session: Session, name: String): Collection = Builtins.getFunctions(name) + public fun getFunctions(session: Session, name: String): Collection { + return emptyList() + } /** * Returns a collection of aggregation functions in this catalog with the given name, or an empty list if none. */ - public fun getAggregations(session: Session, name: String): Collection = Builtins.getAggregations(name) + public fun getAggregations(session: Session, name: String): Collection { + return emptyList() + } public companion object { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt index 170bf5b989..a597dba253 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt @@ -81,6 +81,7 @@ public class Namespace private constructor( private val EMPTY = Namespace(emptyArray()) + @JvmStatic public fun empty(): Namespace = EMPTY @JvmStatic diff --git a/partiql-system/api/partiql-system.api b/partiql-system/api/partiql-system.api new file mode 100644 index 0000000000..53162b7934 --- /dev/null +++ b/partiql-system/api/partiql-system.api @@ -0,0 +1,28 @@ +public final class org/partiql/system/PartiQLSession : org/partiql/spi/catalog/Session { + public static fun empty ()Lorg/partiql/spi/catalog/Session; + public fun getCatalog ()Ljava/lang/String; + public fun getCatalogs ()Lorg/partiql/spi/catalog/Catalogs; + public fun getIdentity ()Ljava/lang/String; + public fun getNamespace ()Lorg/partiql/spi/catalog/Namespace; + public fun getPath ()Lorg/partiql/spi/catalog/Path; + public fun getProperties ()Ljava/util/Map; +} + +public final class org/partiql/system/PartiQLSessionBuilder { + public fun ()V + public fun build ()Lorg/partiql/spi/catalog/Session; + public fun catalog (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun catalogs ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun identity (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun namespace (Ljava/util/Collection;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun namespace ([Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun noSystemCatalog ()Lorg/partiql/system/PartiQLSessionBuilder; + public fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; + public fun systemCatalogName (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; +} + +public final class org/partiql/system/internal/NumberExtensionsKt { + public static final fun coerceNumbers (Ljava/lang/Number;Ljava/lang/Number;)Lkotlin/Pair; +} + diff --git a/partiql-system/build.gradle.kts b/partiql-system/build.gradle.kts new file mode 100644 index 0000000000..86ff4b227b --- /dev/null +++ b/partiql-system/build.gradle.kts @@ -0,0 +1,43 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +plugins { + id(Plugins.conventions) + id(Plugins.publish) +} + +dependencies { + api(project(":partiql-spi")) + api(project(":partiql-types")) + compileOnly(Deps.lombok) + annotationProcessor(Deps.lombok) +} + +// TODO: Once we move to only public Java APIs, we can use Javadoc. +// Need to add this as we have both Java and Kotlin sources. Dokka already handles multi-language projects. If +// Javadoc is enabled, we end up overwriting index.html (causing compilation errors). +tasks.withType { + enabled = false +} + +tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +publish { + artifactId = "partiql-catalog" + name = "PartiQL Catalog" + description = "Contains all of the PartiQL System's functions and operators." +} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java new file mode 100644 index 0000000000..9ef1d96d98 --- /dev/null +++ b/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java @@ -0,0 +1,101 @@ +package org.partiql.system; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.spi.catalog.Catalogs; +import org.partiql.spi.catalog.Namespace; +import org.partiql.spi.catalog.Path; +import org.partiql.spi.catalog.Session; + +import java.util.HashMap; +import java.util.Map; + +/** + * This is a package-private implementation of {@link Session}. + * @see PartiQLSessionBuilder + */ +public final class PartiQLSession implements Session { + + @NotNull + private final Catalogs _catalogs; + + @NotNull + private final String identity; + + @Nullable + private final Namespace systemCatalogNamespace; + + @NotNull + private final String currentCatalog; + + @NotNull + private final Namespace namespace; + + @NotNull + private final Map properties; + + PartiQLSession(boolean usesSystemCatalog, @NotNull String systemCatalogName, @NotNull String identity, @NotNull String catalog, @NotNull Namespace namespace, @NotNull Catalogs.Builder catalogs, @NotNull Map properties) { + this.systemCatalogNamespace = usesSystemCatalog ? Namespace.of(systemCatalogName) : null; + this.identity = identity; + this.currentCatalog = catalog; + this.namespace = namespace; + this.properties = properties; + if (usesSystemCatalog) { + catalogs.add(new PartiQLSystemCatalog(systemCatalogName)); + } + this._catalogs = catalogs.build(); + } + + @NotNull + @Override + public Map getProperties() { + return properties; + } + + @NotNull + @Override + public Path getPath() { + return Path.of(getNamespace(), systemCatalogNamespace); + } + + @NotNull + @Override + public String getIdentity() { + return identity; + } + + @NotNull + @Override + public String getCatalog() { + return currentCatalog; + } + + @NotNull + @Override + public Catalogs getCatalogs() { + return _catalogs; + } + + @NotNull + @Override + public Namespace getNamespace() { + return namespace; + } + + /** + * + * @return a session only holding the system catalog. + */ + @NotNull + public static Session empty() { + return new PartiQLSession( + true, + "$pql_system", + "unknown", + "$pql_system", + Namespace.of(), + Catalogs.builder(), + new HashMap<>() + ); + } +} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java new file mode 100644 index 0000000000..515672fcda --- /dev/null +++ b/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java @@ -0,0 +1,139 @@ +package org.partiql.system; + +import org.jetbrains.annotations.NotNull; +import org.partiql.spi.catalog.Catalog; +import org.partiql.spi.catalog.Catalogs; +import org.partiql.spi.catalog.Namespace; +import org.partiql.spi.catalog.Session; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +/** + * This creates a {@link Session} while also installing the PartiQL System Catalog by default (unless + * {@link PartiQLSessionBuilder#noSystemCatalog()} is specified). The resulting {@link Session} will append the System + * Catalog to the end of the {@link Session#getPath()}. + * @see PartiQLSessionBuilder#noSystemCatalog() + * @see PartiQLSessionBuilder#systemCatalogName(String) + */ +public final class PartiQLSessionBuilder { + + private String identity = "unknown"; + private String catalog = null; + private final Catalogs.Builder catalogs = Catalogs.builder(); + private Namespace namespace = Namespace.empty(); + private final Map properties = new HashMap<>(); + private boolean usesSystemCatalog = true; + private String systemCatalogName = "$partiql_system"; + + /** + * TODO + * @param identity TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder identity(String identity) { + this.identity = identity; + return this; + } + + /** + * Removes the system catalog from the session. + * @return the builder + */ + @NotNull + public PartiQLSessionBuilder noSystemCatalog() { + this.usesSystemCatalog = false; + return this; + } + + /** + * Sets the name of the system catalog. + * @param name the desired name + * @return the builder + */ + @NotNull + public PartiQLSessionBuilder systemCatalogName(@NotNull String name) { + this.systemCatalogName = name; + return this; + } + + /** + * TODO + * @param catalog TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder catalog(String catalog) { + this.catalog = catalog; + return this; + } + + /** + * TODO + * @param namespace TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder namespace(Namespace namespace) { + this.namespace = namespace; + return this; + } + + /** + * TODO + * @param levels TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder namespace(String... levels) { + this.namespace = Namespace.of(levels); + return this; + } + + /** + * TODO + * @param levels TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder namespace(Collection levels) { + this.namespace = Namespace.of(levels); + return this; + } + + /** + * TODO + * @param name TODO + * @param value TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder property(String name, String value) { + this.properties.put(name, value); + return this; + } + + /** + * TODO + * @param catalogs TODO + * @return TODO + */ + @NotNull + public PartiQLSessionBuilder catalogs(Catalog... catalogs) { + for (Catalog catalog : catalogs) { + this.catalogs.add(catalog); + } + return this; + } + + /** + * TODO + * @return TODO + */ + @NotNull + public Session build() { + return new PartiQLSession(usesSystemCatalog, systemCatalogName, identity, catalog, namespace, catalogs, properties); + } +} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java new file mode 100644 index 0000000000..980a787371 --- /dev/null +++ b/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java @@ -0,0 +1,67 @@ +package org.partiql.system; + +import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.spi.catalog.Catalog; +import org.partiql.spi.catalog.Identifier; +import org.partiql.spi.catalog.Name; +import org.partiql.spi.catalog.Session; +import org.partiql.spi.catalog.Table; +import org.partiql.spi.function.Aggregation; +import org.partiql.spi.function.Function; + +import java.util.Collection; + +/** + * This is a package-private class that implements the PartiQL System Catalog. + * It provides the implementation for the PartiQL System Catalog, which is a built-in catalog + * that provides access to the PartiQL language and its built-in functions and aggregations. + * @see PartiQLSessionBuilder + */ +final class PartiQLSystemCatalog implements Catalog { + + /** + * TODO + */ + @NotNull + private final String name; + + /** + * Creates a new PartiQL System Catalog with the given name. + * @param name the name of the PartiQL System Catalog + */ + PartiQLSystemCatalog(@NotNull String name) { + this.name = name; + } + + @NotNull + @Override + public String getName() { + return this.name; + } + + @Nullable + @Override + public Table getTable(@NotNull Session session, @NotNull Name name) { + return null; + } + + @Nullable + @Override + public Table getTable(@NotNull Session session, @NotNull Identifier identifier) { + return null; + } + + @NotNull + @Override + public Collection getFunctions(@NotNull Session session, @NotNull String name) { + return Builtins.INSTANCE.getFunctions(name); + } + + @NotNull + @Override + public Collection getAggregations(@NotNull Session session, @NotNull String name) { + return Builtins.INSTANCE.getAggregations(name); + } +} diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt b/partiql-system/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt similarity index 100% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt rename to partiql-system/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt b/partiql-system/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt similarity index 100% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt rename to partiql-system/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt b/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt new file mode 100644 index 0000000000..cc2dabd867 --- /dev/null +++ b/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt @@ -0,0 +1,75 @@ +package org.partiql.spi.internal + +import org.partiql.types.PType + +/** + * A basic "set" representation for type categorization; perhaps we optimize later.. + * + * From Calcite, + * > SqlTypeFamily provides SQL type categorization. + * > Primary Families + * > CHARACTER, + * > BINARY, + * > NUMERIC, + * > DATE, + * > TIME, + * > TIMESTAMP, + * > BOOLEAN, + * > https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java + * + * + * From Postgres, + * > Data types are divided into several basic type categories, including boolean, numeric, string, bitstring, datetime, + * > timespan, geometric, network, and user-defined. Within each category there can be one or more preferred types, + * > which are preferred when there is a choice of possible types. + */ +internal class SqlTypeFamily private constructor( + @JvmField val preferred: PType, + @JvmField val members: Set, +) { + + /** + * Constructor a singleton [SqlTypeFamily]. + */ + constructor(preferred: PType) : this(preferred, setOf(preferred.code())) + + operator fun contains(type: PType) = type.code() in members + + companion object { + + @JvmStatic + val TEXT = SqlTypeFamily( + preferred = PType.string(), + members = setOf( + PType.CHAR, + PType.VARCHAR, + PType.STRING, + PType.CLOB, + ) + ) + + @JvmStatic + val COLLECTION = SqlTypeFamily( + preferred = PType.bag(), + members = setOf( + PType.ARRAY, + PType.BAG + ) + ) + + @JvmStatic + val NUMBER = SqlTypeFamily( + preferred = PType.decimal(38, 19), + members = setOf( + PType.TINYINT, + PType.SMALLINT, + PType.INTEGER, + PType.BIGINT, + PType.NUMERIC, + PType.REAL, + PType.DOUBLE, + PType.DECIMAL, + ) + ) + } +} diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt b/partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt rename to partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt index cdd7f2f477..5dec5232f7 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt @@ -1,7 +1,9 @@ -package org.partiql.spi.function +package org.partiql.system /* ktlint-disable no-wildcard-imports */ -import org.partiql.spi.function.builtins.* +import org.partiql.spi.function.Aggregation +import org.partiql.spi.function.Function +import org.partiql.system.builtins.* /** * This is where we will register all SQL builtins; consider raising a "library" interface. @@ -182,8 +184,8 @@ internal object Builtins { Fn_LIKE_ESCAPE__STRING_STRING_STRING__BOOL, Fn_LIKE_ESCAPE__CLOB_CLOB_CLOB__BOOL, - Fn_LOWER__STRING__STRING, - Fn_LOWER__CLOB__CLOB, + org.partiql.system.builtins.Fn_LOWER__STRING__STRING, + org.partiql.system.builtins.Fn_LOWER__CLOB__CLOB, FnLt, FnLte, diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt similarity index 83% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt index cadee2aaa3..105bb3f590 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorAnySome +import org.partiql.system.builtins.internal.AccumulatorAnySome import org.partiql.types.PType internal val Agg_ANY__BOOL__BOOL = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt index d78de2bd49..96c4e4331c 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorAvg +import org.partiql.system.builtins.internal.AccumulatorAvg import org.partiql.types.PType // TODO: This needs to be formalized. See https://github.com/partiql/partiql-lang-kotlin/issues/1659 diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt similarity index 77% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt index 50abf38616..04967cc120 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorCount +import org.partiql.system.builtins.internal.AccumulatorCount import org.partiql.types.PType internal val Agg_COUNT__ANY__INT64 = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt similarity index 85% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt index 6973374d05..f009d8d6a9 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorEvery +import org.partiql.system.builtins.internal.AccumulatorEvery import org.partiql.types.PType internal val Agg_EVERY__BOOL__BOOL = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt similarity index 78% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt index 90630e8cff..11cff8fc96 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorGroupAs +import org.partiql.system.builtins.internal.AccumulatorGroupAs import org.partiql.types.PType internal val Agg_GROUP_AS__ANY__ANY = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt index de8831d7b2..9d4ac8ad52 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorMax +import org.partiql.system.builtins.internal.AccumulatorMax import org.partiql.types.PType internal val Agg_MAX__INT8__INT8 = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt index 140f569fe6..8ceddf8b12 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorMin +import org.partiql.system.builtins.internal.AccumulatorMin import org.partiql.types.PType internal val Agg_MIN__INT8__INT8 = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt similarity index 84% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt index 6b28cfaee1..32dad874de 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorAnySome +import org.partiql.system.builtins.internal.AccumulatorAnySome import org.partiql.types.PType internal val Agg_SOME__BOOL__BOOL = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt index b661e6dc75..af22fe007a 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.AccumulatorSum +import org.partiql.system.builtins.internal.AccumulatorSum import org.partiql.types.PType internal val Agg_SUM__INT8__INT8 = Aggregation.static( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt similarity index 83% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt index cb9d44a308..5bdd8c2917 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt similarity index 88% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt index ff5ac52a66..920fb05182 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt index 948d5af299..880c4cfcdf 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt similarity index 99% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt index bd233083ca..8243404217 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt @@ -1,10 +1,10 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.TypePrecedence.TYPE_PRECEDENCE import org.partiql.spi.internal.SqlTypeFamily import org.partiql.spi.value.Datum +import org.partiql.system.builtins.TypePrecedence.TYPE_PRECEDENCE import org.partiql.types.PType /** diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt index d975387861..caefef2f25 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt index 07399b386a..c5e16aacba 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt similarity index 99% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt index 3df72bc163..161b21ec76 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt index ba477cdbfb..8973149474 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt index f2e1db52b4..379ae624ad 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt index 8a37a7ea12..a4a620dcf1 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt similarity index 94% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt index ebb7b550c7..b92b0475e3 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt similarity index 81% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt index 09a09f782e..d571c6b943 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt @@ -1,20 +1,20 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter -import org.partiql.spi.function.builtins.internal.Accumulator -import org.partiql.spi.function.builtins.internal.AccumulatorAnySome -import org.partiql.spi.function.builtins.internal.AccumulatorAvg -import org.partiql.spi.function.builtins.internal.AccumulatorCount -import org.partiql.spi.function.builtins.internal.AccumulatorDistinct -import org.partiql.spi.function.builtins.internal.AccumulatorEvery -import org.partiql.spi.function.builtins.internal.AccumulatorMax -import org.partiql.spi.function.builtins.internal.AccumulatorMin -import org.partiql.spi.function.builtins.internal.AccumulatorSum import org.partiql.spi.value.Datum +import org.partiql.system.builtins.internal.Accumulator +import org.partiql.system.builtins.internal.AccumulatorAnySome +import org.partiql.system.builtins.internal.AccumulatorAvg +import org.partiql.system.builtins.internal.AccumulatorCount +import org.partiql.system.builtins.internal.AccumulatorDistinct +import org.partiql.system.builtins.internal.AccumulatorEvery +import org.partiql.system.builtins.internal.AccumulatorMax +import org.partiql.system.builtins.internal.AccumulatorMin +import org.partiql.system.builtins.internal.AccumulatorSum import org.partiql.types.PType internal abstract class Fn_COLL_AGG__BAG__ANY( diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt index d8e90d651f..33e3226d93 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt similarity index 88% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt index 3fe9cc2ae4..4551bb3c6d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt similarity index 88% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt index 4b234ecec4..20c9554a75 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt index 98f9e4f5a9..8a67a8e168 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt index be21e3c081..96ca622291 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt index 9811538a93..2aec5b5573 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt index 5a61e31c59..3a30bb3096 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt index 53c3415e58..fc19f32c8b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt index 4beae8cbb3..64256e509f 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt index 9b3ce54b01..d48c5d6c9b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt index f8bd4bada6..759063645a 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt index 3ec4231903..b938f39ed9 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt index 634bb52e42..33b9c79e10 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt index e2cedd215f..3775778428 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt index 483f59e7d1..d37cf0ab3d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt index cc1f6f1a2d..4577294f3d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt index 22d8582bb5..b5372e0fe6 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt index 09c2b06f89..455489b155 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt similarity index 99% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt index dfe6db4cbc..22cb3d0fc2 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt index c0077be009..6770295383 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum +import org.partiql.system.internal.compareTo import org.partiql.types.PType -import org.partiql.value.util.compareTo internal object FnGt : DiadicComparisonOperator("gt") { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt index 9a581b5c2b..dd3d0c775c 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum +import org.partiql.system.internal.compareTo import org.partiql.types.PType -import org.partiql.value.util.compareTo internal object FnGte : DiadicComparisonOperator("gte") { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt index c54fe8f127..0c926afc29 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName", "DEPRECATION") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt similarity index 90% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt index c9ebf47aa4..b2b100e8ef 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt index e35758ea2a..4628f8e0dd 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt similarity index 90% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt index c92e3a3a6e..e4cf405c8d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt index abefbf0bba..3134c4a5f7 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt index 2ca7040c46..cc20b069f4 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt similarity index 90% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt index 45a710121e..fed6c6e662 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt index ae1da6b8f5..4f7f21b9e3 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt index d88d0849e5..7672c439b5 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt index adf281acd6..8cd774a507 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt index 3cc07bb7e1..b3590fb99e 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt similarity index 94% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt index 0f873d9f8c..e83b10cf6c 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt similarity index 92% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt index 424c0a86d5..63721bdea9 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt similarity index 93% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt index 09bdf95c6e..194783deef 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt index 8bf34170e1..0b56211312 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt index 3c16b7383e..fc07901248 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt index 1a55a51556..b49b0ca64b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt index 46379417b6..bb5b9c6805 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt similarity index 90% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt index 2141027c1b..04a3e565e8 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt index 0bf3d3819a..3201bdfa01 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt index 7acb5188cb..2b4d903e3b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt index d3d258db86..678c0a8e41 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt index 2d6c981334..5ca9d51af8 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt index e83155c0cf..73a6fcdfca 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt index ae3f6b36c9..1776e1ef7d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt index 63f7982810..46fe11abd0 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt index 7d2801dd05..3b56081dfc 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt index 88093f28a4..6efcdd42ea 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt similarity index 94% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt index ebca15aeef..e06a919cd3 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt index 8e526a2beb..a9065accea 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum +import org.partiql.system.internal.compareTo import org.partiql.types.PType -import org.partiql.value.util.compareTo internal object FnLt : DiadicComparisonOperator("lt") { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt index 35d6cba0e1..6ce9316bb6 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum +import org.partiql.system.internal.compareTo import org.partiql.types.PType -import org.partiql.value.util.compareTo internal object FnLte : DiadicComparisonOperator("lte") { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt index df7de273c8..fef010eafa 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt index a785a020ec..a40fcf8eb3 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt index 0ebc9380c8..9f7c0f40a9 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt index c605f78000..4f6b1437f5 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt similarity index 94% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt index b4ea074e97..ba630fa701 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt index e643d9eb1e..c200a8cdff 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt index 5769513909..ed88a8bd0f 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt similarity index 97% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt index bb0ab50857..3ecf267821 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt index 27992ebc8d..f6ae1e29d8 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt index 554dbd253b..f8e60c5818 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt similarity index 99% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt index 1872b9ef51..b9ca5c0413 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt index 9e3b00f647..a2490e0eb4 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt index 6da1ea25f2..cdf0fc3672 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt index 1a57fc043e..48620b7250 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt index c1452755ac..9dcad5894b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt index 600e6003db..c9ae36ae22 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt index 2431ea54ed..b5c5fc306c 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt similarity index 96% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt index d6895e14e9..d74a659e92 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt index f5a118a13d..0fa40694b5 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt index 9887245107..7632c87535 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt similarity index 95% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt index 3cfc527e63..193ff04a46 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins +package org.partiql.system.builtins import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt similarity index 98% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt index 6e8ae00829..e22f21dbd9 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt @@ -12,14 +12,14 @@ * language governing permissions and limitations under the License. */ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import com.amazon.ion.Decimal import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Aggregation import org.partiql.spi.value.Datum +import org.partiql.system.internal.coerceNumbers import org.partiql.types.PType -import org.partiql.value.util.coerceNumbers import java.math.BigDecimal import java.math.BigInteger import java.math.MathContext diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt similarity index 89% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt index 8e6c8ca292..2768062fb5 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt index 1b5b6a4627..b170d72f21 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt similarity index 82% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt index fd18cbcc62..d19bc28f70 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt similarity index 85% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt index d45a9240fd..a98795cf10 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.function.Aggregation import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt similarity index 89% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt index 330b4858b0..a314b01f2b 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum import java.util.TreeSet diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt similarity index 88% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt index d7cb1d35a3..88ca5454ba 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt similarity index 83% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt index 32da479b3a..fb7791ee8c 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt similarity index 86% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt index c1a147041a..73ca296ec7 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt similarity index 86% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt index dbaf428014..580e75834f 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt similarity index 91% rename from partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt rename to partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt index c293a66d32..7f555e76c8 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt +++ b/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt @@ -1,4 +1,4 @@ -package org.partiql.spi.function.builtins.internal +package org.partiql.system.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt b/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt new file mode 100644 index 0000000000..811fa680db --- /dev/null +++ b/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt @@ -0,0 +1,202 @@ +package org.partiql.system.internal + +/* + * Copyright 2019 Amazon.com, Inc. or its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at: + * + * http://aws.amazon.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ + +import com.amazon.ion.Decimal +import java.math.BigDecimal +import java.math.BigInteger +import java.math.MathContext +import java.math.RoundingMode + +/** + * Essentially the same as partiql-lang's NumberExtensions.kt. Key differences are the following: + * - Adding [Int] and [Float] branch when casing on the [Number] + * - TODO support for integer types smaller than [Int] + */ + +// TODO should this be configurable? +private val MATH_CONTEXT = MathContext(38, RoundingMode.HALF_EVEN) + +/** + * Factory function to create a [BigDecimal] using correct precision, use it in favor of native BigDecimal constructors + * and factory methods + */ +internal fun bigDecimalOf(num: Number, mc: MathContext = MATH_CONTEXT): BigDecimal = when (num) { + is Decimal -> num + is Int -> BigDecimal(num, mc) + is Long -> BigDecimal(num, mc) + is Float -> BigDecimal(num.toDouble(), mc) + is Double -> BigDecimal(num, mc) + is BigInteger -> BigDecimal(num, mc) + is BigDecimal -> num + is BigInteger -> num.toBigDecimal() + else -> throw IllegalArgumentException("Unsupported number type: $num, ${num.javaClass}") +} + +/** + * This should handle Byte, Short, Int, Long, BigInteger, Float, Double, BigDecimal + */ +private val CONVERSION_MAP = mapOf>, Class>( + // BYTE + setOf(Byte::class.javaObjectType, Byte::class.javaObjectType) to Byte::class.javaObjectType, + setOf(Byte::class.javaObjectType, Short::class.javaObjectType) to Short::class.javaObjectType, + setOf(Byte::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, + setOf(Byte::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, + setOf(Byte::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(Byte::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, + setOf(Byte::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(Byte::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // SHORT + setOf(Short::class.javaObjectType, Byte::class.javaObjectType) to Short::class.javaObjectType, + setOf(Short::class.javaObjectType, Short::class.javaObjectType) to Short::class.javaObjectType, + setOf(Short::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, + setOf(Short::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, + setOf(Short::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(Short::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, + setOf(Short::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(Short::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // INT + setOf(Int::class.javaObjectType, Byte::class.javaObjectType) to Int::class.javaObjectType, + setOf(Int::class.javaObjectType, Short::class.javaObjectType) to Int::class.javaObjectType, + setOf(Int::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, + setOf(Int::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, + setOf(Int::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(Int::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, + setOf(Int::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(Int::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // LONG + setOf(Long::class.javaObjectType, Byte::class.javaObjectType) to Long::class.javaObjectType, + setOf(Long::class.javaObjectType, Short::class.javaObjectType) to Long::class.javaObjectType, + setOf(Long::class.javaObjectType, Int::class.javaObjectType) to Long::class.javaObjectType, + setOf(Long::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, + setOf(Long::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(Long::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, + setOf(Long::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(Long::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // FLOAT + setOf(Float::class.javaObjectType, Byte::class.javaObjectType) to Float::class.javaObjectType, + setOf(Float::class.javaObjectType, Short::class.javaObjectType) to Float::class.javaObjectType, + setOf(Float::class.javaObjectType, Int::class.javaObjectType) to Float::class.javaObjectType, + setOf(Float::class.javaObjectType, Long::class.javaObjectType) to Double::class.javaObjectType, + setOf(Float::class.javaObjectType, BigInteger::class.javaObjectType) to Double::class.javaObjectType, + setOf(Float::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, + setOf(Float::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(Float::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // DOUBLE + setOf(Double::class.javaObjectType, Byte::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, Short::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, Int::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, Long::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, BigInteger::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(Double::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // BIG INTEGER + setOf(BigInteger::class.javaObjectType, Byte::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, Short::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, Int::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, Long::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, + setOf(BigInteger::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, + // BIG DECIMAL + setOf(BigDecimal::class.javaObjectType, Byte::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, Short::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, Int::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, Long::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, BigInteger::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, Float::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, Double::class.javaObjectType) to BigDecimal::class.javaObjectType, + setOf(BigDecimal::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, +) + +private val CONVERTERS = mapOf, (Number) -> Number>( + Byte::class.javaObjectType to Number::toByte, + Short::class.javaObjectType to Number::toShort, + Int::class.javaObjectType to Number::toInt, + Long::class.javaObjectType to Number::toLong, + Float::class.javaObjectType to Number::toFloat, + Double::class.javaObjectType to Number::toDouble, + BigInteger::class.javaObjectType to { num -> + when (num) { + is Byte -> num.toInt().toBigInteger() + is Short -> num.toInt().toBigInteger() + is Int -> num.toBigInteger() + is Long -> num.toBigInteger() + is BigInteger -> num + else -> throw IllegalArgumentException( + "Unsupported number for BigInteger conversion: $num" + ) + } + }, + BigDecimal::class.java to { num -> + when (num) { + is Byte -> bigDecimalOf(num) + is Short -> bigDecimalOf(num) + is Int -> bigDecimalOf(num) + is Long -> bigDecimalOf(num) + is Float -> bigDecimalOf(num) + is Double -> bigDecimalOf(num) + is BigDecimal -> bigDecimalOf(num) + is BigInteger -> bigDecimalOf(num) + else -> throw IllegalArgumentException( + "Unsupported number for decimal conversion: $num (${num.javaClass.simpleName})" + ) + } + } +) + +@Suppress("UNCHECKED_CAST") +/** Provides a narrowing or widening operator on supported numbers. */ +internal fun Number.coerce(type: Class): T where T : Number { + val conv = CONVERTERS[type] ?: throw IllegalArgumentException("No converter for $type") + return conv(this) as T +} + +/** + * Implements a very simple number tower to convert two numbers to their arithmetic + * compatible type. + * + * This is only supported on limited types needed by the expression system. + * TODO: Make no longer public. + */ +public fun coerceNumbers(first: Number, second: Number): Pair { + fun typeFor(n: Number): Class<*> = if (n is Decimal) { + BigDecimal::class.javaObjectType + } else { + n.javaClass + } + + val type = CONVERSION_MAP[setOf(typeFor(first), typeFor(second))] + ?: throw IllegalArgumentException("No coercion support for ${typeFor(first)} to ${typeFor(second)}") + + return Pair(first.coerce(type), second.coerce(type)) +} + +internal operator fun Number.compareTo(other: Number): Int { + val (first, second) = coerceNumbers(this, other) + return when (first) { + is Byte -> first.compareTo(second as Byte) + is Short -> first.compareTo(second as Short) + is Int -> first.compareTo(second as Int) + is Long -> first.compareTo(second as Long) + is Float -> first.compareTo(second as Float) + is Double -> first.compareTo(second as Double) + is BigDecimal -> first.compareTo(second as BigDecimal) + is BigInteger -> first.compareTo(second as BigInteger) + else -> throw IllegalStateException() + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 82f0375275..88c7f09c7e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,6 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" +} /* * Copyright Amazon.com, Inc. or its affiliates. All rights reserved. * @@ -25,6 +28,7 @@ include( "partiql-plan", "partiql-planner", "partiql-spi", + "partiql-system", "partiql-types", "lib:sprout", "test:coverage-tests", diff --git a/test/partiql-randomized-tests/build.gradle b/test/partiql-randomized-tests/build.gradle index dba6bb42c2..4434bd78f8 100644 --- a/test/partiql-randomized-tests/build.gradle +++ b/test/partiql-randomized-tests/build.gradle @@ -23,6 +23,7 @@ dependencies { testImplementation project(':partiql-parser') testImplementation project(':partiql-plan') testImplementation project(':partiql-planner') + testImplementation project(':partiql-system') testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5' testImplementation 'pl.pragmatists:JUnitParams:[1.0.0,1.1.0)' diff --git a/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt b/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt index 432b7531a6..604825bbfd 100644 --- a/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt +++ b/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt @@ -4,8 +4,8 @@ import org.partiql.eval.compiler.PartiQLCompiler import org.partiql.parser.PartiQLParser import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog -import org.partiql.spi.catalog.Session import org.partiql.spi.value.Datum +import org.partiql.system.PartiQLSessionBuilder import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental import kotlin.test.assertEquals @@ -27,7 +27,7 @@ private fun execute(query: String): PartiQLValue { val catalog = object : Catalog { override fun getName(): String = "default" } - val session = Session.builder().catalog("default").catalogs(catalog).build() + val session = PartiQLSessionBuilder().catalog("default").catalogs(catalog).build() val engine = PartiQLCompiler.builder().build() // Execute diff --git a/test/partiql-tests-runner/build.gradle.kts b/test/partiql-tests-runner/build.gradle.kts index 0755f4ccc0..5ffb99c091 100644 --- a/test/partiql-tests-runner/build.gradle.kts +++ b/test/partiql-tests-runner/build.gradle.kts @@ -29,6 +29,7 @@ dependencies { testImplementation(project(":partiql-eval")) testImplementation(project(":partiql-parser", configuration = "shadow")) testImplementation(project(":partiql-planner")) + testImplementation(project(":partiql-system")) } val tests = System.getenv()["PARTIQL_TESTS_DATA"] ?: "../partiql-tests/partiql-tests-data" diff --git a/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt b/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt index f17b322a69..603c5093fe 100644 --- a/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt +++ b/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt @@ -26,6 +26,7 @@ import org.partiql.spi.errors.PErrorException import org.partiql.spi.errors.PErrorListener import org.partiql.spi.errors.Severity import org.partiql.spi.value.Datum +import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental @@ -152,7 +153,7 @@ class EvalExecutor( override fun create(env: IonStruct, options: CompileType): TestExecutor { // infer catalog from conformance test `env` val catalog = infer(env.toIonElement() as StructElement) - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog("default") .catalogs(catalog) .build() @@ -185,7 +186,7 @@ class EvalExecutor( */ private fun inferEnv(env: AnyElement): PType { val catalog = Catalog.builder().name("default").build() - val session = Session.builder() + val session = PartiQLSessionBuilder() .catalog("default") .catalogs(catalog) .build() From 11b149615a81d65d088996c981f84af46741c4cc Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 10:10:51 -0800 Subject: [PATCH 02/13] Moves PartiQLSystemCatalog back into SPI package Removes partiql-system package Adds systemCatalog() method to Session.Builder --- partiql-cli/build.gradle.kts | 1 - .../src/main/kotlin/org/partiql/cli/Main.kt | 4 +- partiql-eval/build.gradle.kts | 1 - .../org/partiql/eval/compiler/StrategyTest.kt | 4 +- .../partiql/eval/internal/SuccessTestCase.kt | 4 +- .../partiql/eval/internal/TypingTestCase.kt | 4 +- partiql-planner/build.gradle.kts | 1 - .../org/partiql/planner/internal/Env.kt | 63 +----- .../kotlin/org/partiql/planner/PlanTest.kt | 4 +- .../planner/PlannerPErrorReportingTests.kt | 4 +- .../internal/exclude/SubsumptionTest.kt | 4 +- .../internal/typer/PartiQLTyperTestBase.kt | 3 +- .../planner/internal/typer/PlanTyperTest.kt | 4 +- .../internal/typer/PlanTyperTestsPorted.kt | 7 +- .../planner/internal/typer/ScopeTest.kt | 4 +- partiql-spi/api/partiql-spi.api | 2 +- .../spi/catalog}/PartiQLSystemCatalog.java | 17 +- .../kotlin/org/partiql/spi/catalog/Catalog.kt | 17 +- .../org/partiql/spi/catalog/Namespace.kt | 1 - .../kotlin/org/partiql/spi/catalog/Session.kt | 22 +- .../org/partiql/spi/function}/Builtins.kt | 10 +- .../partiql/spi/function}/builtins/AggAny.kt | 4 +- .../partiql/spi/function}/builtins/AggAvg.kt | 4 +- .../spi/function}/builtins/AggCount.kt | 4 +- .../spi/function}/builtins/AggEvery.kt | 4 +- .../spi/function}/builtins/AggGroupAs.kt | 4 +- .../partiql/spi/function}/builtins/AggMax.kt | 4 +- .../partiql/spi/function}/builtins/AggMin.kt | 4 +- .../partiql/spi/function}/builtins/AggSome.kt | 4 +- .../partiql/spi/function}/builtins/AggSum.kt | 4 +- .../spi/function}/builtins/DefaultNumeric.kt | 2 +- .../builtins/DiadicArithmeticOperator.kt | 2 +- .../builtins/DiadicComparisonOperator.kt | 2 +- .../spi/function}/builtins/DiadicOperator.kt | 4 +- .../partiql/spi/function}/builtins/FnAbs.kt | 2 +- .../partiql/spi/function}/builtins/FnAnd.kt | 2 +- .../spi/function}/builtins/FnBetween.kt | 2 +- .../spi/function}/builtins/FnBitLength.kt | 2 +- .../spi/function}/builtins/FnBitwiseAnd.kt | 2 +- .../spi/function}/builtins/FnCardinality.kt | 2 +- .../spi/function}/builtins/FnCharLength.kt | 2 +- .../spi/function}/builtins/FnCollAgg.kt | 20 +- .../spi/function}/builtins/FnConcat.kt | 2 +- .../spi/function}/builtins/FnCurrentDate.kt | 2 +- .../spi/function}/builtins/FnCurrentUser.kt | 2 +- .../spi/function}/builtins/FnDateAddDay.kt | 2 +- .../spi/function}/builtins/FnDateAddHour.kt | 2 +- .../spi/function}/builtins/FnDateAddMinute.kt | 2 +- .../spi/function}/builtins/FnDateAddMonth.kt | 2 +- .../spi/function}/builtins/FnDateAddSecond.kt | 2 +- .../spi/function}/builtins/FnDateAddYear.kt | 2 +- .../spi/function}/builtins/FnDateDiffDay.kt | 2 +- .../spi/function}/builtins/FnDateDiffHour.kt | 2 +- .../function}/builtins/FnDateDiffMinute.kt | 2 +- .../spi/function}/builtins/FnDateDiffMonth.kt | 2 +- .../function}/builtins/FnDateDiffSecond.kt | 2 +- .../spi/function}/builtins/FnDateDiffYear.kt | 2 +- .../spi/function}/builtins/FnDivide.kt | 2 +- .../partiql/spi/function}/builtins/FnEq.kt | 2 +- .../spi/function}/builtins/FnExists.kt | 2 +- .../spi/function}/builtins/FnExtract.kt | 2 +- .../partiql/spi/function}/builtins/FnGt.kt | 4 +- .../partiql/spi/function}/builtins/FnGte.kt | 4 +- .../spi/function}/builtins/FnInCollection.kt | 2 +- .../partiql/spi/function}/builtins/FnIsAny.kt | 2 +- .../partiql/spi/function}/builtins/FnIsBag.kt | 2 +- .../spi/function}/builtins/FnIsBinary.kt | 2 +- .../spi/function}/builtins/FnIsBlob.kt | 2 +- .../spi/function}/builtins/FnIsBool.kt | 2 +- .../spi/function}/builtins/FnIsByte.kt | 2 +- .../spi/function}/builtins/FnIsChar.kt | 2 +- .../spi/function}/builtins/FnIsClob.kt | 2 +- .../spi/function}/builtins/FnIsDate.kt | 2 +- .../spi/function}/builtins/FnIsDecimal.kt | 2 +- .../spi/function}/builtins/FnIsFloat32.kt | 2 +- .../spi/function}/builtins/FnIsFloat64.kt | 2 +- .../partiql/spi/function}/builtins/FnIsInt.kt | 2 +- .../spi/function}/builtins/FnIsInt16.kt | 2 +- .../spi/function}/builtins/FnIsInt32.kt | 2 +- .../spi/function}/builtins/FnIsInt64.kt | 2 +- .../spi/function}/builtins/FnIsInt8.kt | 2 +- .../spi/function}/builtins/FnIsInterval.kt | 2 +- .../spi/function}/builtins/FnIsList.kt | 2 +- .../spi/function}/builtins/FnIsMissing.kt | 2 +- .../spi/function}/builtins/FnIsNull.kt | 2 +- .../spi/function}/builtins/FnIsString.kt | 2 +- .../spi/function}/builtins/FnIsStruct.kt | 2 +- .../spi/function}/builtins/FnIsTime.kt | 2 +- .../spi/function}/builtins/FnIsTimestamp.kt | 2 +- .../partiql/spi/function}/builtins/FnLike.kt | 2 +- .../spi/function}/builtins/FnLikeEscape.kt | 2 +- .../partiql/spi/function}/builtins/FnLower.kt | 2 +- .../partiql/spi/function}/builtins/FnLt.kt | 4 +- .../partiql/spi/function}/builtins/FnLte.kt | 4 +- .../partiql/spi/function}/builtins/FnMinus.kt | 2 +- .../spi/function}/builtins/FnModulo.kt | 2 +- .../partiql/spi/function}/builtins/FnNeg.kt | 2 +- .../partiql/spi/function}/builtins/FnNot.kt | 2 +- .../spi/function}/builtins/FnOctetLength.kt | 2 +- .../partiql/spi/function}/builtins/FnOr.kt | 2 +- .../partiql/spi/function}/builtins/FnPlus.kt | 2 +- .../partiql/spi/function}/builtins/FnPos.kt | 2 +- .../spi/function}/builtins/FnPosition.kt | 2 +- .../partiql/spi/function}/builtins/FnSize.kt | 2 +- .../spi/function}/builtins/FnSubstring.kt | 2 +- .../partiql/spi/function}/builtins/FnTimes.kt | 2 +- .../partiql/spi/function}/builtins/FnTrim.kt | 2 +- .../spi/function}/builtins/FnTrimChars.kt | 2 +- .../spi/function}/builtins/FnTrimLeading.kt | 2 +- .../function}/builtins/FnTrimLeadingChars.kt | 2 +- .../spi/function}/builtins/FnTrimTrailing.kt | 2 +- .../function}/builtins/FnTrimTrailingChars.kt | 2 +- .../partiql/spi/function}/builtins/FnUpper.kt | 2 +- .../spi/function}/builtins/FnUtcnow.kt | 2 +- .../spi/function}/builtins/TypePrecedence.kt | 2 +- .../builtins/internal/Accumulator.kt | 4 +- .../builtins/internal/AccumulatorAnySome.kt | 2 +- .../builtins/internal/AccumulatorAvg.kt | 2 +- .../builtins/internal/AccumulatorCount.kt | 2 +- .../builtins/internal/AccumulatorCountStar.kt | 2 +- .../builtins/internal/AccumulatorDistinct.kt | 2 +- .../builtins/internal/AccumulatorEvery.kt | 2 +- .../builtins/internal/AccumulatorGroupAs.kt | 2 +- .../builtins/internal/AccumulatorMax.kt | 2 +- .../builtins/internal/AccumulatorMin.kt | 2 +- .../builtins/internal/AccumulatorSum.kt | 2 +- .../spi/function/utils/PatternUtils.kt | 0 .../partiql/spi/function/utils/StringUtils.kt | 0 partiql-system/api/partiql-system.api | 28 --- partiql-system/build.gradle.kts | 43 ---- .../org/partiql/system/PartiQLSession.java | 101 --------- .../partiql/system/PartiQLSessionBuilder.java | 139 ------------ .../org/partiql/spi/internal/SqlTypeFamily.kt | 75 ------- .../system/internal/NumberExtensions.kt | 202 ------------------ settings.gradle.kts | 4 - test/partiql-randomized-tests/build.gradle | 1 - .../org/partiql/lang/randomized/eval/Utils.kt | 4 +- test/partiql-tests-runner/build.gradle.kts | 1 - .../partiql/runner/executor/EvalExecutor.kt | 5 +- 139 files changed, 199 insertions(+), 843 deletions(-) rename {partiql-system/src/main/java/org/partiql/system => partiql-spi/src/main/java/org/partiql/spi/catalog}/PartiQLSystemCatalog.java (80%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/Builtins.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggAny.kt (83%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggAvg.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggCount.kt (77%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggEvery.kt (85%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggGroupAs.kt (78%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggMax.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggMin.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggSome.kt (84%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/AggSum.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/DefaultNumeric.kt (83%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/DiadicArithmeticOperator.kt (88%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/DiadicComparisonOperator.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/DiadicOperator.kt (99%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnAbs.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnAnd.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnBetween.kt (99%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnBitLength.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnBitwiseAnd.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnCardinality.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnCharLength.kt (94%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnCollAgg.kt (81%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnConcat.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnCurrentDate.kt (88%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnCurrentUser.kt (88%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateAddDay.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateAddHour.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateAddMinute.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateAddMonth.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateAddSecond.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateAddYear.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateDiffDay.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateDiffHour.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateDiffMinute.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateDiffMonth.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateDiffSecond.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDateDiffYear.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnDivide.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnEq.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnExists.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnExtract.kt (99%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnGt.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnGte.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnInCollection.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsAny.kt (90%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsBag.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsBinary.kt (90%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsBlob.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsBool.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsByte.kt (90%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsChar.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsClob.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsDate.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsDecimal.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsFloat32.kt (94%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsFloat64.kt (92%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsInt.kt (93%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsInt16.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsInt32.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsInt64.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsInt8.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsInterval.kt (90%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsList.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsMissing.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsNull.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsString.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsStruct.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsTime.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnIsTimestamp.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnLike.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnLikeEscape.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnLower.kt (94%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnLt.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnLte.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnMinus.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnModulo.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnNeg.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnNot.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnOctetLength.kt (94%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnOr.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnPlus.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnPos.kt (97%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnPosition.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnSize.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnSubstring.kt (99%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTimes.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTrim.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTrimChars.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTrimLeading.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTrimLeadingChars.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTrimTrailing.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnTrimTrailingChars.kt (96%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnUpper.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/FnUtcnow.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/TypePrecedence.kt (95%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/Accumulator.kt (98%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorAnySome.kt (89%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorAvg.kt (91%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorCount.kt (82%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorCountStar.kt (85%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorDistinct.kt (89%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorEvery.kt (88%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorGroupAs.kt (83%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorMax.kt (86%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorMin.kt (86%) rename {partiql-system/src/main/kotlin/org/partiql/system => partiql-spi/src/main/kotlin/org/partiql/spi/function}/builtins/internal/AccumulatorSum.kt (91%) rename {partiql-system => partiql-spi}/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt (100%) rename {partiql-system => partiql-spi}/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt (100%) delete mode 100644 partiql-system/api/partiql-system.api delete mode 100644 partiql-system/build.gradle.kts delete mode 100644 partiql-system/src/main/java/org/partiql/system/PartiQLSession.java delete mode 100644 partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java delete mode 100644 partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt delete mode 100644 partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt diff --git a/partiql-cli/build.gradle.kts b/partiql-cli/build.gradle.kts index e1584e5e4e..ed163fa5af 100644 --- a/partiql-cli/build.gradle.kts +++ b/partiql-cli/build.gradle.kts @@ -26,7 +26,6 @@ dependencies { implementation(project(":partiql-planner")) implementation(project(":partiql-types")) implementation(project(":partiql-spi")) - implementation(project(":partiql-system")) implementation(Deps.csv) implementation(Deps.awsSdkBom) implementation(Deps.awsSdkDynamodb) diff --git a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt index 403cdd3bb5..878409a776 100644 --- a/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt +++ b/partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt @@ -20,10 +20,10 @@ import org.partiql.cli.pipeline.Pipeline import org.partiql.cli.shell.Shell import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Name +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader -import org.partiql.system.PartiQLSessionBuilder import org.partiql.value.PartiQLValueExperimental import org.partiql.value.io.PartiQLValueTextWriter import picocli.CommandLine @@ -210,7 +210,7 @@ internal class MainCommand : Runnable { println() } - private fun session() = PartiQLSessionBuilder() + private fun session() = Session.builder() .identity(System.getProperty("user.name")) .namespace(emptyList()) .catalog("default") diff --git a/partiql-eval/build.gradle.kts b/partiql-eval/build.gradle.kts index d8642a8567..17f013af7a 100644 --- a/partiql-eval/build.gradle.kts +++ b/partiql-eval/build.gradle.kts @@ -33,7 +33,6 @@ dependencies { annotationProcessor(Deps.lombok) // Test testImplementation(project(":partiql-parser")) - testImplementation(project(":partiql-system")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType testImplementation(Deps.junit4) testImplementation(Deps.junit4Params) diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt index e571378ede..912b578878 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/compiler/StrategyTest.kt @@ -9,7 +9,7 @@ import org.partiql.eval.Statement import org.partiql.parser.PartiQLParser import org.partiql.plan.rel.RelLimit import org.partiql.planner.PartiQLPlanner -import org.partiql.system.PartiQLSession +import org.partiql.spi.catalog.Session import kotlin.test.Test import kotlin.test.assertTrue @@ -20,7 +20,7 @@ public class StrategyTest { private val parser = PartiQLParser.standard() private val planner = PartiQLPlanner.standard() - private val session = PartiQLSession.empty() + private val session = Session.empty() private class MyLimit : ExprRelation { override fun open(env: Environment) = error("open") diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt index 5042435a10..32bd8d72b8 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/SuccessTestCase.kt @@ -8,10 +8,10 @@ import org.partiql.plan.Plan import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Name +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.value.Datum import org.partiql.spi.value.DatumReader -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.StaticType import org.partiql.types.fromStaticType import org.partiql.value.PartiQLValue @@ -64,7 +64,7 @@ public class SuccessTestCase( } } .build() - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("memory") .catalogs(catalog) .build() diff --git a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt index de7f5ba4d3..dda9743990 100644 --- a/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt +++ b/partiql-eval/src/test/kotlin/org/partiql/eval/internal/TypingTestCase.kt @@ -7,8 +7,8 @@ import org.partiql.parser.PartiQLParser import org.partiql.plan.Plan import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog +import org.partiql.spi.catalog.Session import org.partiql.spi.value.Datum -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental @@ -62,7 +62,7 @@ public class TypingTestCase @OptIn(PartiQLValueExperimental::class) constructor( assertEquals(1, parseResult.statements.size) val statement = parseResult.statements[0] val catalog = Catalog.builder().name("memory").build() - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("memory") .catalogs(catalog) .build() diff --git a/partiql-planner/build.gradle.kts b/partiql-planner/build.gradle.kts index c54b040c18..88a0586b80 100644 --- a/partiql-planner/build.gradle.kts +++ b/partiql-planner/build.gradle.kts @@ -37,7 +37,6 @@ dependencies { annotationProcessor(Deps.lombok) // Test testImplementation(project(":partiql-parser")) - testImplementation(project(":partiql-system")) testImplementation(testFixtures(project(":partiql-types"))) // TODO: Remove use of StaticType testImplementation(Deps.kotlinReflect) // Test Fixtures diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt index 86c5ed70cc..da8e6ed8fb 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt @@ -102,25 +102,8 @@ internal class Env(private val session: Session) { error("Qualified functions are not supported.") } - // Search in SQL Path - session.getPath().forEach { catalogName -> - // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. - if (catalogName.getLength() != 1) { - return@forEach - } - val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach - val candidates = getCandidates(catalog, identifier, args) - if (candidates.isNotEmpty()) { - return candidates - } - } - return emptyList() - } - - /** - * Given a [catalog], searches for candidate functions. - */ - private fun getCandidates(catalog: Catalog, identifier: Identifier, args: List): List { + // 1. Search in the current catalog and namespace. + val catalog = default val name = identifier.getIdentifier().getText().lowercase() // CASE-NORMALIZED LOWER val variants = catalog.getFunctions(session, name).toList() val candidates = variants.filter { it.getParameters().size == args.size } @@ -135,35 +118,14 @@ internal class Env(private val session: Session) { * @return */ fun resolveFn(identifier: Identifier, args: List): Rex? { + // Reject qualified routine names. if (identifier.hasQualifier()) { error("Qualified functions are not supported.") } - // Search in SQL Path - session.getPath().forEach { catalogName -> - // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. - if (catalogName.getLength() != 1) { - return@forEach - } - val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach - val candidates = resolveFn(catalog, identifier, args) - if (candidates != null) { - return candidates - } - } - return null - } - - /** - * TODO leverage session PATH. - * - * @param identifier - * @param args - * @return - */ - private fun resolveFn(catalog: Catalog, identifier: Identifier, args: List): Rex? { // 1. Search in the current catalog and namespace. + val catalog = default val name = identifier.getIdentifier().getText().lowercase() // CASE-NORMALIZED LOWER val variants = catalog.getFunctions(session, name).toList() if (variants.isEmpty()) { @@ -208,25 +170,10 @@ internal class Env(private val session: Session) { } fun resolveAgg(path: String, setQuantifier: SetQuantifier, args: List): Rel.Op.Aggregate.Call.Resolved? { - // Search in SQL Path - session.getPath().forEach { catalogName -> - // TODO: Allow for referencing schemas within a catalog. For now, only allow top-level functions in a catalog. - if (catalogName.getLength() != 1) { - return@forEach - } - val catalog = catalogs.getCatalog(catalogName.first()) ?: return@forEach - val agg = resolveAgg(catalog, path, setQuantifier, args) - if (agg != null) { - return agg - } - } - return null - } - - private fun resolveAgg(catalog: Catalog, path: String, setQuantifier: SetQuantifier, args: List): Rel.Op.Aggregate.Call.Resolved? { // TODO: Eventually, do we want to support sensitive lookup? With a path? // 1. Search in the current catalog and namespace. + val catalog = default val name = path.lowercase() val candidates = catalog.getAggregations(session, name).toList() if (candidates.isEmpty()) { diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt index 355c154b89..edf5f02d12 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/PlanTest.kt @@ -11,7 +11,7 @@ import org.partiql.planner.internal.TestCatalog import org.partiql.planner.test.PartiQLTest import org.partiql.planner.test.PartiQLTestProvider import org.partiql.spi.catalog.Name -import org.partiql.system.PartiQLSessionBuilder +import org.partiql.spi.catalog.Session import org.partiql.types.BagType import org.partiql.types.StaticType import org.partiql.types.StructType @@ -66,7 +66,7 @@ class PlanTest { ) private val pipeline: (PartiQLTest, Boolean) -> PartiQLPlanner.Result = { test, isSignalMode -> - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("default") .catalogs( TestCatalog.builder() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt index 4740ce545c..b426325d6b 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/PlannerPErrorReportingTests.kt @@ -12,8 +12,8 @@ import org.partiql.planner.util.PErrorCollector import org.partiql.planner.util.PlanPrinter import org.partiql.spi.Context import org.partiql.spi.catalog.Catalog +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.Field import org.partiql.types.PType @@ -38,7 +38,7 @@ internal class PlannerPErrorReportingTests { .define(Table.empty("struct_with_missing", PType.row(listOf(Field.of("f1", PType.smallint()))))) .build() - private val session = PartiQLSessionBuilder() + private val session = Session.builder() .catalog(catalogName) .catalogs(catalog) .build() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt index 6e4d044617..191ccf9216 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/exclude/SubsumptionTest.kt @@ -17,7 +17,7 @@ import org.partiql.plan.rex.RexSelect import org.partiql.plan.rex.RexVar import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog -import org.partiql.system.PartiQLSessionBuilder +import org.partiql.spi.catalog.Session import java.util.stream.Stream import kotlin.test.assertEquals @@ -41,7 +41,7 @@ class SubsumptionTest { val parseResult = parser.parse(text) assertEquals(1, parseResult.statements.size) val statement = parseResult.statements[0] - val session = PartiQLSessionBuilder().catalog("default").catalogs(catalog).build() + val session = Session.builder().catalog("default").catalogs(catalog).build() val plan = planner.plan(statement, session).plan val excludeClause = getExcludeClause(plan.getOperation()).getExclusions() assertEquals(tc.expectedExcludeExprs, excludeClause) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt index decb325940..42d534ebd7 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PartiQLTyperTestBase.kt @@ -16,7 +16,6 @@ import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.types.StaticType import org.partiql.types.fromStaticType @@ -43,7 +42,7 @@ abstract class PartiQLTyperTestBase { public val planner = PartiQLPlanner.standard() internal val session: ((String, Catalog) -> Session) = { catalog, metadata -> - PartiQLSessionBuilder() + Session.builder() .catalog(catalog) .catalogs(metadata) .build() diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt index bc8ff98f56..6d6d12f037 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTest.kt @@ -21,8 +21,8 @@ import org.partiql.planner.util.PErrorCollector import org.partiql.spi.Context import org.partiql.spi.catalog.Identifier import org.partiql.spi.catalog.Name +import org.partiql.spi.catalog.Session import org.partiql.spi.catalog.Table -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValueExperimental import org.partiql.value.int32Value @@ -120,7 +120,7 @@ class PlanTyperTest { private fun getTyper(): PlanTyperWrapper { val config = Context.of(PErrorCollector()) val env = Env( - PartiQLSessionBuilder() + Session.builder() .catalog("pql") .namespace("main") .catalogs( diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt index 04b4f0c733..13d06bd03b 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/PlanTyperTestsPorted.kt @@ -32,7 +32,6 @@ import org.partiql.spi.catalog.Name import org.partiql.spi.catalog.Session import org.partiql.spi.errors.PError import org.partiql.spi.errors.PErrorListener -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.BagType import org.partiql.types.DecimalType import org.partiql.types.Field @@ -3825,7 +3824,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: SuccessTestCase) { - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) @@ -3868,7 +3867,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: ErrorTestCase) { - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) @@ -3912,7 +3911,7 @@ internal class PlanTyperTestsPorted { } private fun runTest(tc: ThrowingExceptionTestCase) { - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog(tc.catalog) .catalogs(*catalogs.toTypedArray()) .namespace(tc.catalogPath) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt index 2d32bf9b5b..276bda5cf8 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/ScopeTest.kt @@ -10,7 +10,7 @@ import org.partiql.planner.internal.ir.relBinding import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType import org.partiql.spi.catalog.Catalog import org.partiql.spi.catalog.Identifier -import org.partiql.system.PartiQLSessionBuilder +import org.partiql.spi.catalog.Session import org.partiql.types.PType import kotlin.test.assertEquals import kotlin.test.fail @@ -36,7 +36,7 @@ internal class ScopeTest { @JvmStatic val locals = TypeEnv( Env( - PartiQLSessionBuilder() + Session.builder() .catalog("currentCatalog") .catalogs(catalog) .build() diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 020f1dabfe..4baeaffee0 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -202,7 +202,6 @@ public final class org/partiql/spi/catalog/Namespace : java/lang/Iterable, kotli public synthetic fun ([Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun append ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace; public final fun asIdentifier ()Lorg/partiql/spi/catalog/Identifier; - public static final fun empty ()Lorg/partiql/spi/catalog/Namespace; public fun equals (Ljava/lang/Object;)Z public fun forEach (Ljava/util/function/Consumer;)V public final fun get (I)Ljava/lang/String; @@ -262,6 +261,7 @@ public final class org/partiql/spi/catalog/Session$Builder { public final fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/spi/catalog/Session$Builder; public final fun namespace ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; public final fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; + public final fun systemCatalog (Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Session$Builder; } public final class org/partiql/spi/catalog/Session$Companion { diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java b/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java similarity index 80% rename from partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java rename to partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java index 980a787371..87cc927de5 100644 --- a/partiql-system/src/main/java/org/partiql/system/PartiQLSystemCatalog.java +++ b/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java @@ -1,23 +1,22 @@ -package org.partiql.system; +package org.partiql.spi.catalog; -import lombok.EqualsAndHashCode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.partiql.spi.catalog.Catalog; -import org.partiql.spi.catalog.Identifier; -import org.partiql.spi.catalog.Name; -import org.partiql.spi.catalog.Session; -import org.partiql.spi.catalog.Table; import org.partiql.spi.function.Aggregation; +import org.partiql.spi.function.Builtins; import org.partiql.spi.function.Function; import java.util.Collection; /** - * This is a package-private class that implements the PartiQL System Catalog. + *

+ * This implements the PartiQL System Catalog. + *

+ *

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

+ * @see Session.Builder */ final class PartiQLSystemCatalog implements Catalog { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt index 7f358a223c..d7233390bb 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt @@ -2,6 +2,7 @@ package org.partiql.spi.catalog import org.partiql.spi.catalog.impl.StandardCatalog import org.partiql.spi.function.Aggregation +import org.partiql.spi.function.Builtins import org.partiql.spi.function.Function /** @@ -21,9 +22,7 @@ public interface Catalog { /** * Get a table by name. */ - public fun getTable(session: Session, name: Name): Table? { - return null - } + public fun getTable(session: Session, name: Name): Table? = null /** * Get a table by identifier. @@ -42,23 +41,17 @@ public interface Catalog { * 2. Invoke getTable("a"."b"."c"."Example"."x") * 3. The implementation MUST match "a"."b"."c"."Example" to a.b.c.Example (note "x" does not match a table) */ - public fun getTable(session: Session, identifier: Identifier): Table? { - return null - } + public fun getTable(session: Session, identifier: Identifier): Table? = null /** * Returns a collection of scalar functions in this catalog with the given name, or an empty list if none. */ - public fun getFunctions(session: Session, name: String): Collection { - return emptyList() - } + public fun getFunctions(session: Session, name: String): Collection = Builtins.getFunctions(name) /** * Returns a collection of aggregation functions in this catalog with the given name, or an empty list if none. */ - public fun getAggregations(session: Session, name: String): Collection { - return emptyList() - } + public fun getAggregations(session: Session, name: String): Collection = Builtins.getAggregations(name) public companion object { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt index a597dba253..170bf5b989 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt @@ -81,7 +81,6 @@ public class Namespace private constructor( private val EMPTY = Namespace(emptyArray()) - @JvmStatic public fun empty(): Namespace = EMPTY @JvmStatic diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index fd114a82f1..cd2a50358f 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -64,6 +64,8 @@ public interface Session { private var identity: String = "unknown" private var catalog: String? = null + private var systemCatalogName: String = "\$pql_system" + private var systemCatalog: Catalog = PartiQLSystemCatalog(systemCatalogName) private var catalogs: Catalogs.Builder = Catalogs.builder() private var namespace: Namespace = Namespace.empty() private var properties: MutableMap = mutableMapOf() @@ -98,6 +100,16 @@ public interface Session { return this } + /** + * Adds and designates a catalog to always be on the SQL-Path. This [catalog] provides all built-in functions + * to the system at hand. + * If this is never invoked, a default system catalog is provided. + */ + public fun systemCatalog(catalog: Catalog): Builder { + this.systemCatalogName = catalog.getName() + return this + } + /** * Adds catalogs to this session. */ @@ -110,16 +122,24 @@ public interface Session { public fun build(): Session = object : Session { - private val _catalogs = catalogs.build() + private val _catalogs: Catalogs + private val systemCatalogNamespace: Namespace = Namespace.of(systemCatalogName) init { require(catalog != null) { "Session catalog must be set" } + catalogs.add(systemCatalog) + _catalogs = catalogs.build() } override fun getIdentity(): String = identity override fun getCatalog(): String = catalog!! override fun getCatalogs(): Catalogs = _catalogs override fun getNamespace(): Namespace = namespace + + override fun getPath(): Path { + val currentNamespace = getNamespace() + return Path.of(currentNamespace, systemCatalogNamespace) + } } } } diff --git a/partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt index 5dec5232f7..cdd7f2f477 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/Builtins.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/Builtins.kt @@ -1,9 +1,7 @@ -package org.partiql.system +package org.partiql.spi.function /* ktlint-disable no-wildcard-imports */ -import org.partiql.spi.function.Aggregation -import org.partiql.spi.function.Function -import org.partiql.system.builtins.* +import org.partiql.spi.function.builtins.* /** * This is where we will register all SQL builtins; consider raising a "library" interface. @@ -184,8 +182,8 @@ internal object Builtins { Fn_LIKE_ESCAPE__STRING_STRING_STRING__BOOL, Fn_LIKE_ESCAPE__CLOB_CLOB_CLOB__BOOL, - org.partiql.system.builtins.Fn_LOWER__STRING__STRING, - org.partiql.system.builtins.Fn_LOWER__CLOB__CLOB, + Fn_LOWER__STRING__STRING, + Fn_LOWER__CLOB__CLOB, FnLt, FnLte, diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt similarity index 83% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt index 105bb3f590..cadee2aaa3 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAny.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAny.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorAnySome +import org.partiql.spi.function.builtins.internal.AccumulatorAnySome import org.partiql.types.PType internal val Agg_ANY__BOOL__BOOL = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt index 96c4e4331c..d78de2bd49 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggAvg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggAvg.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorAvg +import org.partiql.spi.function.builtins.internal.AccumulatorAvg import org.partiql.types.PType // TODO: This needs to be formalized. See https://github.com/partiql/partiql-lang-kotlin/issues/1659 diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt similarity index 77% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt index 04967cc120..50abf38616 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggCount.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggCount.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorCount +import org.partiql.spi.function.builtins.internal.AccumulatorCount import org.partiql.types.PType internal val Agg_COUNT__ANY__INT64 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt similarity index 85% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt index f009d8d6a9..6973374d05 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggEvery.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggEvery.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorEvery +import org.partiql.spi.function.builtins.internal.AccumulatorEvery import org.partiql.types.PType internal val Agg_EVERY__BOOL__BOOL = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt similarity index 78% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt index 11cff8fc96..90630e8cff 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggGroupAs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggGroupAs.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorGroupAs +import org.partiql.spi.function.builtins.internal.AccumulatorGroupAs import org.partiql.types.PType internal val Agg_GROUP_AS__ANY__ANY = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt index 9d4ac8ad52..de8831d7b2 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMax.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMax.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorMax +import org.partiql.spi.function.builtins.internal.AccumulatorMax import org.partiql.types.PType internal val Agg_MAX__INT8__INT8 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt index 8ceddf8b12..140f569fe6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggMin.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggMin.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorMin +import org.partiql.spi.function.builtins.internal.AccumulatorMin import org.partiql.types.PType internal val Agg_MIN__INT8__INT8 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt similarity index 84% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt index 32dad874de..6b28cfaee1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSome.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSome.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorAnySome +import org.partiql.spi.function.builtins.internal.AccumulatorAnySome import org.partiql.types.PType internal val Agg_SOME__BOOL__BOOL = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt index af22fe007a..b661e6dc75 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/AggSum.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/AggSum.kt @@ -1,11 +1,11 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Aggregation import org.partiql.spi.function.Parameter -import org.partiql.system.builtins.internal.AccumulatorSum +import org.partiql.spi.function.builtins.internal.AccumulatorSum import org.partiql.types.PType internal val Agg_SUM__INT8__INT8 = Aggregation.static( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt similarity index 83% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt index 5bdd8c2917..cb9d44a308 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DefaultNumeric.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DefaultNumeric.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt index 920fb05182..ff5ac52a66 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicArithmeticOperator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicArithmeticOperator.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt index 880c4cfcdf..948d5af299 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicComparisonOperator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicComparisonOperator.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt index 8243404217..bd233083ca 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/DiadicOperator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/DiadicOperator.kt @@ -1,10 +1,10 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter +import org.partiql.spi.function.builtins.TypePrecedence.TYPE_PRECEDENCE import org.partiql.spi.internal.SqlTypeFamily import org.partiql.spi.value.Datum -import org.partiql.system.builtins.TypePrecedence.TYPE_PRECEDENCE import org.partiql.types.PType /** diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt index caefef2f25..d975387861 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAbs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAbs.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt index c5e16aacba..07399b386a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnAnd.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnAnd.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt index 161b21ec76..3df72bc163 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBetween.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBetween.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt index 8973149474..ba477cdbfb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitLength.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitLength.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt index 379ae624ad..f2e1db52b4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnBitwiseAnd.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnBitwiseAnd.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt index a4a620dcf1..8a37a7ea12 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCardinality.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCardinality.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt index b92b0475e3..ebb7b550c7 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCharLength.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCharLength.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt similarity index 81% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt index d571c6b943..09a09f782e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCollAgg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCollAgg.kt @@ -1,20 +1,20 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter +import org.partiql.spi.function.builtins.internal.Accumulator +import org.partiql.spi.function.builtins.internal.AccumulatorAnySome +import org.partiql.spi.function.builtins.internal.AccumulatorAvg +import org.partiql.spi.function.builtins.internal.AccumulatorCount +import org.partiql.spi.function.builtins.internal.AccumulatorDistinct +import org.partiql.spi.function.builtins.internal.AccumulatorEvery +import org.partiql.spi.function.builtins.internal.AccumulatorMax +import org.partiql.spi.function.builtins.internal.AccumulatorMin +import org.partiql.spi.function.builtins.internal.AccumulatorSum import org.partiql.spi.value.Datum -import org.partiql.system.builtins.internal.Accumulator -import org.partiql.system.builtins.internal.AccumulatorAnySome -import org.partiql.system.builtins.internal.AccumulatorAvg -import org.partiql.system.builtins.internal.AccumulatorCount -import org.partiql.system.builtins.internal.AccumulatorDistinct -import org.partiql.system.builtins.internal.AccumulatorEvery -import org.partiql.system.builtins.internal.AccumulatorMax -import org.partiql.system.builtins.internal.AccumulatorMin -import org.partiql.system.builtins.internal.AccumulatorSum import org.partiql.types.PType internal abstract class Fn_COLL_AGG__BAG__ANY( diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt index 33e3226d93..d8e90d651f 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnConcat.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnConcat.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt index 4551bb3c6d..3fe9cc2ae4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentDate.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentDate.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt index 20c9554a75..4b234ecec4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnCurrentUser.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnCurrentUser.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt index 8a67a8e168..98f9e4f5a9 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddDay.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddDay.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt index 96ca622291..be21e3c081 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddHour.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddHour.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt index 2aec5b5573..9811538a93 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMinute.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMinute.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt index 3a30bb3096..5a61e31c59 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddMonth.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddMonth.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt index fc19f32c8b..53c3415e58 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddSecond.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddSecond.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt index 64256e509f..4beae8cbb3 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateAddYear.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateAddYear.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.DataException import org.partiql.errors.TypeCheckException diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt index d48c5d6c9b..9b3ce54b01 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffDay.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffDay.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt index 759063645a..f8bd4bada6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffHour.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffHour.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt index b938f39ed9..3ec4231903 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMinute.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMinute.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt index 33b9c79e10..634bb52e42 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffMonth.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffMonth.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt index 3775778428..e2cedd215f 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffSecond.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffSecond.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt index d37cf0ab3d..483f59e7d1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDateDiffYear.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDateDiffYear.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt index 4577294f3d..cc1f6f1a2d 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnDivide.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnDivide.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt index b5372e0fe6..22d8582bb5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnEq.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnEq.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt index 455489b155..09c2b06f89 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExists.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExists.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt index 22cb3d0fc2..dfe6db4cbc 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnExtract.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnExtract.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt index 6770295383..c0077be009 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGt.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGt.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnGt : DiadicComparisonOperator("gt") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt index dd3d0c775c..9a581b5c2b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnGte.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnGte.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnGte : DiadicComparisonOperator("gte") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt index 0c926afc29..c54fe8f127 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnInCollection.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnInCollection.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName", "DEPRECATION") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt index b2b100e8ef..c9ebf47aa4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsAny.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsAny.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt index 4628f8e0dd..e35758ea2a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBag.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBag.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt index e4cf405c8d..c92e3a3a6e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBinary.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBinary.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt index 3134c4a5f7..abefbf0bba 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBlob.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBlob.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt index cc20b069f4..2ca7040c46 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsBool.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsBool.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt index fed6c6e662..45a710121e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsByte.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsByte.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt index 4f7f21b9e3..ae1da6b8f5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsChar.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsChar.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt index 7672c439b5..d88d0849e5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsClob.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsClob.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt index 8cd774a507..adf281acd6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDate.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDate.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt index b3590fb99e..3cc07bb7e1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsDecimal.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsDecimal.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt index e83b10cf6c..0f873d9f8c 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat32.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat32.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt similarity index 92% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt index 63721bdea9..424c0a86d5 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsFloat64.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsFloat64.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt similarity index 93% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt index 194783deef..09bdf95c6e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt index 0b56211312..8bf34170e1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt16.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt16.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt index fc07901248..3c16b7383e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt32.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt32.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt index b49b0ca64b..1a55a51556 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt64.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt64.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt index bb5b9c6805..46379417b6 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInt8.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInt8.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt similarity index 90% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt index 04a3e565e8..2141027c1b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsInterval.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsInterval.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt index 3201bdfa01..0bf3d3819a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsList.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsList.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt index 2b4d903e3b..7acb5188cb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsMissing.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsMissing.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt index 678c0a8e41..d3d258db86 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsNull.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsNull.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt index 5ca9d51af8..2d6c981334 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsString.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsString.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt index 73a6fcdfca..e83155c0cf 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsStruct.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsStruct.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt index 1776e1ef7d..ae3f6b36c9 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTime.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTime.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt index 46fe11abd0..63f7982810 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnIsTimestamp.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnIsTimestamp.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt index 3b56081dfc..7d2801dd05 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLike.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLike.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt index 6efcdd42ea..88093f28a4 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLikeEscape.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLikeEscape.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt index e06a919cd3..ebca15aeef 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLower.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLower.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt index a9065accea..8e526a2beb 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLt.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLt.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnLt : DiadicComparisonOperator("lt") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt index 6ce9316bb6..35d6cba0e1 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnLte.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnLte.kt @@ -1,12 +1,12 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum -import org.partiql.system.internal.compareTo import org.partiql.types.PType +import org.partiql.value.util.compareTo internal object FnLte : DiadicComparisonOperator("lte") { diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt index fef010eafa..df7de273c8 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnMinus.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnMinus.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt index a40fcf8eb3..a785a020ec 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnModulo.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnModulo.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt index 9f7c0f40a9..0ebc9380c8 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNeg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNeg.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt index 4f6b1437f5..c605f78000 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnNot.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnNot.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt similarity index 94% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt index ba630fa701..b4ea074e97 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOctetLength.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOctetLength.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt index c200a8cdff..e643d9eb1e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnOr.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnOr.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt index ed88a8bd0f..5769513909 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPlus.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPlus.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt similarity index 97% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt index 3ecf267821..bb0ab50857 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPos.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPos.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt index f6ae1e29d8..27992ebc8d 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnPosition.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnPosition.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt index f8e60c5818..554dbd253b 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSize.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSize.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt similarity index 99% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt index b9ca5c0413..1872b9ef51 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnSubstring.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnSubstring.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Function diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt index a2490e0eb4..9e3b00f647 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTimes.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTimes.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt index cdf0fc3672..6da1ea25f2 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrim.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrim.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt index 48620b7250..1a57fc043e 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimChars.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt index 9dcad5894b..c1452755ac 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeading.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeading.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt index c9ae36ae22..600e6003db 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimLeadingChars.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimLeadingChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt index b5c5fc306c..2431ea54ed 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailing.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailing.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt similarity index 96% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt index d74a659e92..d6895e14e9 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnTrimTrailingChars.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnTrimTrailingChars.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt index 0fa40694b5..f5a118a13d 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUpper.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUpper.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.function.Parameter diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt index 7632c87535..9887245107 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/FnUtcnow.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/FnUtcnow.kt @@ -1,7 +1,7 @@ // ktlint-disable filename @file:Suppress("ClassName") -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.spi.function.Function import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt similarity index 95% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt index 193ff04a46..3cfc527e63 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/TypePrecedence.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/TypePrecedence.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins +package org.partiql.spi.function.builtins import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt similarity index 98% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt index e22f21dbd9..6e8ae00829 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/Accumulator.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/Accumulator.kt @@ -12,14 +12,14 @@ * language governing permissions and limitations under the License. */ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import com.amazon.ion.Decimal import org.partiql.errors.TypeCheckException import org.partiql.spi.function.Aggregation import org.partiql.spi.value.Datum -import org.partiql.system.internal.coerceNumbers import org.partiql.types.PType +import org.partiql.value.util.coerceNumbers import java.math.BigDecimal import java.math.BigInteger import java.math.MathContext diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt similarity index 89% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt index 2768062fb5..8e6c8ca292 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAnySome.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAnySome.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt index b170d72f21..1b5b6a4627 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorAvg.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorAvg.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt similarity index 82% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt index d19bc28f70..fd18cbcc62 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCount.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCount.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt similarity index 85% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt index a98795cf10..d45a9240fd 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorCountStar.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorCountStar.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.function.Aggregation import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt similarity index 89% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt index a314b01f2b..330b4858b0 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorDistinct.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorDistinct.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import java.util.TreeSet diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt similarity index 88% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt index 88ca5454ba..d7cb1d35a3 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorEvery.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorEvery.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt similarity index 83% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt index fb7791ee8c..32da479b3a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorGroupAs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorGroupAs.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt similarity index 86% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt index 73ca296ec7..c1a147041a 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMax.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMax.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt similarity index 86% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt index 580e75834f..dbaf428014 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorMin.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorMin.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum diff --git a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt similarity index 91% rename from partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt index 7f555e76c8..c293a66d32 100644 --- a/partiql-system/src/main/kotlin/org/partiql/system/builtins/internal/AccumulatorSum.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/function/builtins/internal/AccumulatorSum.kt @@ -1,4 +1,4 @@ -package org.partiql.system.builtins.internal +package org.partiql.spi.function.builtins.internal import org.partiql.spi.value.Datum import org.partiql.types.PType diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt similarity index 100% rename from partiql-system/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/PatternUtils.kt diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt similarity index 100% rename from partiql-system/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt rename to partiql-spi/src/main/kotlin/org/partiql/spi/function/utils/StringUtils.kt diff --git a/partiql-system/api/partiql-system.api b/partiql-system/api/partiql-system.api deleted file mode 100644 index 53162b7934..0000000000 --- a/partiql-system/api/partiql-system.api +++ /dev/null @@ -1,28 +0,0 @@ -public final class org/partiql/system/PartiQLSession : org/partiql/spi/catalog/Session { - public static fun empty ()Lorg/partiql/spi/catalog/Session; - public fun getCatalog ()Ljava/lang/String; - public fun getCatalogs ()Lorg/partiql/spi/catalog/Catalogs; - public fun getIdentity ()Ljava/lang/String; - public fun getNamespace ()Lorg/partiql/spi/catalog/Namespace; - public fun getPath ()Lorg/partiql/spi/catalog/Path; - public fun getProperties ()Ljava/util/Map; -} - -public final class org/partiql/system/PartiQLSessionBuilder { - public fun ()V - public fun build ()Lorg/partiql/spi/catalog/Session; - public fun catalog (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun catalogs ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun identity (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun namespace (Ljava/util/Collection;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun namespace ([Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun noSystemCatalog ()Lorg/partiql/system/PartiQLSessionBuilder; - public fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; - public fun systemCatalogName (Ljava/lang/String;)Lorg/partiql/system/PartiQLSessionBuilder; -} - -public final class org/partiql/system/internal/NumberExtensionsKt { - public static final fun coerceNumbers (Ljava/lang/Number;Ljava/lang/Number;)Lkotlin/Pair; -} - diff --git a/partiql-system/build.gradle.kts b/partiql-system/build.gradle.kts deleted file mode 100644 index 86ff4b227b..0000000000 --- a/partiql-system/build.gradle.kts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -plugins { - id(Plugins.conventions) - id(Plugins.publish) -} - -dependencies { - api(project(":partiql-spi")) - api(project(":partiql-types")) - compileOnly(Deps.lombok) - annotationProcessor(Deps.lombok) -} - -// TODO: Once we move to only public Java APIs, we can use Javadoc. -// Need to add this as we have both Java and Kotlin sources. Dokka already handles multi-language projects. If -// Javadoc is enabled, we end up overwriting index.html (causing compilation errors). -tasks.withType { - enabled = false -} - -tasks.withType { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - -publish { - artifactId = "partiql-catalog" - name = "PartiQL Catalog" - description = "Contains all of the PartiQL System's functions and operators." -} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java deleted file mode 100644 index 9ef1d96d98..0000000000 --- a/partiql-system/src/main/java/org/partiql/system/PartiQLSession.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.partiql.system; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.partiql.spi.catalog.Catalogs; -import org.partiql.spi.catalog.Namespace; -import org.partiql.spi.catalog.Path; -import org.partiql.spi.catalog.Session; - -import java.util.HashMap; -import java.util.Map; - -/** - * This is a package-private implementation of {@link Session}. - * @see PartiQLSessionBuilder - */ -public final class PartiQLSession implements Session { - - @NotNull - private final Catalogs _catalogs; - - @NotNull - private final String identity; - - @Nullable - private final Namespace systemCatalogNamespace; - - @NotNull - private final String currentCatalog; - - @NotNull - private final Namespace namespace; - - @NotNull - private final Map properties; - - PartiQLSession(boolean usesSystemCatalog, @NotNull String systemCatalogName, @NotNull String identity, @NotNull String catalog, @NotNull Namespace namespace, @NotNull Catalogs.Builder catalogs, @NotNull Map properties) { - this.systemCatalogNamespace = usesSystemCatalog ? Namespace.of(systemCatalogName) : null; - this.identity = identity; - this.currentCatalog = catalog; - this.namespace = namespace; - this.properties = properties; - if (usesSystemCatalog) { - catalogs.add(new PartiQLSystemCatalog(systemCatalogName)); - } - this._catalogs = catalogs.build(); - } - - @NotNull - @Override - public Map getProperties() { - return properties; - } - - @NotNull - @Override - public Path getPath() { - return Path.of(getNamespace(), systemCatalogNamespace); - } - - @NotNull - @Override - public String getIdentity() { - return identity; - } - - @NotNull - @Override - public String getCatalog() { - return currentCatalog; - } - - @NotNull - @Override - public Catalogs getCatalogs() { - return _catalogs; - } - - @NotNull - @Override - public Namespace getNamespace() { - return namespace; - } - - /** - * - * @return a session only holding the system catalog. - */ - @NotNull - public static Session empty() { - return new PartiQLSession( - true, - "$pql_system", - "unknown", - "$pql_system", - Namespace.of(), - Catalogs.builder(), - new HashMap<>() - ); - } -} diff --git a/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java b/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java deleted file mode 100644 index 515672fcda..0000000000 --- a/partiql-system/src/main/java/org/partiql/system/PartiQLSessionBuilder.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.partiql.system; - -import org.jetbrains.annotations.NotNull; -import org.partiql.spi.catalog.Catalog; -import org.partiql.spi.catalog.Catalogs; -import org.partiql.spi.catalog.Namespace; -import org.partiql.spi.catalog.Session; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * This creates a {@link Session} while also installing the PartiQL System Catalog by default (unless - * {@link PartiQLSessionBuilder#noSystemCatalog()} is specified). The resulting {@link Session} will append the System - * Catalog to the end of the {@link Session#getPath()}. - * @see PartiQLSessionBuilder#noSystemCatalog() - * @see PartiQLSessionBuilder#systemCatalogName(String) - */ -public final class PartiQLSessionBuilder { - - private String identity = "unknown"; - private String catalog = null; - private final Catalogs.Builder catalogs = Catalogs.builder(); - private Namespace namespace = Namespace.empty(); - private final Map properties = new HashMap<>(); - private boolean usesSystemCatalog = true; - private String systemCatalogName = "$partiql_system"; - - /** - * TODO - * @param identity TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder identity(String identity) { - this.identity = identity; - return this; - } - - /** - * Removes the system catalog from the session. - * @return the builder - */ - @NotNull - public PartiQLSessionBuilder noSystemCatalog() { - this.usesSystemCatalog = false; - return this; - } - - /** - * Sets the name of the system catalog. - * @param name the desired name - * @return the builder - */ - @NotNull - public PartiQLSessionBuilder systemCatalogName(@NotNull String name) { - this.systemCatalogName = name; - return this; - } - - /** - * TODO - * @param catalog TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder catalog(String catalog) { - this.catalog = catalog; - return this; - } - - /** - * TODO - * @param namespace TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder namespace(Namespace namespace) { - this.namespace = namespace; - return this; - } - - /** - * TODO - * @param levels TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder namespace(String... levels) { - this.namespace = Namespace.of(levels); - return this; - } - - /** - * TODO - * @param levels TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder namespace(Collection levels) { - this.namespace = Namespace.of(levels); - return this; - } - - /** - * TODO - * @param name TODO - * @param value TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder property(String name, String value) { - this.properties.put(name, value); - return this; - } - - /** - * TODO - * @param catalogs TODO - * @return TODO - */ - @NotNull - public PartiQLSessionBuilder catalogs(Catalog... catalogs) { - for (Catalog catalog : catalogs) { - this.catalogs.add(catalog); - } - return this; - } - - /** - * TODO - * @return TODO - */ - @NotNull - public Session build() { - return new PartiQLSession(usesSystemCatalog, systemCatalogName, identity, catalog, namespace, catalogs, properties); - } -} diff --git a/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt b/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt deleted file mode 100644 index cc2dabd867..0000000000 --- a/partiql-system/src/main/kotlin/org/partiql/spi/internal/SqlTypeFamily.kt +++ /dev/null @@ -1,75 +0,0 @@ -package org.partiql.spi.internal - -import org.partiql.types.PType - -/** - * A basic "set" representation for type categorization; perhaps we optimize later.. - * - * From Calcite, - * > SqlTypeFamily provides SQL type categorization. - * > Primary Families - * > CHARACTER, - * > BINARY, - * > NUMERIC, - * > DATE, - * > TIME, - * > TIMESTAMP, - * > BOOLEAN, - * > https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java - * - * - * From Postgres, - * > Data types are divided into several basic type categories, including boolean, numeric, string, bitstring, datetime, - * > timespan, geometric, network, and user-defined. Within each category there can be one or more preferred types, - * > which are preferred when there is a choice of possible types. - */ -internal class SqlTypeFamily private constructor( - @JvmField val preferred: PType, - @JvmField val members: Set, -) { - - /** - * Constructor a singleton [SqlTypeFamily]. - */ - constructor(preferred: PType) : this(preferred, setOf(preferred.code())) - - operator fun contains(type: PType) = type.code() in members - - companion object { - - @JvmStatic - val TEXT = SqlTypeFamily( - preferred = PType.string(), - members = setOf( - PType.CHAR, - PType.VARCHAR, - PType.STRING, - PType.CLOB, - ) - ) - - @JvmStatic - val COLLECTION = SqlTypeFamily( - preferred = PType.bag(), - members = setOf( - PType.ARRAY, - PType.BAG - ) - ) - - @JvmStatic - val NUMBER = SqlTypeFamily( - preferred = PType.decimal(38, 19), - members = setOf( - PType.TINYINT, - PType.SMALLINT, - PType.INTEGER, - PType.BIGINT, - PType.NUMERIC, - PType.REAL, - PType.DOUBLE, - PType.DECIMAL, - ) - ) - } -} diff --git a/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt b/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt deleted file mode 100644 index 811fa680db..0000000000 --- a/partiql-system/src/main/kotlin/org/partiql/system/internal/NumberExtensions.kt +++ /dev/null @@ -1,202 +0,0 @@ -package org.partiql.system.internal - -/* - * Copyright 2019 Amazon.com, Inc. or its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at: - * - * http://aws.amazon.com/apache2.0/ - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific - * language governing permissions and limitations under the License. - */ - -import com.amazon.ion.Decimal -import java.math.BigDecimal -import java.math.BigInteger -import java.math.MathContext -import java.math.RoundingMode - -/** - * Essentially the same as partiql-lang's NumberExtensions.kt. Key differences are the following: - * - Adding [Int] and [Float] branch when casing on the [Number] - * - TODO support for integer types smaller than [Int] - */ - -// TODO should this be configurable? -private val MATH_CONTEXT = MathContext(38, RoundingMode.HALF_EVEN) - -/** - * Factory function to create a [BigDecimal] using correct precision, use it in favor of native BigDecimal constructors - * and factory methods - */ -internal fun bigDecimalOf(num: Number, mc: MathContext = MATH_CONTEXT): BigDecimal = when (num) { - is Decimal -> num - is Int -> BigDecimal(num, mc) - is Long -> BigDecimal(num, mc) - is Float -> BigDecimal(num.toDouble(), mc) - is Double -> BigDecimal(num, mc) - is BigInteger -> BigDecimal(num, mc) - is BigDecimal -> num - is BigInteger -> num.toBigDecimal() - else -> throw IllegalArgumentException("Unsupported number type: $num, ${num.javaClass}") -} - -/** - * This should handle Byte, Short, Int, Long, BigInteger, Float, Double, BigDecimal - */ -private val CONVERSION_MAP = mapOf>, Class>( - // BYTE - setOf(Byte::class.javaObjectType, Byte::class.javaObjectType) to Byte::class.javaObjectType, - setOf(Byte::class.javaObjectType, Short::class.javaObjectType) to Short::class.javaObjectType, - setOf(Byte::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, - setOf(Byte::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Byte::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Byte::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, - setOf(Byte::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Byte::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // SHORT - setOf(Short::class.javaObjectType, Byte::class.javaObjectType) to Short::class.javaObjectType, - setOf(Short::class.javaObjectType, Short::class.javaObjectType) to Short::class.javaObjectType, - setOf(Short::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, - setOf(Short::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Short::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Short::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, - setOf(Short::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Short::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // INT - setOf(Int::class.javaObjectType, Byte::class.javaObjectType) to Int::class.javaObjectType, - setOf(Int::class.javaObjectType, Short::class.javaObjectType) to Int::class.javaObjectType, - setOf(Int::class.javaObjectType, Int::class.javaObjectType) to Int::class.javaObjectType, - setOf(Int::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Int::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Int::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(Int::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Int::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // LONG - setOf(Long::class.javaObjectType, Byte::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, Short::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, Int::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, Long::class.javaObjectType) to Long::class.javaObjectType, - setOf(Long::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(Long::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(Long::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Long::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // FLOAT - setOf(Float::class.javaObjectType, Byte::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Short::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Int::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Long::class.javaObjectType) to Double::class.javaObjectType, - setOf(Float::class.javaObjectType, BigInteger::class.javaObjectType) to Double::class.javaObjectType, - setOf(Float::class.javaObjectType, Float::class.javaObjectType) to Float::class.javaObjectType, - setOf(Float::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Float::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // DOUBLE - setOf(Double::class.javaObjectType, Byte::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Short::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Int::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Long::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, BigInteger::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(Double::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // BIG INTEGER - setOf(BigInteger::class.javaObjectType, Byte::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Short::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Int::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Long::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, BigInteger::class.javaObjectType) to BigInteger::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Float::class.javaObjectType) to Double::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, Double::class.javaObjectType) to Double::class.javaObjectType, - setOf(BigInteger::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, - // BIG DECIMAL - setOf(BigDecimal::class.javaObjectType, Byte::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Short::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Int::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Long::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, BigInteger::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Float::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, Double::class.javaObjectType) to BigDecimal::class.javaObjectType, - setOf(BigDecimal::class.javaObjectType, BigDecimal::class.javaObjectType) to BigDecimal::class.javaObjectType, -) - -private val CONVERTERS = mapOf, (Number) -> Number>( - Byte::class.javaObjectType to Number::toByte, - Short::class.javaObjectType to Number::toShort, - Int::class.javaObjectType to Number::toInt, - Long::class.javaObjectType to Number::toLong, - Float::class.javaObjectType to Number::toFloat, - Double::class.javaObjectType to Number::toDouble, - BigInteger::class.javaObjectType to { num -> - when (num) { - is Byte -> num.toInt().toBigInteger() - is Short -> num.toInt().toBigInteger() - is Int -> num.toBigInteger() - is Long -> num.toBigInteger() - is BigInteger -> num - else -> throw IllegalArgumentException( - "Unsupported number for BigInteger conversion: $num" - ) - } - }, - BigDecimal::class.java to { num -> - when (num) { - is Byte -> bigDecimalOf(num) - is Short -> bigDecimalOf(num) - is Int -> bigDecimalOf(num) - is Long -> bigDecimalOf(num) - is Float -> bigDecimalOf(num) - is Double -> bigDecimalOf(num) - is BigDecimal -> bigDecimalOf(num) - is BigInteger -> bigDecimalOf(num) - else -> throw IllegalArgumentException( - "Unsupported number for decimal conversion: $num (${num.javaClass.simpleName})" - ) - } - } -) - -@Suppress("UNCHECKED_CAST") -/** Provides a narrowing or widening operator on supported numbers. */ -internal fun Number.coerce(type: Class): T where T : Number { - val conv = CONVERTERS[type] ?: throw IllegalArgumentException("No converter for $type") - return conv(this) as T -} - -/** - * Implements a very simple number tower to convert two numbers to their arithmetic - * compatible type. - * - * This is only supported on limited types needed by the expression system. - * TODO: Make no longer public. - */ -public fun coerceNumbers(first: Number, second: Number): Pair { - fun typeFor(n: Number): Class<*> = if (n is Decimal) { - BigDecimal::class.javaObjectType - } else { - n.javaClass - } - - val type = CONVERSION_MAP[setOf(typeFor(first), typeFor(second))] - ?: throw IllegalArgumentException("No coercion support for ${typeFor(first)} to ${typeFor(second)}") - - return Pair(first.coerce(type), second.coerce(type)) -} - -internal operator fun Number.compareTo(other: Number): Int { - val (first, second) = coerceNumbers(this, other) - return when (first) { - is Byte -> first.compareTo(second as Byte) - is Short -> first.compareTo(second as Short) - is Int -> first.compareTo(second as Int) - is Long -> first.compareTo(second as Long) - is Float -> first.compareTo(second as Float) - is Double -> first.compareTo(second as Double) - is BigDecimal -> first.compareTo(second as BigDecimal) - is BigInteger -> first.compareTo(second as BigInteger) - else -> throw IllegalStateException() - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 88c7f09c7e..82f0375275 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,3 @@ -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" -} /* * Copyright Amazon.com, Inc. or its affiliates. All rights reserved. * @@ -28,7 +25,6 @@ include( "partiql-plan", "partiql-planner", "partiql-spi", - "partiql-system", "partiql-types", "lib:sprout", "test:coverage-tests", diff --git a/test/partiql-randomized-tests/build.gradle b/test/partiql-randomized-tests/build.gradle index 4434bd78f8..dba6bb42c2 100644 --- a/test/partiql-randomized-tests/build.gradle +++ b/test/partiql-randomized-tests/build.gradle @@ -23,7 +23,6 @@ dependencies { testImplementation project(':partiql-parser') testImplementation project(':partiql-plan') testImplementation project(':partiql-planner') - testImplementation project(':partiql-system') testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5' testImplementation 'pl.pragmatists:JUnitParams:[1.0.0,1.1.0)' diff --git a/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt b/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt index 604825bbfd..432b7531a6 100644 --- a/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt +++ b/test/partiql-randomized-tests/src/test/kotlin/org/partiql/lang/randomized/eval/Utils.kt @@ -4,8 +4,8 @@ import org.partiql.eval.compiler.PartiQLCompiler import org.partiql.parser.PartiQLParser import org.partiql.planner.PartiQLPlanner import org.partiql.spi.catalog.Catalog +import org.partiql.spi.catalog.Session import org.partiql.spi.value.Datum -import org.partiql.system.PartiQLSessionBuilder import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental import kotlin.test.assertEquals @@ -27,7 +27,7 @@ private fun execute(query: String): PartiQLValue { val catalog = object : Catalog { override fun getName(): String = "default" } - val session = PartiQLSessionBuilder().catalog("default").catalogs(catalog).build() + val session = Session.builder().catalog("default").catalogs(catalog).build() val engine = PartiQLCompiler.builder().build() // Execute diff --git a/test/partiql-tests-runner/build.gradle.kts b/test/partiql-tests-runner/build.gradle.kts index 5ffb99c091..0755f4ccc0 100644 --- a/test/partiql-tests-runner/build.gradle.kts +++ b/test/partiql-tests-runner/build.gradle.kts @@ -29,7 +29,6 @@ dependencies { testImplementation(project(":partiql-eval")) testImplementation(project(":partiql-parser", configuration = "shadow")) testImplementation(project(":partiql-planner")) - testImplementation(project(":partiql-system")) } val tests = System.getenv()["PARTIQL_TESTS_DATA"] ?: "../partiql-tests/partiql-tests-data" diff --git a/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt b/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt index 603c5093fe..f17b322a69 100644 --- a/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt +++ b/test/partiql-tests-runner/src/test/kotlin/org/partiql/runner/executor/EvalExecutor.kt @@ -26,7 +26,6 @@ import org.partiql.spi.errors.PErrorException import org.partiql.spi.errors.PErrorListener import org.partiql.spi.errors.Severity import org.partiql.spi.value.Datum -import org.partiql.system.PartiQLSessionBuilder import org.partiql.types.PType import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental @@ -153,7 +152,7 @@ class EvalExecutor( override fun create(env: IonStruct, options: CompileType): TestExecutor { // infer catalog from conformance test `env` val catalog = infer(env.toIonElement() as StructElement) - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("default") .catalogs(catalog) .build() @@ -186,7 +185,7 @@ class EvalExecutor( */ private fun inferEnv(env: AnyElement): PType { val catalog = Catalog.builder().name("default").build() - val session = PartiQLSessionBuilder() + val session = Session.builder() .catalog("default") .catalogs(catalog) .build() From 42cc72e4111e112ef5128b5d162dfa636b5e8c0f Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 10:48:32 -0800 Subject: [PATCH 03/13] Adds a 'bare' Session implementation with the default system catalog --- partiql-spi/api/partiql-spi.api | 2 ++ .../kotlin/org/partiql/spi/catalog/Session.kt | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 4baeaffee0..3f15952735 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -241,6 +241,7 @@ public final class org/partiql/spi/catalog/Path$Companion { public abstract interface class org/partiql/spi/catalog/Session { public static final field Companion Lorg/partiql/spi/catalog/Session$Companion; + public static fun bare (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session; public static fun builder ()Lorg/partiql/spi/catalog/Session$Builder; public static fun empty ()Lorg/partiql/spi/catalog/Session; public abstract fun getCatalog ()Ljava/lang/String; @@ -265,6 +266,7 @@ public final class org/partiql/spi/catalog/Session$Builder { } public final class org/partiql/spi/catalog/Session$Companion { + public final fun bare (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session; public final fun builder ()Lorg/partiql/spi/catalog/Session$Builder; public final fun empty ()Lorg/partiql/spi/catalog/Session; } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index cd2a50358f..0a86603201 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -43,7 +43,8 @@ public interface Session { public companion object { /** - * Returns a [Session] with only the "empty" catalog implementation. + * Returns a [Session] with only the "empty" catalog implementation. Note that this does NOT add the + * PartiQL System Catalog. */ @JvmStatic public fun empty(): Session = object : Session { @@ -53,6 +54,19 @@ public interface Session { override fun getNamespace(): Namespace = Namespace.empty() } + /** + * Returns a [Session] with only the PartiQL System Catalog. Therefore, this provides PartiQL's built-in functions + * and aggregations. + * @param systemCatalogName the name to assign the system catalog + */ + @JvmStatic + public fun bare(systemCatalogName: String): Session = object : Session { + override fun getIdentity(): String = "unknown" + override fun getCatalog(): String = systemCatalogName + override fun getCatalogs(): Catalogs = Catalogs.builder().add(PartiQLSystemCatalog(systemCatalogName)).build() + override fun getNamespace(): Namespace = Namespace.empty() + } + @JvmStatic public fun builder(): Builder = Builder() } From a712fbaad6ebdec32251816b09737c44d1d2d2c9 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 16:14:54 -0800 Subject: [PATCH 04/13] Revert "Adds a 'bare' Session implementation with the default system catalog" This reverts commit 42cc72e4111e112ef5128b5d162dfa636b5e8c0f. --- partiql-spi/api/partiql-spi.api | 2 -- .../kotlin/org/partiql/spi/catalog/Session.kt | 16 +--------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 3f15952735..4baeaffee0 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -241,7 +241,6 @@ public final class org/partiql/spi/catalog/Path$Companion { public abstract interface class org/partiql/spi/catalog/Session { public static final field Companion Lorg/partiql/spi/catalog/Session$Companion; - public static fun bare (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session; public static fun builder ()Lorg/partiql/spi/catalog/Session$Builder; public static fun empty ()Lorg/partiql/spi/catalog/Session; public abstract fun getCatalog ()Ljava/lang/String; @@ -266,7 +265,6 @@ public final class org/partiql/spi/catalog/Session$Builder { } public final class org/partiql/spi/catalog/Session$Companion { - public final fun bare (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session; public final fun builder ()Lorg/partiql/spi/catalog/Session$Builder; public final fun empty ()Lorg/partiql/spi/catalog/Session; } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index 0a86603201..cd2a50358f 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -43,8 +43,7 @@ public interface Session { public companion object { /** - * Returns a [Session] with only the "empty" catalog implementation. Note that this does NOT add the - * PartiQL System Catalog. + * Returns a [Session] with only the "empty" catalog implementation. */ @JvmStatic public fun empty(): Session = object : Session { @@ -54,19 +53,6 @@ public interface Session { override fun getNamespace(): Namespace = Namespace.empty() } - /** - * Returns a [Session] with only the PartiQL System Catalog. Therefore, this provides PartiQL's built-in functions - * and aggregations. - * @param systemCatalogName the name to assign the system catalog - */ - @JvmStatic - public fun bare(systemCatalogName: String): Session = object : Session { - override fun getIdentity(): String = "unknown" - override fun getCatalog(): String = systemCatalogName - override fun getCatalogs(): Catalogs = Catalogs.builder().add(PartiQLSystemCatalog(systemCatalogName)).build() - override fun getNamespace(): Namespace = Namespace.empty() - } - @JvmStatic public fun builder(): Builder = Builder() } From c91977fb0c1e75e55eb07511299bb576dc411298 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 16:27:52 -0800 Subject: [PATCH 05/13] Adds the PartiQL System Catalog to the Session.empty() --- partiql-spi/api/partiql-spi.api | 2 ++ .../main/kotlin/org/partiql/spi/catalog/Catalog.kt | 13 +++++++++++++ .../main/kotlin/org/partiql/spi/catalog/Session.kt | 8 +++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 4baeaffee0..de49dbf141 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -70,6 +70,7 @@ public class org/partiql/spi/SourceLocations : java/util/Map { public abstract interface class org/partiql/spi/catalog/Catalog { public static final field Companion Lorg/partiql/spi/catalog/Catalog$Companion; public static fun builder ()Lorg/partiql/spi/catalog/Catalog$Builder; + public static fun empty (Ljava/lang/String;)Lorg/partiql/spi/catalog/Catalog; public abstract fun getAggregations (Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public abstract fun getFunctions (Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public abstract fun getName ()Ljava/lang/String; @@ -85,6 +86,7 @@ public final class org/partiql/spi/catalog/Catalog$Builder { public final class org/partiql/spi/catalog/Catalog$Companion { public final fun builder ()Lorg/partiql/spi/catalog/Catalog$Builder; + public final fun empty (Ljava/lang/String;)Lorg/partiql/spi/catalog/Catalog; } public final class org/partiql/spi/catalog/Catalog$DefaultImpls { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt index d7233390bb..d93832a250 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt @@ -57,6 +57,19 @@ public interface Catalog { @JvmStatic public fun builder(): Builder = Builder() + + /** + * @return an empty catalog with the given name + * @param name the catalog name + */ + @JvmStatic + public fun empty(name: String): Catalog { + return object : Catalog { + override fun getName(): String = name + override fun getTable(session: Session, name: Name): Table? = null + override fun getTable(session: Session, identifier: Identifier): Table? = null + } + } } /** diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index cd2a50358f..688410c210 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -46,11 +46,9 @@ public interface Session { * Returns a [Session] with only the "empty" catalog implementation. */ @JvmStatic - public fun empty(): Session = object : Session { - override fun getIdentity(): String = "unknown" - override fun getCatalog(): String = "empty" - override fun getCatalogs(): Catalogs = Catalogs.empty() - override fun getNamespace(): Namespace = Namespace.empty() + public fun empty(): Session { + val catalog = Catalog.empty("empty") + return builder().catalog(catalog.getName()).catalogs(catalog).build() } @JvmStatic From 05735171aef40db0090b4e2b63458e3e542eba61 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 16:29:52 -0800 Subject: [PATCH 06/13] Removes unused Catalogs.empty() public API --- partiql-spi/api/partiql-spi.api | 2 -- .../kotlin/org/partiql/spi/catalog/Catalogs.kt | 14 -------------- 2 files changed, 16 deletions(-) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index de49dbf141..c252cc4568 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -99,7 +99,6 @@ public final class org/partiql/spi/catalog/Catalog$DefaultImpls { public abstract interface class org/partiql/spi/catalog/Catalogs { public static final field Companion Lorg/partiql/spi/catalog/Catalogs$Companion; public static fun builder ()Lorg/partiql/spi/catalog/Catalogs$Builder; - public static fun empty ()Lorg/partiql/spi/catalog/Catalogs; public abstract fun getCatalog (Ljava/lang/String;Z)Lorg/partiql/spi/catalog/Catalog; public static fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Catalogs; public static fun of ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Catalogs; @@ -113,7 +112,6 @@ public final class org/partiql/spi/catalog/Catalogs$Builder { public final class org/partiql/spi/catalog/Catalogs$Companion { public final fun builder ()Lorg/partiql/spi/catalog/Catalogs$Builder; - public final fun empty ()Lorg/partiql/spi/catalog/Catalogs; public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Catalogs; public final fun of ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Catalogs; } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalogs.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalogs.kt index 72d90ed260..32426ea1cd 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalogs.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalogs.kt @@ -25,20 +25,6 @@ public interface Catalogs { return builder().apply { catalogs.forEach { add(it) } }.build() } - /** - * A catalog provider that always returns an empty catalog. - */ - @JvmStatic - public fun empty(): Catalogs = object : Catalogs { - private val EMPTY = object : Catalog { - override fun getName(): String = "empty" - override fun getTable(session: Session, name: Name): Table? = null - override fun getTable(session: Session, identifier: Identifier): Table? = null - } - - override fun getCatalog(name: String, ignoreCase: Boolean): Catalog = EMPTY - } - @JvmStatic public fun builder(): Builder = Builder() } From 531659d5c98fee2fb7958dea67cedda68a517350 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 16:57:36 -0800 Subject: [PATCH 07/13] Renames Session.Builder#systemCatalog() to system() --- partiql-spi/api/partiql-spi.api | 2 +- .../src/main/kotlin/org/partiql/spi/catalog/Session.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index c252cc4568..55098bf5f2 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -261,7 +261,7 @@ public final class org/partiql/spi/catalog/Session$Builder { public final fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/spi/catalog/Session$Builder; public final fun namespace ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; public final fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; - public final fun systemCatalog (Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Session$Builder; + public final fun system (Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Session$Builder; } public final class org/partiql/spi/catalog/Session$Companion { diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index 688410c210..4b4ec6cd1d 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -62,7 +62,7 @@ public interface Session { private var identity: String = "unknown" private var catalog: String? = null - private var systemCatalogName: String = "\$pql_system" + private var systemCatalogName: String = "\$system" private var systemCatalog: Catalog = PartiQLSystemCatalog(systemCatalogName) private var catalogs: Catalogs.Builder = Catalogs.builder() private var namespace: Namespace = Namespace.empty() @@ -103,7 +103,7 @@ public interface Session { * to the system at hand. * If this is never invoked, a default system catalog is provided. */ - public fun systemCatalog(catalog: Catalog): Builder { + public fun system(catalog: Catalog): Builder { this.systemCatalogName = catalog.getName() return this } From 628c1db50f8145315cd321fc2c8f3ca8762625d0 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Thu, 5 Dec 2024 16:59:42 -0800 Subject: [PATCH 08/13] Fixes bug where system catalog wasn't being updated by Session#system() --- .../src/main/kotlin/org/partiql/spi/catalog/Session.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index 4b4ec6cd1d..50e539f2f0 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -62,8 +62,7 @@ public interface Session { private var identity: String = "unknown" private var catalog: String? = null - private var systemCatalogName: String = "\$system" - private var systemCatalog: Catalog = PartiQLSystemCatalog(systemCatalogName) + private var systemCatalog: Catalog = PartiQLSystemCatalog("\$system") private var catalogs: Catalogs.Builder = Catalogs.builder() private var namespace: Namespace = Namespace.empty() private var properties: MutableMap = mutableMapOf() @@ -104,7 +103,7 @@ public interface Session { * If this is never invoked, a default system catalog is provided. */ public fun system(catalog: Catalog): Builder { - this.systemCatalogName = catalog.getName() + this.systemCatalog = catalog return this } @@ -121,7 +120,7 @@ public interface Session { public fun build(): Session = object : Session { private val _catalogs: Catalogs - private val systemCatalogNamespace: Namespace = Namespace.of(systemCatalogName) + private val systemCatalogNamespace: Namespace = Namespace.of(systemCatalog.getName()) init { require(catalog != null) { "Session catalog must be set" } From d1b33056d3405fdd4ee1f8dd23d20aa1144e3dd9 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Fri, 6 Dec 2024 10:43:30 -0800 Subject: [PATCH 09/13] Adds a singleton system catalog --- .../spi/catalog/PartiQLSystemCatalog.java | 16 +++++----------- .../kotlin/org/partiql/spi/catalog/Session.kt | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java b/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java index 87cc927de5..e674cf5ff8 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java +++ b/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java @@ -10,7 +10,7 @@ /** *

- * This implements the PartiQL System Catalog. + * This package-private class implements the PartiQL System Catalog. *

*

* It provides the implementation for the PartiQL System Catalog, which is a built-in catalog @@ -20,24 +20,18 @@ */ final class PartiQLSystemCatalog implements Catalog { - /** - * TODO - */ @NotNull - private final String name; + private static final String NAME = "$system"; /** - * Creates a new PartiQL System Catalog with the given name. - * @param name the name of the PartiQL System Catalog + * This is a package-private singleton. */ - PartiQLSystemCatalog(@NotNull String name) { - this.name = name; - } + static PartiQLSystemCatalog INSTANCE = new PartiQLSystemCatalog(); @NotNull @Override public String getName() { - return this.name; + return NAME; } @Nullable diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index 50e539f2f0..47cb0c5148 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -62,7 +62,7 @@ public interface Session { private var identity: String = "unknown" private var catalog: String? = null - private var systemCatalog: Catalog = PartiQLSystemCatalog("\$system") + private var systemCatalog: Catalog = PartiQLSystemCatalog.INSTANCE private var catalogs: Catalogs.Builder = Catalogs.builder() private var namespace: Namespace = Namespace.empty() private var properties: MutableMap = mutableMapOf() From 57fb8b37fff5e07714be9cb96132e56e21dc8bf1 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Mon, 9 Dec 2024 11:33:13 -0800 Subject: [PATCH 10/13] Renames PartiQLSystemCatalog to System Removes Catalog#empty() method Session#empty() no longer adds an empty catalog --- partiql-spi/api/partiql-spi.api | 2 -- .../{PartiQLSystemCatalog.java => System.java} | 4 ++-- .../main/kotlin/org/partiql/spi/catalog/Catalog.kt | 13 ------------- .../main/kotlin/org/partiql/spi/catalog/Session.kt | 11 +++++------ 4 files changed, 7 insertions(+), 23 deletions(-) rename partiql-spi/src/main/java/org/partiql/spi/catalog/{PartiQLSystemCatalog.java => System.java} (92%) diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index 55098bf5f2..c70ea606d9 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -70,7 +70,6 @@ public class org/partiql/spi/SourceLocations : java/util/Map { public abstract interface class org/partiql/spi/catalog/Catalog { public static final field Companion Lorg/partiql/spi/catalog/Catalog$Companion; public static fun builder ()Lorg/partiql/spi/catalog/Catalog$Builder; - public static fun empty (Ljava/lang/String;)Lorg/partiql/spi/catalog/Catalog; public abstract fun getAggregations (Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public abstract fun getFunctions (Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public abstract fun getName ()Ljava/lang/String; @@ -86,7 +85,6 @@ public final class org/partiql/spi/catalog/Catalog$Builder { public final class org/partiql/spi/catalog/Catalog$Companion { public final fun builder ()Lorg/partiql/spi/catalog/Catalog$Builder; - public final fun empty (Ljava/lang/String;)Lorg/partiql/spi/catalog/Catalog; } public final class org/partiql/spi/catalog/Catalog$DefaultImpls { diff --git a/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java b/partiql-spi/src/main/java/org/partiql/spi/catalog/System.java similarity index 92% rename from partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java rename to partiql-spi/src/main/java/org/partiql/spi/catalog/System.java index e674cf5ff8..5faccafe9e 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/catalog/PartiQLSystemCatalog.java +++ b/partiql-spi/src/main/java/org/partiql/spi/catalog/System.java @@ -18,7 +18,7 @@ *

* @see Session.Builder */ -final class PartiQLSystemCatalog implements Catalog { +final class System implements Catalog { @NotNull private static final String NAME = "$system"; @@ -26,7 +26,7 @@ final class PartiQLSystemCatalog implements Catalog { /** * This is a package-private singleton. */ - static PartiQLSystemCatalog INSTANCE = new PartiQLSystemCatalog(); + static System INSTANCE = new System(); @NotNull @Override diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt index d93832a250..d7233390bb 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt @@ -57,19 +57,6 @@ public interface Catalog { @JvmStatic public fun builder(): Builder = Builder() - - /** - * @return an empty catalog with the given name - * @param name the catalog name - */ - @JvmStatic - public fun empty(name: String): Catalog { - return object : Catalog { - override fun getName(): String = name - override fun getTable(session: Session, name: Name): Table? = null - override fun getTable(session: Session, identifier: Identifier): Table? = null - } - } } /** diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index 47cb0c5148..4ce68c0dc4 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -47,8 +47,7 @@ public interface Session { */ @JvmStatic public fun empty(): Session { - val catalog = Catalog.empty("empty") - return builder().catalog(catalog.getName()).catalogs(catalog).build() + return builder().catalog(System.INSTANCE.getName()).catalogs().build() } @JvmStatic @@ -62,7 +61,7 @@ public interface Session { private var identity: String = "unknown" private var catalog: String? = null - private var systemCatalog: Catalog = PartiQLSystemCatalog.INSTANCE + private var system: Catalog = System.INSTANCE private var catalogs: Catalogs.Builder = Catalogs.builder() private var namespace: Namespace = Namespace.empty() private var properties: MutableMap = mutableMapOf() @@ -103,7 +102,7 @@ public interface Session { * If this is never invoked, a default system catalog is provided. */ public fun system(catalog: Catalog): Builder { - this.systemCatalog = catalog + this.system = catalog return this } @@ -120,11 +119,11 @@ public interface Session { public fun build(): Session = object : Session { private val _catalogs: Catalogs - private val systemCatalogNamespace: Namespace = Namespace.of(systemCatalog.getName()) + private val systemCatalogNamespace: Namespace = Namespace.of(system.getName()) init { require(catalog != null) { "Session catalog must be set" } - catalogs.add(systemCatalog) + catalogs.add(system) _catalogs = catalogs.build() } From 4110b4b2a9e19c29a025b8f8f8dd9e704b7fdd6e Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Mon, 9 Dec 2024 12:01:44 -0800 Subject: [PATCH 11/13] Fixes GitHub benchmark workflow --- .github/workflows/benchmark-main.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmark-main.yml b/.github/workflows/benchmark-main.yml index e038446cbb..0e32323c76 100644 --- a/.github/workflows/benchmark-main.yml +++ b/.github/workflows/benchmark-main.yml @@ -7,10 +7,8 @@ name: JMH Benchmarks (Main) -on: - push: - branches: - - main +# TODO: Make this run on pushes to main once appropriate benchmarks have been written. +on: [workflow_dispatch] env: JMH_RESULTS_PATH_FROM_ROOT: partiql-lang/build/reports/jmh/results.json From aa2a6f27ca8610ce3c69b7e5922f48f6d2f963ba Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Mon, 9 Dec 2024 12:02:58 -0800 Subject: [PATCH 12/13] Updates Catalog#getTable to Catalog#resolveTable --- .../src/main/kotlin/org/partiql/planner/internal/Env.kt | 6 +++--- .../kotlin/org/partiql/planner/internal/TestCatalog.kt | 8 ++++++-- .../org/partiql/planner/plugins/local/LocalCatalog.kt | 5 ++--- partiql-spi/api/partiql-spi.api | 4 ++-- .../src/main/java/org/partiql/spi/catalog/System.java | 2 +- .../src/main/kotlin/org/partiql/spi/catalog/Catalog.kt | 2 +- .../org/partiql/spi/catalog/impl/StandardCatalog.kt | 9 ++++++--- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt index da8e6ed8fb..510c00d864 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/Env.kt @@ -58,12 +58,12 @@ internal class Env(private val session: Session) { // 1. Search in current catalog and namespace var catalog = default var path = resolve(identifier) - var table = catalog.getTable(session, path) + var table = catalog.resolveTable(session, path)?.let { catalog.getTable(session, it) } // 2. Lookup as a schema-qualified identifier. if (table == null && identifier.hasQualifier()) { path = identifier - table = catalog.getTable(session, path) + table = catalog.resolveTable(session, path)?.let { catalog.getTable(session, it) } } // 3. Lookup as a catalog-qualified identifier @@ -73,7 +73,7 @@ internal class Env(private val session: Session) { val tail = parts.drop(1) catalog = catalogs.getCatalog(head.getText(), ignoreCase = head.isRegular()) ?: return null path = Identifier.of(tail) - table = catalog.getTable(session, path) + table = catalog.resolveTable(session, path)?.let { catalog.getTable(session, it) } } // !! NOT FOUND !! diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt index 39075fc60b..4d91c53f73 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt @@ -20,15 +20,19 @@ public class TestCatalog private constructor( override fun getName(): String = name override fun getTable(session: Session, name: Name): Table? { + var curr: Tree = root + for (part in name) { + curr = curr.get(Identifier.delimited(part).first()) ?: break + } return null } - override fun getTable(session: Session, identifier: Identifier): Table? { + override fun resolveTable(session: Session, identifier: Identifier): Name? { var curr: Tree = root for (part in identifier) { curr = curr.get(part) ?: break } - return curr.table + return curr.table?.getName() } private class Tree( diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/plugins/local/LocalCatalog.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/plugins/local/LocalCatalog.kt index 70ecea4984..c1cd967db4 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/plugins/local/LocalCatalog.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/plugins/local/LocalCatalog.kt @@ -38,7 +38,7 @@ public class LocalCatalog internal constructor( /** * TODO this doesn't handle ambiguous binding errors or back-tracking for longest prefix searching. */ - override fun getTable(session: Session, identifier: Identifier): Table? { + override fun resolveTable(session: Session, identifier: Identifier): Name? { val matched = mutableListOf() var curr = root for (part in identifier) { @@ -62,8 +62,7 @@ public class LocalCatalog internal constructor( return null } // Remove the extension - val name = Name.of(matched) - return LocalTable(name, path) + return Name.of(matched) } // TODO preserving this logic if catalog regains the listing APIs. diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index c70ea606d9..e1d0370118 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -73,8 +73,8 @@ public abstract interface class org/partiql/spi/catalog/Catalog { public abstract fun getAggregations (Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public abstract fun getFunctions (Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public abstract fun getName ()Ljava/lang/String; - public abstract fun getTable (Lorg/partiql/spi/catalog/Session;Lorg/partiql/spi/catalog/Identifier;)Lorg/partiql/spi/catalog/Table; public abstract fun getTable (Lorg/partiql/spi/catalog/Session;Lorg/partiql/spi/catalog/Name;)Lorg/partiql/spi/catalog/Table; + public abstract fun resolveTable (Lorg/partiql/spi/catalog/Session;Lorg/partiql/spi/catalog/Identifier;)Lorg/partiql/spi/catalog/Name; } public final class org/partiql/spi/catalog/Catalog$Builder { @@ -90,8 +90,8 @@ public final class org/partiql/spi/catalog/Catalog$Companion { public final class org/partiql/spi/catalog/Catalog$DefaultImpls { public static fun getAggregations (Lorg/partiql/spi/catalog/Catalog;Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; public static fun getFunctions (Lorg/partiql/spi/catalog/Catalog;Lorg/partiql/spi/catalog/Session;Ljava/lang/String;)Ljava/util/Collection; - public static fun getTable (Lorg/partiql/spi/catalog/Catalog;Lorg/partiql/spi/catalog/Session;Lorg/partiql/spi/catalog/Identifier;)Lorg/partiql/spi/catalog/Table; public static fun getTable (Lorg/partiql/spi/catalog/Catalog;Lorg/partiql/spi/catalog/Session;Lorg/partiql/spi/catalog/Name;)Lorg/partiql/spi/catalog/Table; + public static fun resolveTable (Lorg/partiql/spi/catalog/Catalog;Lorg/partiql/spi/catalog/Session;Lorg/partiql/spi/catalog/Identifier;)Lorg/partiql/spi/catalog/Name; } public abstract interface class org/partiql/spi/catalog/Catalogs { diff --git a/partiql-spi/src/main/java/org/partiql/spi/catalog/System.java b/partiql-spi/src/main/java/org/partiql/spi/catalog/System.java index 5faccafe9e..a1a6a3b461 100644 --- a/partiql-spi/src/main/java/org/partiql/spi/catalog/System.java +++ b/partiql-spi/src/main/java/org/partiql/spi/catalog/System.java @@ -42,7 +42,7 @@ public Table getTable(@NotNull Session session, @NotNull Name name) { @Nullable @Override - public Table getTable(@NotNull Session session, @NotNull Identifier identifier) { + public Name resolveTable(@NotNull Session session, @NotNull Identifier identifier) { return null; } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt index d7233390bb..19a6bcb7eb 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Catalog.kt @@ -41,7 +41,7 @@ public interface Catalog { * 2. Invoke getTable("a"."b"."c"."Example"."x") * 3. The implementation MUST match "a"."b"."c"."Example" to a.b.c.Example (note "x" does not match a table) */ - public fun getTable(session: Session, identifier: Identifier): Table? = null + public fun resolveTable(session: Session, identifier: Identifier): Name? = null /** * Returns a collection of scalar functions in this catalog with the given name, or an empty list if none. diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt index d2f6d42b1b..76ae1547c1 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt @@ -26,14 +26,17 @@ internal class StandardCatalog( /** * TODO implement "longest match" on identifier searching. */ - override fun getTable(session: Session, identifier: Identifier): Table? { + override fun resolveTable(session: Session, identifier: Identifier): Name? { // TODO memory connector does not handle qualified identifiers and longest match + if (identifier.hasQualifier()) { + return null + } val first = identifier.first() - for ((name, table) in tables) { + for ((name, _) in tables) { val str = name.getName() // only use single identifiers for now if (first.matches(str)) { // TODO emit errors on ambiguous table names - return table + return name } } return null From 8d9ded8b1e15b691bf182f138cf6f12cc87a55d5 Mon Sep 17 00:00:00 2001 From: John Ed Quinn Date: Mon, 9 Dec 2024 12:14:40 -0800 Subject: [PATCH 13/13] Updates usages of Collection to List in partiql-spi --- .../partiql/planner/internal/TestCatalog.kt | 2 +- partiql-spi/api/partiql-spi.api | 22 +++++++++---------- .../org/partiql/spi/catalog/Identifier.kt | 8 +++---- .../kotlin/org/partiql/spi/catalog/Name.kt | 4 ++-- .../org/partiql/spi/catalog/Namespace.kt | 2 +- .../kotlin/org/partiql/spi/catalog/Session.kt | 2 +- .../spi/catalog/impl/StandardCatalog.kt | 3 --- 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt index 4d91c53f73..960c14a661 100644 --- a/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt +++ b/partiql-planner/src/test/kotlin/org/partiql/planner/internal/TestCatalog.kt @@ -24,7 +24,7 @@ public class TestCatalog private constructor( for (part in name) { curr = curr.get(Identifier.delimited(part).first()) ?: break } - return null + return curr.table } override fun resolveTable(session: Session, identifier: Identifier): Name? { diff --git a/partiql-spi/api/partiql-spi.api b/partiql-spi/api/partiql-spi.api index e1d0370118..4d308d4b52 100644 --- a/partiql-spi/api/partiql-spi.api +++ b/partiql-spi/api/partiql-spi.api @@ -124,7 +124,7 @@ public final class org/partiql/spi/catalog/Identifier : java/lang/Iterable, kotl public final fun append (Lorg/partiql/spi/catalog/Identifier;)Lorg/partiql/spi/catalog/Identifier; public final fun append ([Lorg/partiql/spi/catalog/Identifier$Part;)Lorg/partiql/spi/catalog/Identifier; public static final fun delimited (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; - public static final fun delimited (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier; + public static final fun delimited (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier; public static final fun delimited ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; public fun equals (Ljava/lang/Object;)Z public fun forEach (Ljava/util/function/Consumer;)V @@ -136,10 +136,10 @@ public final class org/partiql/spi/catalog/Identifier : java/lang/Iterable, kotl public fun iterator ()Ljava/util/Iterator; public final fun matches (Ljava/lang/String;Z)Z public static synthetic fun matches$default (Lorg/partiql/spi/catalog/Identifier;Ljava/lang/String;ZILjava/lang/Object;)Z - public static final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier; + public static final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier; public static final fun of ([Lorg/partiql/spi/catalog/Identifier$Part;)Lorg/partiql/spi/catalog/Identifier; public static final fun regular (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; - public static final fun regular (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier; + public static final fun regular (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier; public static final fun regular ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; public fun spliterator ()Ljava/util/Spliterator; public fun toString ()Ljava/lang/String; @@ -147,12 +147,12 @@ public final class org/partiql/spi/catalog/Identifier : java/lang/Iterable, kotl public final class org/partiql/spi/catalog/Identifier$Companion { public final fun delimited (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; - public final fun delimited (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier; + public final fun delimited (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier; public final fun delimited ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; - public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier; + public final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier; public final fun of ([Lorg/partiql/spi/catalog/Identifier$Part;)Lorg/partiql/spi/catalog/Identifier; public final fun regular (Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; - public final fun regular (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Identifier; + public final fun regular (Ljava/util/List;)Lorg/partiql/spi/catalog/Identifier; public final fun regular ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Identifier; } @@ -184,14 +184,14 @@ public final class org/partiql/spi/catalog/Name : java/lang/Iterable, kotlin/jvm public final fun hasNamespace ()Z public fun hashCode ()I public fun iterator ()Ljava/util/Iterator; - public static final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Name; + public static final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Name; public static final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Name; public fun spliterator ()Ljava/util/Spliterator; public fun toString ()Ljava/lang/String; } public final class org/partiql/spi/catalog/Name$Companion { - public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Name; + public final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Name; public final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Name; } @@ -208,7 +208,7 @@ public final class org/partiql/spi/catalog/Namespace : java/lang/Iterable, kotli public fun hashCode ()I public final fun isEmpty ()Z public fun iterator ()Ljava/util/Iterator; - public static final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Namespace; + public static final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Namespace; public static final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace; public fun spliterator ()Ljava/util/Spliterator; public fun toString ()Ljava/lang/String; @@ -216,7 +216,7 @@ public final class org/partiql/spi/catalog/Namespace : java/lang/Iterable, kotli public final class org/partiql/spi/catalog/Namespace$Companion { public final fun empty ()Lorg/partiql/spi/catalog/Namespace; - public final fun of (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Namespace; + public final fun of (Ljava/util/List;)Lorg/partiql/spi/catalog/Namespace; public final fun of ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Namespace; } @@ -255,7 +255,7 @@ public final class org/partiql/spi/catalog/Session$Builder { public final fun catalog (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; public final fun catalogs ([Lorg/partiql/spi/catalog/Catalog;)Lorg/partiql/spi/catalog/Session$Builder; public final fun identity (Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; - public final fun namespace (Ljava/util/Collection;)Lorg/partiql/spi/catalog/Session$Builder; + public final fun namespace (Ljava/util/List;)Lorg/partiql/spi/catalog/Session$Builder; public final fun namespace (Lorg/partiql/spi/catalog/Namespace;)Lorg/partiql/spi/catalog/Session$Builder; public final fun namespace ([Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; public final fun property (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/spi/catalog/Session$Builder; diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Identifier.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Identifier.kt index fd9c7a93dc..bacba281e4 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Identifier.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Identifier.kt @@ -30,7 +30,7 @@ public class Identifier private constructor( public fun hasQualifier(): Boolean = qualifier.isNotEmpty() /** - * Returns a collection of the identifier parts. + * Returns an ordered collection of the identifier parts. */ public fun getParts(): List { return listOf(*qualifier) + identifier @@ -195,7 +195,7 @@ public class Identifier private constructor( public fun regular(vararg parts: String): Identifier = regular(parts.toList()) @JvmStatic - public fun regular(parts: Collection): Identifier { + public fun regular(parts: List): Identifier { if (parts.isEmpty()) { error("Cannot create an identifier with no parts") } @@ -211,7 +211,7 @@ public class Identifier private constructor( public fun delimited(vararg parts: String): Identifier = delimited(parts.toList()) @JvmStatic - public fun delimited(parts: Collection): Identifier { + public fun delimited(parts: List): Identifier { if (parts.isEmpty()) { error("Cannot create an identifier with no parts") } @@ -224,7 +224,7 @@ public class Identifier private constructor( public fun of(vararg parts: Part): Identifier = of(parts.toList()) @JvmStatic - public fun of(parts: Collection): Identifier { + public fun of(parts: List): Identifier { if (parts.isEmpty()) { error("Cannot create an identifier with no parts") } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Name.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Name.kt index a089be9f13..5611efd44e 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Name.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Name.kt @@ -88,10 +88,10 @@ public class Name( public fun of(vararg names: String): Name = of(names.toList()) /** - * Construct a name from a collection of strings. + * Construct a name from an ordered collection of strings. */ @JvmStatic - public fun of(names: Collection): Name { + public fun of(names: List): Name { assert(names.size > 0) { "Cannot create an empty name" } val namespace = Namespace.of(names.take(names.size - 1)) val name = names.last() diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt index 170bf5b989..ee09c06759 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Namespace.kt @@ -92,7 +92,7 @@ public class Namespace private constructor( } @JvmStatic - public fun of(levels: Collection): Namespace { + public fun of(levels: List): Namespace { if (levels.isEmpty()) { return empty() } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt index 4ce68c0dc4..42c633bdc7 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/Session.kt @@ -86,7 +86,7 @@ public interface Session { return this } - public fun namespace(levels: Collection): Builder { + public fun namespace(levels: List): Builder { this.namespace = Namespace.of(levels) return this } diff --git a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt index 76ae1547c1..83a43763ca 100644 --- a/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt +++ b/partiql-spi/src/main/kotlin/org/partiql/spi/catalog/impl/StandardCatalog.kt @@ -28,9 +28,6 @@ internal class StandardCatalog( */ override fun resolveTable(session: Session, identifier: Identifier): Name? { // TODO memory connector does not handle qualified identifiers and longest match - if (identifier.hasQualifier()) { - return null - } val first = identifier.first() for ((name, _) in tables) { val str = name.getName() // only use single identifiers for now