Skip to content

Commit

Permalink
Fix failing conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Nov 19, 2024
1 parent 9ccfe60 commit af7f6d5
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import org.partiql.value.decimalValue
import org.partiql.value.float64Value
import org.partiql.value.int32Value
import org.partiql.value.int64Value
import org.partiql.value.intValue
import org.partiql.value.io.PartiQLValueIonReaderBuilder
import org.partiql.value.missingValue
import org.partiql.value.nullValue
Expand Down Expand Up @@ -158,10 +159,16 @@ internal object RexConverter {
is LiteralNull, is LiteralMissing -> PType.unknown()
is LiteralString -> PType.string()
is LiteralBool -> PType.bool()
is LiteralDecimal -> PType.decimal(this.value.precision(), this.value.scale())
is LiteralDecimal -> {
if (this.value.scale() == 0) {
PType.numeric()
} else {
PType.decimal(this.value.precision(), this.value.scale())
}
}
is LiteralInt -> PType.integer()
is LiteralLong -> PType.bigint()
is LiteralDouble -> PType.real()
is LiteralDouble -> PType.doublePrecision()
is LiteralTypedString -> {
val type = this.type
when (type.code()) {
Expand Down Expand Up @@ -199,7 +206,13 @@ internal object RexConverter {
is LiteralMissing -> missingValue()
is LiteralString -> stringValue(value)
is LiteralBool -> boolValue(value)
is LiteralDecimal -> decimalValue(this.value)
is LiteralDecimal -> {
if (this.value.scale() == 0) {
intValue(this.value.toBigInteger())
} else {
decimalValue(this.value)
}
}
is LiteralInt -> int32Value(this.value)
is LiteralLong -> int64Value(this.value)
is LiteralDouble -> float64Value(this.value)
Expand Down

0 comments on commit af7f6d5

Please sign in to comment.