From 546a12673c52ae70cdb2b6bfc5361451485d2680 Mon Sep 17 00:00:00 2001 From: Alan Cai Date: Mon, 19 Aug 2024 15:41:02 -0700 Subject: [PATCH] Prepare 0.14.8 release (#1554) --- CHANGELOG.md | 5 +++-- README.md | 2 +- gradle.properties | 2 +- .../org/partiql/planner/internal/typer/DynamicTyper.kt | 7 ++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f70917b66..d0114311ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Thank you to all who have contributed! --> -## [Unreleased] +## [0.14.8] ### Added @@ -1110,7 +1110,8 @@ breaking changes if migrating from v0.9.2. The breaking changes accidentally int ### Added Initial alpha release of PartiQL. -[Unreleased]: https://github.com/partiql/partiql-lang-kotlin/compare/v0.14.7...HEAD +[Unreleased]: https://github.com/partiql/partiql-lang-kotlin/compare/v0.14.8...HEAD +[0.14.8]: https://github.com/partiql/partiql-lang-kotlin/compare/v0.14.7...v0.14.8 [0.14.7]: https://github.com/partiql/partiql-lang-kotlin/compare/v0.14.6...v0.14.7 [0.14.6]: https://github.com/partiql/partiql-lang-kotlin/compare/v0.14.5...v0.14.6 [0.14.5]: https://github.com/partiql/partiql-lang-kotlin/compare/v0.14.4...v0.14.5 diff --git a/README.md b/README.md index 26eccb7741..600935af0b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ This project is published to [Maven Central](https://search.maven.org/artifact/o | Group ID | Artifact ID | Recommended Version | |---------------|-----------------------|---------------------| -| `org.partiql` | `partiql-lang-kotlin` | `0.14.6` | +| `org.partiql` | `partiql-lang-kotlin` | `0.14.8` | For Maven builds, add the following to your `pom.xml`: diff --git a/gradle.properties b/gradle.properties index 754e1d1405..7a87976b37 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=org.partiql -version=0.14.8-SNAPSHOT +version=0.14.8 ossrhUsername=EMPTY ossrhPassword=EMPTY diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt index 7ea045e565..2e3dfb8422 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/DynamicTyper.kt @@ -142,7 +142,7 @@ internal class DynamicTyper { // If a collection, then return union of all accumulated types as these coercion rules are not defined by SQL. STRUCT, BAG, LIST, SEXP -> return StaticType.unionOf(types + modifiers) to null DECIMAL -> { - val type = computeDecimal() + val type = computeConstrainedDecimal() // coercion required. fall back if (type == null) superT else return StaticType.unionOf(setOf(type) + modifiers).flatten() to null } @@ -163,10 +163,11 @@ internal class DynamicTyper { } } - private fun computeDecimal(): DecimalType? { + private fun computeConstrainedDecimal(): DecimalType? { val (precision, scale) = types.fold((0 to 0)) { acc, staticType -> val decimalType = staticType as? DecimalType ?: return null - val constr = decimalType.precisionScaleConstraint as DecimalType.PrecisionScaleConstraint.Constrained + val constr = decimalType.precisionScaleConstraint as? DecimalType.PrecisionScaleConstraint.Constrained + ?: throw IllegalStateException("Expected a constrained decimal type") val precision = max(constr.precision, acc.first) val scale = max(constr.scale, acc.second) precision to scale