Skip to content

Commit

Permalink
Fixes CASE-WHEN conformance tests
Browse files Browse the repository at this point in the history
Handles permissive mode in branch condition
  • Loading branch information
johnedquinn committed Jul 11, 2024
1 parent 7ed91d2 commit 9021bd3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ internal class Compiler(

override fun visitRexOpCase(node: Rex.Op.Case, ctx: PType?): Operator {
val branches = node.branches.map { branch ->
visitRex(branch.condition, ctx) to visitRex(branch.rex, ctx)
visitRex(branch.condition, ctx).modeHandled() to visitRex(branch.rex, ctx)
}
val default = visitRex(node.default, ctx)
return ExprCase(branches, default)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.partiql.eval.internal.operator.rex

import org.partiql.errors.TypeCheckException
import org.partiql.eval.internal.Environment
import org.partiql.eval.internal.operator.Operator
import org.partiql.eval.value.Datum
Expand All @@ -23,6 +24,7 @@ internal class ExprCallStatic(
val args = inputs.map { input ->
val r = input.eval(env)
if (r.isNull && fn.signature.isNullCall) return nil.invoke()
if (r.isMissing && fn.signature.isMissingCall) throw TypeCheckException()
r.toPartiQLValue()
}.toTypedArray()
return Datum.of(fn.invoke(args))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ class PartiQLEngineDefaultTest {
}

@Test
@Disabled
fun developmentTest() {
val tc = SuccessTestCase(
input = """
Expand Down

0 comments on commit 9021bd3

Please sign in to comment.