Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yliuuuu committed Jan 24, 2024
1 parent 7ef78e3 commit c50fde3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface PartiQLEngine {
}

public class Session @OptIn(PartiQLFunctionExperimental::class) constructor(
var bindings: MutableMap<String, ConnectorBindings> = mutableMapOf(),
val functions: MutableMap<String, List<PartiQLFunction>> = mutableMapOf()
val bindings: Map<String, ConnectorBindings> = mapOf(),
val functions: Map<String, List<PartiQLFunction>> = mapOf()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,11 @@ internal class Compiler(
val args = node.args.map { visitRex(it, ctx) }
val matches = session.functions
.flatMap { it.value }
.filterIsInstance<PartiQLFunction.Scalar>()
.filter { it.signature == fn }
return when (matches.size) {
0 -> error("no match")
1 -> {
when (val call = matches.first()) {
is PartiQLFunction.Aggregation -> error("expect scalar func")
is PartiQLFunction.Scalar -> ExprCall(call, args.toTypedArray())
}
}
1 -> ExprCall(matches.first(), args.toTypedArray())
else -> error("multiple math")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import org.partiql.spi.connector.ConnectorMetadata
import org.partiql.spi.connector.ConnectorObjectHandle
import org.partiql.spi.connector.ConnectorObjectPath
import org.partiql.spi.connector.ConnectorSession
import org.partiql.types.AnyType
import org.partiql.types.StaticType
import org.partiql.value.PartiQLValueExperimental
import org.partiql.value.stringValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TestRunner<T, V>(private val factory: TestExecutor.Factory<T, V>) {
}
} catch (e: Exception) {
when (case.assertion) {
is Assertion.EvaluationSuccess -> error("Expected success but exception thrown: $e}")
is Assertion.EvaluationSuccess -> error("Expected success but exception thrown: $e")
is Assertion.EvaluationFailure -> {} // skip
}
}
Expand Down

0 comments on commit c50fde3

Please sign in to comment.