Skip to content

Commit

Permalink
Fixes conformance failures
Browse files Browse the repository at this point in the history
Replaces creation of a DECIMAL_ARBITRARY with DECIMAL

Fixes null-call of equals function
  • Loading branch information
johnedquinn committed Nov 19, 2024
1 parent 6a4b3e2 commit d56bc85
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 127 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal object FnEq : Function {
"eq",
args,
boolType,
isNullCall = false,
isNullCall = true,
isMissingCall = false
) {
override fun invoke(args: Array<Datum>): Datum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public abstract class IntValue : NumericValue<BigInteger>() {
@PartiQLValueExperimental
public abstract class DecimalValue : NumericValue<BigDecimal>() {

override val type: PartiQLValueType = PartiQLValueType.DECIMAL_ARBITRARY
override val type: PartiQLValueType = PartiQLValueType.DECIMAL

abstract override fun copy(annotations: Annotations): DecimalValue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ internal class PartiQLValueIonReader(
val map = mutableMapOf<String, Any?>()
checkRequiredFieldNameAndPut(reader, map, "hour", PartiQLValueType.INT)
checkRequiredFieldNameAndPut(reader, map, "minute", PartiQLValueType.INT)
checkRequiredFieldNameAndPut(reader, map, "second", PartiQLValueType.DECIMAL_ARBITRARY)
checkRequiredFieldNameAndPut(reader, map, "second", PartiQLValueType.DECIMAL)
checkOptionalFieldNameAndPut(reader, map, "offset", PartiQLValueType.INT)
// check remaining
if (reader.next() != null) {
Expand Down Expand Up @@ -464,7 +464,7 @@ internal class PartiQLValueIonReader(
checkRequiredFieldNameAndPut(reader, map, "day", PartiQLValueType.INT)
checkRequiredFieldNameAndPut(reader, map, "hour", PartiQLValueType.INT)
checkRequiredFieldNameAndPut(reader, map, "minute", PartiQLValueType.INT)
checkRequiredFieldNameAndPut(reader, map, "second", PartiQLValueType.DECIMAL_ARBITRARY)
checkRequiredFieldNameAndPut(reader, map, "second", PartiQLValueType.DECIMAL)
// check remaining
if (reader.next() != null) {
throw IllegalArgumentException("excess field in struct")
Expand Down Expand Up @@ -535,7 +535,7 @@ internal class PartiQLValueIonReader(
val v = fromIon(reader)
when (expectedType) {
PartiQLValueType.INT -> destination[k] = (v as IntValue).value?.intValueExact()
PartiQLValueType.DECIMAL_ARBITRARY -> destination[k] = (v as DecimalValue).value
PartiQLValueType.DECIMAL_ARBITRARY, PartiQLValueType.DECIMAL -> destination[k] = (v as DecimalValue).value
else -> throw IllegalArgumentException("$expectedField should be either INT OR DECIMAL")
}
} else {
Expand Down

0 comments on commit d56bc85

Please sign in to comment.