From e51c035e76d469cd638660d6f9bacf63c3b90289 Mon Sep 17 00:00:00 2001 From: "R. C. Howell" Date: Fri, 20 Oct 2023 09:35:30 -0700 Subject: [PATCH] Address PR comments --- .../kotlin/org/partiql/ast/normalize/NormalizeTest.kt | 10 ---------- .../src/main/kotlin/org/partiql/planner/Env.kt | 3 --- .../main/kotlin/org/partiql/planner/typer/PlanTyper.kt | 4 ++-- .../org/partiql/types/function/FunctionSignature.kt | 5 +++-- 4 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 partiql-ast/src/test/kotlin/org/partiql/ast/normalize/NormalizeTest.kt diff --git a/partiql-ast/src/test/kotlin/org/partiql/ast/normalize/NormalizeTest.kt b/partiql-ast/src/test/kotlin/org/partiql/ast/normalize/NormalizeTest.kt deleted file mode 100644 index 566e3669ee..0000000000 --- a/partiql-ast/src/test/kotlin/org/partiql/ast/normalize/NormalizeTest.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.partiql.ast.normalize - -import org.junit.jupiter.api.Test - -class NormalizeTest { - - @Test - fun normalize() { - } -} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/Env.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/Env.kt index e64a59a827..64d66a4052 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/Env.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/Env.kt @@ -11,7 +11,6 @@ import org.partiql.plan.identifierQualified import org.partiql.plan.identifierSymbol import org.partiql.planner.typer.FunctionResolver import org.partiql.planner.typer.Mapping -import org.partiql.planner.typer.isNullOrMissing import org.partiql.planner.typer.toRuntimeType import org.partiql.spi.BindingCase import org.partiql.spi.BindingName @@ -204,7 +203,6 @@ internal class Env( if (!hadMissingArg && arg.type.isMissable()) { hadMissingArg = true } - arg.type.isNullOrMissing() FunctionParameter("arg-$i", arg.type.toRuntimeType()) } val match = functionResolver.match(candidates, parameters) @@ -227,7 +225,6 @@ internal class Env( if (!hadMissingArg && arg.type.isMissable()) { hadMissingArg = true } - arg.type.isNullOrMissing() FunctionParameter("arg-$i", arg.type.toRuntimeType()) } val match = functionResolver.match(candidates, parameters) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/typer/PlanTyper.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/typer/PlanTyper.kt index 369dcf5474..a0601f89c8 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/typer/PlanTyper.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/typer/PlanTyper.kt @@ -795,7 +795,7 @@ internal class PlanTyper( var missingArg = false val args = arguments.map { val arg = visitRex(it, null) - if (arg.type == MissingType) missingArg = true + if (arg.type.isMissable()) missingArg = true arg } @@ -821,7 +821,7 @@ internal class PlanTyper( // Some operators can return MISSING during runtime if (match.isMissable) { - type = StaticType.unionOf(type, StaticType.MISSING) + type = StaticType.unionOf(type, StaticType.MISSING).flatten() } // Finally, rewrite this node diff --git a/partiql-types/src/main/kotlin/org/partiql/types/function/FunctionSignature.kt b/partiql-types/src/main/kotlin/org/partiql/types/function/FunctionSignature.kt index 93922d5c5b..89839c5edd 100644 --- a/partiql-types/src/main/kotlin/org/partiql/types/function/FunctionSignature.kt +++ b/partiql-types/src/main/kotlin/org/partiql/types/function/FunctionSignature.kt @@ -113,7 +113,8 @@ public sealed class FunctionSignature( other.name != name || other.returns != returns || other.parameters.size != parameters.size || - other.isDecomposable != isDecomposable + other.isDecomposable != isDecomposable || + other.isNullable != isNullable ) { return false } @@ -131,12 +132,12 @@ public sealed class FunctionSignature( result = 31 * result + returns.hashCode() result = 31 * result + parameters.hashCode() result = 31 * result + isDecomposable.hashCode() + result = 31 * result + isNullable.hashCode() result = 31 * result + (description?.hashCode() ?: 0) return result } } - // // Logic for writing a [FunctionSignature] using SQL `CREATE FUNCTION` syntax. // // /**