From d37369e8e81a7456b99545455882812332938740 Mon Sep 17 00:00:00 2001 From: "R. C. Howell" Date: Fri, 19 Jan 2024 10:37:01 -0800 Subject: [PATCH] Generate internalized planning IR (#1339) --- partiql-planner/build.gradle.kts | 51 + .../partiql/planner/PartiQLPlannerDefault.kt | 2 - .../org/partiql/planner/internal/ir/Nodes.kt | 647 ++---- .../org/partiql/planner/internal/ir/Plan.kt | 182 -- .../internal/ir/builder/PlanBuilder.kt | 568 ----- .../internal/ir/builder/PlanBuilders.kt | 846 ------- .../planner/internal/ir/util/PlanRewriter.kt | 606 ----- .../internal/ir/visitor/PlanBaseVisitor.kt | 273 --- .../internal/ir/visitor/PlanVisitor.kt | 153 -- .../src/main/resources/builtins.sql | 1681 -------------- partiql-planner/src/main/resources/casts.sql | 1982 ---------------- .../src/main/resources/operators.sql | 2031 ----------------- .../main/resources/partiql_plan_internal.ion | 342 +++ 13 files changed, 639 insertions(+), 8725 deletions(-) delete mode 100644 partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Plan.kt delete mode 100644 partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilder.kt delete mode 100644 partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilders.kt delete mode 100644 partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/util/PlanRewriter.kt delete mode 100644 partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanBaseVisitor.kt delete mode 100644 partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanVisitor.kt delete mode 100644 partiql-planner/src/main/resources/builtins.sql delete mode 100644 partiql-planner/src/main/resources/casts.sql delete mode 100644 partiql-planner/src/main/resources/operators.sql create mode 100644 partiql-planner/src/main/resources/partiql_plan_internal.ion diff --git a/partiql-planner/build.gradle.kts b/partiql-planner/build.gradle.kts index aca57c651..f43b9a660 100644 --- a/partiql-planner/build.gradle.kts +++ b/partiql-planner/build.gradle.kts @@ -77,3 +77,54 @@ publish { name = "PartiQL Planner" description = "PartiQL's Experimental Planner." } + +// Generate internal IR +tasks.register("codegen") { + dependsOn(":lib:sprout:install") + workingDir(projectDir) + commandLine( + "../lib/sprout/build/install/sprout/bin/sprout", + "generate", + "kotlin", + "-o", "$buildDir/tmp", + "-p", "org.partiql.planner.internal.ir", + "-u", "Plan", + "--poems", "factory", + "--poems", "visitor", + "--poems", "builder", + "--poems", "util", + "--opt-in", "org.partiql.value.PartiQLValueExperimental", + "./src/main/resources/partiql_plan_internal.ion" + ) +} + +// Copy generated utilities to generated-src +tasks.register("copyUtils") { + includeEmptyDirs = false + dependsOn("codegen") + filter { it.replace(Regex("public (?!(override|(fun visit)))"), "internal ") } + from("$buildDir/tmp") + exclude("**/Nodes.kt") + into("$buildDir/generated-src") +} + +// Copy generated Nodes.kt to src +// +// !! IMPORTANT !! — only run manually, as this will overwrite the existing ir/Nodes.kt. +// +tasks.register("copyNodes") { + includeEmptyDirs = false + dependsOn("codegen") + filter { it.replace(Regex("public (?!(override|(fun visit)))"), "internal ") } + from("$buildDir/tmp") + include("**/Nodes.kt") + into("src/main/kotlin") +} + +tasks.register("generate") { + dependsOn("codegen", "copyUtils") +} + +tasks.compileKotlin { + dependsOn("generate") +} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerDefault.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerDefault.kt index 19c728f06..3b8314e7f 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerDefault.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLPlannerDefault.kt @@ -4,7 +4,6 @@ import org.partiql.ast.Statement import org.partiql.ast.normalize.normalize import org.partiql.errors.ProblemCallback import org.partiql.planner.internal.Env -import org.partiql.planner.internal.ir.PartiQLVersion import org.partiql.planner.internal.transforms.AstToPlan import org.partiql.planner.internal.transforms.PlanTransform import org.partiql.planner.internal.typer.PlanTyper @@ -34,7 +33,6 @@ internal class PartiQLPlannerDefault( // 3. Resolve variables val typer = PlanTyper(env, onProblem) val internal = org.partiql.planner.internal.ir.PartiQLPlan( - version = PartiQLVersion.VERSION_0_1, catalogs = env.catalogs, statement = typer.resolve(root), ) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt index 0d23c2a5c..0d444cb34 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Nodes.kt @@ -1,6 +1,13 @@ +/** + * !! IMPORTANT !! + * + * This file is generated by `./gradlew :partiql-planner:copyNodes`. The command will overwrite this file, so any + * further modifications should be restored. We copy this file from build/tmp to src/main in order to manually + * override certain node implementations for equals and hashcode. + */ @file:OptIn(PartiQLValueExperimental::class) -package org.partiql.planner.internal.ir +package org.partiql.planner.`internal`.ir import org.partiql.planner.internal.ir.builder.AggResolvedBuilder import org.partiql.planner.internal.ir.builder.AggUnresolvedBuilder @@ -77,22 +84,17 @@ internal abstract class PlanNode { } internal data class PartiQLPlan( - @JvmField - internal val version: PartiQLVersion, - @JvmField - internal val catalogs: List, - @JvmField - internal val statement: Statement, + @JvmField internal val catalogs: List, + @JvmField internal val statement: Statement, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(catalogs) kids.add(statement) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitPartiQLPlan(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitPartiQLPlan(this, ctx) internal companion object { @JvmStatic @@ -101,41 +103,32 @@ internal data class PartiQLPlan( } internal data class Catalog( - @JvmField - internal val name: String, - @JvmField - internal val symbols: List, + @JvmField internal val name: String, + @JvmField internal val symbols: List, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(symbols) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitCatalog(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitCatalog(this, ctx) internal data class Symbol( - @JvmField - internal val path: List, - @JvmField - internal val type: StaticType, + @JvmField internal val path: List, + @JvmField internal val type: StaticType, ) : PlanNode() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitCatalogSymbol(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitCatalogSymbol(this, ctx) internal data class Ref( - @JvmField - internal val catalog: Int, - @JvmField - internal val symbol: Int, + @JvmField internal val catalog: Int, + @JvmField internal val symbol: Int, ) : PlanNode() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitCatalogSymbolRef(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitCatalogSymbolRef(this, ctx) internal companion object { @JvmStatic @@ -156,19 +149,17 @@ internal data class Catalog( } internal sealed class Fn : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Resolved -> visitor.visitFnResolved(this, ctx) is Unresolved -> visitor.visitFnUnresolved(this, ctx) } internal data class Resolved( - @JvmField - internal val signature: FunctionSignature.Scalar, + @JvmField internal val signature: FunctionSignature.Scalar, ) : Fn() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitFnResolved(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitFnResolved(this, ctx) internal companion object { @JvmStatic @@ -177,19 +168,16 @@ internal sealed class Fn : PlanNode() { } internal data class Unresolved( - @JvmField - internal val identifier: Identifier, - @JvmField - internal val isHidden: Boolean, + @JvmField internal val identifier: Identifier, + @JvmField internal val isHidden: Boolean, ) : Fn() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(identifier) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitFnUnresolved(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitFnUnresolved(this, ctx) internal companion object { @JvmStatic @@ -199,19 +187,17 @@ internal sealed class Fn : PlanNode() { } internal sealed class Agg : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Resolved -> visitor.visitAggResolved(this, ctx) is Unresolved -> visitor.visitAggUnresolved(this, ctx) } internal data class Resolved( - @JvmField - internal val signature: FunctionSignature.Aggregation, + @JvmField internal val signature: FunctionSignature.Aggregation, ) : Agg() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitAggResolved(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitAggResolved(this, ctx) internal companion object { @JvmStatic @@ -220,17 +206,15 @@ internal sealed class Agg : PlanNode() { } internal data class Unresolved( - @JvmField - internal val identifier: Identifier, + @JvmField internal val identifier: Identifier, ) : Agg() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(identifier) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitAggUnresolved(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitAggUnresolved(this, ctx) internal companion object { @JvmStatic @@ -240,22 +224,20 @@ internal sealed class Agg : PlanNode() { } internal sealed class Statement : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Query -> visitor.visitStatementQuery(this, ctx) } internal data class Query( - @JvmField - internal val root: Rex, + @JvmField internal val root: Rex, ) : Statement() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(root) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitStatementQuery(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitStatementQuery(this, ctx) internal companion object { @JvmStatic @@ -265,26 +247,22 @@ internal sealed class Statement : PlanNode() { } internal sealed class Identifier : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Symbol -> visitor.visitIdentifierSymbol(this, ctx) is Qualified -> visitor.visitIdentifierQualified(this, ctx) } internal enum class CaseSensitivity { - SENSITIVE, - INSENSITIVE, + SENSITIVE, INSENSITIVE, } internal data class Symbol( - @JvmField - internal val symbol: String, - @JvmField - internal val caseSensitivity: CaseSensitivity, + @JvmField internal val symbol: String, + @JvmField internal val caseSensitivity: CaseSensitivity, ) : Identifier() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitIdentifierSymbol(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitIdentifierSymbol(this, ctx) internal companion object { @JvmStatic @@ -293,20 +271,17 @@ internal sealed class Identifier : PlanNode() { } internal data class Qualified( - @JvmField - internal val root: Symbol, - @JvmField - internal val steps: List, + @JvmField internal val root: Symbol, + @JvmField internal val steps: List, ) : Identifier() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(root) kids.addAll(steps) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitIdentifierQualified(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitIdentifierQualified(this, ctx) internal companion object { @JvmStatic @@ -316,24 +291,21 @@ internal sealed class Identifier : PlanNode() { } internal data class Rex( - @JvmField - internal val type: StaticType, - @JvmField - internal val op: Op, + @JvmField internal val type: StaticType, + @JvmField internal val op: Op, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(op) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRex( - this, - ctx + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRex( + this, ctx ) internal sealed class Op : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Lit -> visitor.visitRexOpLit(this, ctx) is Var -> visitor.visitRexOpVar(this, ctx) is Global -> visitor.visitRexOpGlobal(this, ctx) @@ -350,13 +322,11 @@ internal data class Rex( } internal data class Lit( - @JvmField - internal val `value`: PartiQLValue, + @JvmField internal val `value`: PartiQLValue, ) : Op() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpLit(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpLit(this, ctx) internal companion object { @JvmStatic @@ -365,23 +335,21 @@ internal data class Rex( } internal sealed class Var : Op() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Resolved -> visitor.visitRexOpVarResolved(this, ctx) is Unresolved -> visitor.visitRexOpVarUnresolved(this, ctx) } internal enum class Scope { - DEFAULT, - LOCAL, + DEFAULT, LOCAL, } internal data class Resolved( - @JvmField - internal val ref: Int, + @JvmField internal val ref: Int, ) : Var() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpVarResolved(this, ctx) internal companion object { @@ -391,18 +359,16 @@ internal data class Rex( } internal data class Unresolved( - @JvmField - internal val identifier: Identifier, - @JvmField - internal val scope: Scope, + @JvmField internal val identifier: Identifier, + @JvmField internal val scope: Scope, ) : Var() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(identifier) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpVarUnresolved(this, ctx) internal companion object { @@ -413,17 +379,15 @@ internal data class Rex( } internal data class Global( - @JvmField - internal val ref: Catalog.Symbol.Ref, + @JvmField internal val ref: Catalog.Symbol.Ref, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(ref) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpGlobal(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpGlobal(this, ctx) internal companion object { @JvmStatic @@ -432,26 +396,24 @@ internal data class Rex( } internal sealed class Path : Op() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Index -> visitor.visitRexOpPathIndex(this, ctx) is Key -> visitor.visitRexOpPathKey(this, ctx) is Symbol -> visitor.visitRexOpPathSymbol(this, ctx) } internal data class Index( - @JvmField - internal val root: Rex, - @JvmField - internal val key: Rex, + @JvmField internal val root: Rex, + @JvmField internal val key: Rex, ) : Path() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(root) kids.add(key) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpPathIndex(this, ctx) internal companion object { @@ -461,40 +423,35 @@ internal data class Rex( } internal data class Key( - @JvmField - internal val root: Rex, - @JvmField - internal val key: Rex, + @JvmField internal val root: Rex, + @JvmField internal val key: Rex, ) : Path() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(root) kids.add(key) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpPathKey(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpPathKey(this, ctx) internal companion object { @JvmStatic - fun builder(): RexOpPathKeyBuilder = RexOpPathKeyBuilder() + internal fun builder(): RexOpPathKeyBuilder = RexOpPathKeyBuilder() } } internal data class Symbol( - @JvmField - internal val root: Rex, - @JvmField - internal val key: String, + @JvmField internal val root: Rex, + @JvmField internal val key: String, ) : Path() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(root) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpPathSymbol(this, ctx) internal companion object { @@ -505,25 +462,23 @@ internal data class Rex( } internal sealed class Call : Op() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Static -> visitor.visitRexOpCallStatic(this, ctx) is Dynamic -> visitor.visitRexOpCallDynamic(this, ctx) } internal data class Static( - @JvmField - internal val fn: Fn, - @JvmField - internal val args: List, + @JvmField internal val fn: Fn, + @JvmField internal val args: List, ) : Call() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(fn) kids.addAll(args) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpCallStatic(this, ctx) internal companion object { @@ -533,41 +488,36 @@ internal data class Rex( } internal data class Dynamic( - @JvmField - internal val args: List, - @JvmField - internal val candidates: List, + @JvmField internal val args: List, + @JvmField internal val candidates: List, ) : Call() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(args) kids.addAll(candidates) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpCallDynamic(this, ctx) internal data class Candidate( - @JvmField - internal val fn: Fn.Resolved, - @JvmField - internal val coercions: List, + @JvmField internal val fn: Fn, + @JvmField internal val coercions: List, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(fn) kids.addAll(coercions) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpCallDynamicCandidate(this, ctx) internal companion object { @JvmStatic - internal fun builder(): RexOpCallDynamicCandidateBuilder = - RexOpCallDynamicCandidateBuilder() + internal fun builder(): RexOpCallDynamicCandidateBuilder = RexOpCallDynamicCandidateBuilder() } } @@ -579,35 +529,30 @@ internal data class Rex( } internal data class Case( - @JvmField - internal val branches: List, - @JvmField - internal val default: Rex, + @JvmField internal val branches: List, + @JvmField internal val default: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(branches) kids.add(default) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpCase(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpCase(this, ctx) internal data class Branch( - @JvmField - internal val condition: Rex, - @JvmField - internal val rex: Rex, + @JvmField internal val condition: Rex, + @JvmField internal val rex: Rex, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(condition) kids.add(rex) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpCaseBranch(this, ctx) internal companion object { @@ -623,17 +568,15 @@ internal data class Rex( } internal data class Collection( - @JvmField - internal val values: List, + @JvmField internal val values: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(values) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpCollection(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpCollection(this, ctx) internal companion object { @JvmStatic @@ -642,32 +585,28 @@ internal data class Rex( } internal data class Struct( - @JvmField - internal val fields: List, + @JvmField internal val fields: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(fields) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpStruct(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpStruct(this, ctx) internal data class Field( - @JvmField - internal val k: Rex, - @JvmField - internal val v: Rex, + @JvmField internal val k: Rex, + @JvmField internal val v: Rex, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(k) kids.add(v) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpStructField(this, ctx) internal companion object { @@ -683,14 +622,11 @@ internal data class Rex( } internal data class Pivot( - @JvmField - internal val key: Rex, - @JvmField - internal val `value`: Rex, - @JvmField - internal val rel: Rel, + @JvmField internal val key: Rex, + @JvmField internal val `value`: Rex, + @JvmField internal val rel: Rel, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(key) kids.add(value) @@ -698,8 +634,7 @@ internal data class Rex( kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpPivot(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpPivot(this, ctx) internal companion object { @JvmStatic @@ -708,23 +643,19 @@ internal data class Rex( } internal data class Subquery( - @JvmField - internal val select: Select, - @JvmField - internal val coercion: Coercion, + @JvmField internal val select: Select, + @JvmField internal val coercion: Coercion, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(select) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpSubquery(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpSubquery(this, ctx) internal enum class Coercion { - SCALAR, - ROW, + SCALAR, ROW, } internal companion object { @@ -734,20 +665,17 @@ internal data class Rex( } internal data class Select( - @JvmField - internal val `constructor`: Rex, - @JvmField - internal val rel: Rel, + @JvmField internal val `constructor`: Rex, + @JvmField internal val rel: Rel, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(constructor) kids.add(rel) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpSelect(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpSelect(this, ctx) internal companion object { @JvmStatic @@ -756,17 +684,15 @@ internal data class Rex( } internal data class TupleUnion( - @JvmField - internal val args: List, + @JvmField internal val args: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(args) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpTupleUnion(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpTupleUnion(this, ctx) internal companion object { @JvmStatic @@ -775,13 +701,11 @@ internal data class Rex( } internal data class Err( - @JvmField - internal val message: String, + @JvmField internal val message: String, ) : Op() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRexOpErr(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRexOpErr(this, ctx) internal companion object { @JvmStatic @@ -797,21 +721,18 @@ internal data class Rex( } internal data class Rel( - @JvmField - internal val type: Type, - @JvmField - internal val op: Op, + @JvmField internal val type: Type, + @JvmField internal val op: Op, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(type) kids.add(op) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRel( - this, - ctx + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRel( + this, ctx ) internal enum class Prop { @@ -819,19 +740,16 @@ internal data class Rel( } internal data class Type( - @JvmField - internal val schema: List, - @JvmField - internal val props: Set, + @JvmField internal val schema: List, + @JvmField internal val props: Set, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.addAll(schema) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelType(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelType(this, ctx) internal companion object { @JvmStatic @@ -840,7 +758,7 @@ internal data class Rel( } internal sealed class Op : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is Scan -> visitor.visitRelOpScan(this, ctx) is ScanIndexed -> visitor.visitRelOpScanIndexed(this, ctx) is Unpivot -> visitor.visitRelOpUnpivot(this, ctx) @@ -860,17 +778,15 @@ internal data class Rel( } internal data class Scan( - @JvmField - internal val rex: Rex, + @JvmField internal val rex: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(rex) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpScan(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpScan(this, ctx) internal companion object { @JvmStatic @@ -879,17 +795,15 @@ internal data class Rel( } internal data class ScanIndexed( - @JvmField - internal val rex: Rex, + @JvmField internal val rex: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(rex) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpScanIndexed(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpScanIndexed(this, ctx) internal companion object { @JvmStatic @@ -898,17 +812,15 @@ internal data class Rel( } internal data class Unpivot( - @JvmField - internal val rex: Rex, + @JvmField internal val rex: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(rex) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpUnpivot(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpUnpivot(this, ctx) internal companion object { @JvmStatic @@ -917,17 +829,15 @@ internal data class Rel( } internal data class Distinct( - @JvmField - internal val input: Rel, + @JvmField internal val input: Rel, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpDistinct(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpDistinct(this, ctx) internal companion object { @JvmStatic @@ -936,20 +846,17 @@ internal data class Rel( } internal data class Filter( - @JvmField - internal val input: Rel, - @JvmField - internal val predicate: Rex, + @JvmField internal val input: Rel, + @JvmField internal val predicate: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.add(predicate) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpFilter(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpFilter(this, ctx) internal companion object { @JvmStatic @@ -958,41 +865,33 @@ internal data class Rel( } internal data class Sort( - @JvmField - internal val input: Rel, - @JvmField - internal val specs: List, + @JvmField internal val input: Rel, + @JvmField internal val specs: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.addAll(specs) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpSort(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpSort(this, ctx) internal enum class Order { - ASC_NULLS_LAST, - ASC_NULLS_FIRST, - DESC_NULLS_LAST, - DESC_NULLS_FIRST, + ASC_NULLS_LAST, ASC_NULLS_FIRST, DESC_NULLS_LAST, DESC_NULLS_FIRST, } internal data class Spec( - @JvmField - internal val rex: Rex, - @JvmField - internal val order: Order, + @JvmField internal val rex: Rex, + @JvmField internal val order: Order, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(rex) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpSortSpec(this, ctx) internal companion object { @@ -1008,20 +907,17 @@ internal data class Rel( } internal data class Union( - @JvmField - internal val lhs: Rel, - @JvmField - internal val rhs: Rel, + @JvmField internal val lhs: Rel, + @JvmField internal val rhs: Rel, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(lhs) kids.add(rhs) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpUnion(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpUnion(this, ctx) internal companion object { @JvmStatic @@ -1030,20 +926,17 @@ internal data class Rel( } internal data class Intersect( - @JvmField - internal val lhs: Rel, - @JvmField - internal val rhs: Rel, + @JvmField internal val lhs: Rel, + @JvmField internal val rhs: Rel, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(lhs) kids.add(rhs) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpIntersect(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpIntersect(this, ctx) internal companion object { @JvmStatic @@ -1052,20 +945,17 @@ internal data class Rel( } internal data class Except( - @JvmField - internal val lhs: Rel, - @JvmField - internal val rhs: Rel, + @JvmField internal val lhs: Rel, + @JvmField internal val rhs: Rel, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(lhs) kids.add(rhs) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpExcept(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExcept(this, ctx) internal companion object { @JvmStatic @@ -1074,20 +964,17 @@ internal data class Rel( } internal data class Limit( - @JvmField - internal val input: Rel, - @JvmField - internal val limit: Rex, + @JvmField internal val input: Rel, + @JvmField internal val limit: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.add(limit) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpLimit(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpLimit(this, ctx) internal companion object { @JvmStatic @@ -1096,20 +983,17 @@ internal data class Rel( } internal data class Offset( - @JvmField - internal val input: Rel, - @JvmField - internal val offset: Rex, + @JvmField internal val input: Rel, + @JvmField internal val offset: Rex, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.add(offset) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpOffset(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpOffset(this, ctx) internal companion object { @JvmStatic @@ -1118,20 +1002,17 @@ internal data class Rel( } internal data class Project( - @JvmField - internal val input: Rel, - @JvmField - internal val projections: List, + @JvmField internal val input: Rel, + @JvmField internal val projections: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.addAll(projections) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpProject(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpProject(this, ctx) internal companion object { @JvmStatic @@ -1140,16 +1021,12 @@ internal data class Rel( } internal data class Join( - @JvmField - internal val lhs: Rel, - @JvmField - internal val rhs: Rel, - @JvmField - internal val rex: Rex, - @JvmField - internal val type: Type, + @JvmField internal val lhs: Rel, + @JvmField internal val rhs: Rel, + @JvmField internal val rex: Rex, + @JvmField internal val type: Type, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(lhs) kids.add(rhs) @@ -1157,14 +1034,10 @@ internal data class Rel( kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpJoin(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpJoin(this, ctx) internal enum class Type { - INNER, - LEFT, - RIGHT, - FULL, + INNER, LEFT, RIGHT, FULL, } internal companion object { @@ -1174,16 +1047,12 @@ internal data class Rel( } internal data class Aggregate( - @JvmField - internal val input: Rel, - @JvmField - internal val strategy: Strategy, - @JvmField - internal val calls: List, - @JvmField - internal val groups: List, + @JvmField internal val input: Rel, + @JvmField internal val strategy: Strategy, + @JvmField internal val calls: List, + @JvmField internal val groups: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.addAll(calls) @@ -1191,28 +1060,24 @@ internal data class Rel( kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpAggregate(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpAggregate(this, ctx) internal enum class Strategy { - FULL, - PARTIAL, + FULL, PARTIAL, } internal data class Call( - @JvmField - internal val agg: Agg, - @JvmField - internal val args: List, + @JvmField internal val agg: Agg, + @JvmField internal val args: List, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(agg) kids.addAll(args) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpAggregateCall(this, ctx) internal companion object { @@ -1228,35 +1093,30 @@ internal data class Rel( } internal data class Exclude( - @JvmField - internal val input: Rel, - @JvmField - internal val items: List, + @JvmField internal val input: Rel, + @JvmField internal val items: List, ) : Op() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(input) kids.addAll(items) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpExclude(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExclude(this, ctx) internal data class Item( - @JvmField - internal val root: Rex.Op.Var, - @JvmField - internal val steps: List, + @JvmField internal val root: Rex.Op.Var, + @JvmField internal val steps: List, ) : PlanNode() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(root) kids.addAll(steps) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExcludeItem(this, ctx) internal companion object { @@ -1266,7 +1126,7 @@ internal data class Rel( } internal sealed class Step : PlanNode() { - internal override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { + override fun accept(visitor: PlanVisitor, ctx: C): R = when (this) { is StructField -> visitor.visitRelOpExcludeStepStructField(this, ctx) is CollIndex -> visitor.visitRelOpExcludeStepCollIndex(this, ctx) is StructWildcard -> visitor.visitRelOpExcludeStepStructWildcard(this, ctx) @@ -1274,16 +1134,15 @@ internal data class Rel( } internal data class StructField( - @JvmField - internal val symbol: Identifier.Symbol, + @JvmField internal val symbol: Identifier.Symbol, ) : Step() { - internal override val children: List by lazy { + override val children: List by lazy { val kids = mutableListOf() kids.add(symbol) kids.filterNotNull() } - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExcludeStepStructField(this, ctx) internal companion object { @@ -1294,28 +1153,25 @@ internal data class Rel( } internal data class CollIndex( - @JvmField - internal val index: Int, + @JvmField internal val index: Int, ) : Step() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExcludeStepCollIndex(this, ctx) internal companion object { @JvmStatic - internal fun builder(): RelOpExcludeStepCollIndexBuilder = - RelOpExcludeStepCollIndexBuilder() + internal fun builder(): RelOpExcludeStepCollIndexBuilder = RelOpExcludeStepCollIndexBuilder() } } internal data class StructWildcard( - @JvmField - internal val ` `: Char = ' ', + @JvmField internal val ` `: Char = ' ', ) : Step() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExcludeStepStructWildcard(this, ctx) internal companion object { @@ -1326,12 +1182,11 @@ internal data class Rel( } internal data class CollWildcard( - @JvmField - internal val ` `: Char = ' ', + @JvmField internal val ` `: Char = ' ', ) : Step() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpExcludeStepCollWildcard(this, ctx) internal companion object { @@ -1349,13 +1204,11 @@ internal data class Rel( } internal data class Err( - @JvmField - internal val message: String, + @JvmField internal val message: String, ) : Op() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelOpErr(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelOpErr(this, ctx) internal companion object { @JvmStatic @@ -1365,15 +1218,12 @@ internal data class Rel( } internal data class Binding( - @JvmField - internal val name: String, - @JvmField - internal val type: StaticType, + @JvmField internal val name: String, + @JvmField internal val type: StaticType, ) : PlanNode() { - internal override val children: List = emptyList() + override val children: List = emptyList() - internal override fun accept(visitor: PlanVisitor, ctx: C): R = - visitor.visitRelBinding(this, ctx) + override fun accept(visitor: PlanVisitor, ctx: C): R = visitor.visitRelBinding(this, ctx) internal companion object { @JvmStatic @@ -1386,8 +1236,3 @@ internal data class Rel( internal fun builder(): RelBuilder = RelBuilder() } } - -internal enum class PartiQLVersion { - VERSION_0_0, - VERSION_0_1, -} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Plan.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Plan.kt deleted file mode 100644 index e7516fba9..000000000 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/Plan.kt +++ /dev/null @@ -1,182 +0,0 @@ -@file:JvmName("Plan") -@file:OptIn(PartiQLValueExperimental::class) - -package org.partiql.planner.internal.ir - -import org.partiql.types.StaticType -import org.partiql.types.function.FunctionSignature -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental - -internal fun partiQLPlan( - version: PartiQLVersion, - catalogs: List, - statement: Statement, -): PartiQLPlan = PartiQLPlan(version, catalogs, statement) - -internal fun catalog(name: String, symbols: List): Catalog = Catalog(name, symbols) - -internal fun catalogSymbol(path: List, type: StaticType): Catalog.Symbol = - Catalog.Symbol(path, type) - -internal fun catalogSymbolRef(catalog: Int, symbol: Int): Catalog.Symbol.Ref = - Catalog.Symbol.Ref(catalog, symbol) - -internal fun fnResolved(signature: FunctionSignature.Scalar): Fn.Resolved = Fn.Resolved(signature) - -internal fun fnUnresolved(identifier: Identifier, isHidden: Boolean): Fn.Unresolved = - Fn.Unresolved(identifier, isHidden) - -internal fun aggResolved(signature: FunctionSignature.Aggregation): Agg.Resolved = - Agg.Resolved(signature) - -internal fun aggUnresolved(identifier: Identifier): Agg.Unresolved = Agg.Unresolved(identifier) - -internal fun statementQuery(root: Rex): Statement.Query = Statement.Query(root) - -internal fun identifierSymbol(symbol: String, caseSensitivity: Identifier.CaseSensitivity): - Identifier.Symbol = Identifier.Symbol(symbol, caseSensitivity) - -internal fun identifierQualified(root: Identifier.Symbol, steps: List): - Identifier.Qualified = Identifier.Qualified(root, steps) - -internal fun rex(type: StaticType, op: Rex.Op): Rex = Rex(type, op) - -@OptIn(PartiQLValueExperimental::class) -internal fun rexOpLit(`value`: PartiQLValue): Rex.Op.Lit = Rex.Op.Lit(value) - -internal fun rexOpVarResolved(ref: Int): Rex.Op.Var.Resolved = Rex.Op.Var.Resolved(ref) - -internal fun rexOpVarUnresolved(identifier: Identifier, scope: Rex.Op.Var.Scope): - Rex.Op.Var.Unresolved = Rex.Op.Var.Unresolved(identifier, scope) - -internal fun rexOpGlobal(ref: Catalog.Symbol.Ref): Rex.Op.Global = Rex.Op.Global(ref) - -internal fun rexOpPathIndex(root: Rex, key: Rex): Rex.Op.Path.Index = Rex.Op.Path.Index(root, key) - -internal fun rexOpPathKey(root: Rex, key: Rex): Rex.Op.Path.Key = Rex.Op.Path.Key(root, key) - -internal fun rexOpPathSymbol(root: Rex, key: String): Rex.Op.Path.Symbol = Rex.Op.Path.Symbol( - root, - key -) - -internal fun rexOpCallStatic(fn: Fn, args: List): Rex.Op.Call.Static = Rex.Op.Call.Static( - fn, - args -) - -internal fun rexOpCallDynamic(args: List, candidates: List): - Rex.Op.Call.Dynamic = Rex.Op.Call.Dynamic(args, candidates) - -internal fun rexOpCallDynamicCandidate(fn: Fn.Resolved, coercions: List): - Rex.Op.Call.Dynamic.Candidate = Rex.Op.Call.Dynamic.Candidate(fn, coercions) - -internal fun rexOpCase(branches: List, default: Rex): Rex.Op.Case = - Rex.Op.Case(branches, default) - -internal fun rexOpCaseBranch(condition: Rex, rex: Rex): Rex.Op.Case.Branch = - Rex.Op.Case.Branch(condition, rex) - -internal fun rexOpCollection(values: List): Rex.Op.Collection = Rex.Op.Collection(values) - -internal fun rexOpStruct(fields: List): Rex.Op.Struct = Rex.Op.Struct(fields) - -internal fun rexOpStructField(k: Rex, v: Rex): Rex.Op.Struct.Field = Rex.Op.Struct.Field(k, v) - -internal fun rexOpPivot( - key: Rex, - `value`: Rex, - rel: Rel, -): Rex.Op.Pivot = Rex.Op.Pivot(key, value, rel) - -internal fun rexOpSubquery(select: Rex.Op.Select, coercion: Rex.Op.Subquery.Coercion): Rex.Op.Subquery = - Rex.Op.Subquery(select, coercion) - -internal fun rexOpSelect(`constructor`: Rex, rel: Rel): Rex.Op.Select = Rex.Op.Select( - constructor, - rel -) - -internal fun rexOpTupleUnion(args: List): Rex.Op.TupleUnion = Rex.Op.TupleUnion(args) - -internal fun rexOpErr(message: String): Rex.Op.Err = Rex.Op.Err(message) - -internal fun rel(type: Rel.Type, op: Rel.Op): Rel = Rel(type, op) - -internal fun relType(schema: List, props: Set): Rel.Type = Rel.Type( - schema, - props -) - -internal fun relOpScan(rex: Rex): Rel.Op.Scan = Rel.Op.Scan(rex) - -internal fun relOpScanIndexed(rex: Rex): Rel.Op.ScanIndexed = Rel.Op.ScanIndexed(rex) - -internal fun relOpUnpivot(rex: Rex): Rel.Op.Unpivot = Rel.Op.Unpivot(rex) - -internal fun relOpDistinct(input: Rel): Rel.Op.Distinct = Rel.Op.Distinct(input) - -internal fun relOpFilter(input: Rel, predicate: Rex): Rel.Op.Filter = Rel.Op.Filter(input, predicate) - -internal fun relOpSort(input: Rel, specs: List): Rel.Op.Sort = Rel.Op.Sort( - input, - specs -) - -internal fun relOpSortSpec(rex: Rex, order: Rel.Op.Sort.Order): Rel.Op.Sort.Spec = - Rel.Op.Sort.Spec(rex, order) - -internal fun relOpUnion(lhs: Rel, rhs: Rel): Rel.Op.Union = Rel.Op.Union(lhs, rhs) - -internal fun relOpIntersect(lhs: Rel, rhs: Rel): Rel.Op.Intersect = Rel.Op.Intersect(lhs, rhs) - -internal fun relOpExcept(lhs: Rel, rhs: Rel): Rel.Op.Except = Rel.Op.Except(lhs, rhs) - -internal fun relOpLimit(input: Rel, limit: Rex): Rel.Op.Limit = Rel.Op.Limit(input, limit) - -internal fun relOpOffset(input: Rel, offset: Rex): Rel.Op.Offset = Rel.Op.Offset(input, offset) - -internal fun relOpProject(input: Rel, projections: List): Rel.Op.Project = Rel.Op.Project( - input, - projections -) - -internal fun relOpJoin( - lhs: Rel, - rhs: Rel, - rex: Rex, - type: Rel.Op.Join.Type, -): Rel.Op.Join = Rel.Op.Join(lhs, rhs, rex, type) - -internal fun relOpAggregate( - input: Rel, - strategy: Rel.Op.Aggregate.Strategy, - calls: List, - groups: List, -): Rel.Op.Aggregate = Rel.Op.Aggregate(input, strategy, calls, groups) - -internal fun relOpAggregateCall(agg: Agg, args: List): Rel.Op.Aggregate.Call = - Rel.Op.Aggregate.Call(agg, args) - -internal fun relOpExclude(input: Rel, items: List): Rel.Op.Exclude = - Rel.Op.Exclude(input, items) - -internal fun relOpExcludeItem(root: Rex.Op.Var, steps: List): Rel.Op.Exclude.Item = - Rel.Op.Exclude.Item(root, steps) - -internal fun relOpExcludeStepStructField(symbol: Identifier.Symbol): Rel.Op.Exclude.Step.StructField = - Rel.Op.Exclude.Step.StructField(symbol) - -internal fun relOpExcludeStepCollIndex(index: Int): Rel.Op.Exclude.Step.CollIndex = - Rel.Op.Exclude.Step.CollIndex(index) - -internal fun relOpExcludeStepStructWildcard(): Rel.Op.Exclude.Step.StructWildcard = - Rel.Op.Exclude.Step.StructWildcard() - -internal fun relOpExcludeStepCollWildcard(): Rel.Op.Exclude.Step.CollWildcard = - Rel.Op.Exclude.Step.CollWildcard() - -internal fun relOpErr(message: String): Rel.Op.Err = Rel.Op.Err(message) - -internal fun relBinding(name: String, type: StaticType): Rel.Binding = Rel.Binding(name, type) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilder.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilder.kt deleted file mode 100644 index bbfd68e42..000000000 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilder.kt +++ /dev/null @@ -1,568 +0,0 @@ -@file:Suppress("UNUSED_PARAMETER") @file:OptIn(PartiQLValueExperimental::class) - -package org.partiql.planner.internal.ir.builder - -import org.partiql.planner.internal.ir.Agg -import org.partiql.planner.internal.ir.Catalog -import org.partiql.planner.internal.ir.Fn -import org.partiql.planner.internal.ir.Identifier -import org.partiql.planner.internal.ir.PartiQLPlan -import org.partiql.planner.internal.ir.PartiQLVersion -import org.partiql.planner.internal.ir.PlanNode -import org.partiql.planner.internal.ir.Rel -import org.partiql.planner.internal.ir.Rex -import org.partiql.planner.internal.ir.Statement -import org.partiql.types.StaticType -import org.partiql.types.function.FunctionSignature -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental - -internal fun plan(block: PlanBuilder.() -> T) = PlanBuilder().block() - -internal class PlanBuilder { - internal fun partiQLPlan( - version: PartiQLVersion? = null, - catalogs: MutableList = mutableListOf(), - statement: Statement? = null, - block: PartiQlPlanBuilder.() -> Unit = {}, - ): PartiQLPlan { - val builder = PartiQlPlanBuilder(version, catalogs, statement) - builder.block() - return builder.build() - } - - internal fun catalog( - name: String? = null, - symbols: MutableList = mutableListOf(), - block: CatalogBuilder.() -> Unit = {}, - ): Catalog { - val builder = CatalogBuilder(name, symbols) - builder.block() - return builder.build() - } - - internal fun catalogSymbol( - path: MutableList = mutableListOf(), - type: StaticType? = null, - block: CatalogSymbolBuilder.() -> Unit = {}, - ): Catalog.Symbol { - val builder = CatalogSymbolBuilder(path, type) - builder.block() - return builder.build() - } - - internal fun catalogSymbolRef( - catalog: Int? = null, - symbol: Int? = null, - block: CatalogSymbolRefBuilder.() -> Unit = {}, - ): Catalog.Symbol.Ref { - val builder = CatalogSymbolRefBuilder(catalog, symbol) - builder.block() - return builder.build() - } - - internal fun fnResolved( - signature: FunctionSignature.Scalar? = null, - block: FnResolvedBuilder.() -> Unit = {}, - ): Fn.Resolved { - val builder = FnResolvedBuilder(signature) - builder.block() - return builder.build() - } - - internal fun fnUnresolved( - identifier: Identifier? = null, - isHidden: Boolean? = null, - block: FnUnresolvedBuilder.() -> Unit = {}, - ): Fn.Unresolved { - val builder = FnUnresolvedBuilder(identifier, isHidden) - builder.block() - return builder.build() - } - - internal fun aggResolved( - signature: FunctionSignature.Aggregation? = null, - block: AggResolvedBuilder.() -> Unit = {}, - ): Agg.Resolved { - val builder = AggResolvedBuilder(signature) - builder.block() - return builder.build() - } - - internal fun aggUnresolved( - identifier: Identifier? = null, - block: AggUnresolvedBuilder.() -> Unit = {}, - ): Agg.Unresolved { - val builder = AggUnresolvedBuilder(identifier) - builder.block() - return builder.build() - } - - internal fun statementQuery(root: Rex? = null, block: StatementQueryBuilder.() -> Unit = {}): Statement.Query { - val builder = StatementQueryBuilder(root) - builder.block() - return builder.build() - } - - internal fun identifierSymbol( - symbol: String? = null, - caseSensitivity: Identifier.CaseSensitivity? = null, - block: IdentifierSymbolBuilder.() -> Unit = {}, - ): Identifier.Symbol { - val builder = IdentifierSymbolBuilder(symbol, caseSensitivity) - builder.block() - return builder.build() - } - - internal fun identifierQualified( - root: Identifier.Symbol? = null, - steps: MutableList = mutableListOf(), - block: IdentifierQualifiedBuilder.() -> Unit = {}, - ): Identifier.Qualified { - val builder = IdentifierQualifiedBuilder(root, steps) - builder.block() - return builder.build() - } - - internal fun rex( - type: StaticType? = null, - op: Rex.Op? = null, - block: RexBuilder.() -> Unit = {}, - ): Rex { - val builder = RexBuilder(type, op) - builder.block() - return builder.build() - } - - @OptIn(PartiQLValueExperimental::class) - internal fun rexOpLit(`value`: PartiQLValue? = null, block: RexOpLitBuilder.() -> Unit = {}): Rex.Op.Lit { - val builder = RexOpLitBuilder(value) - builder.block() - return builder.build() - } - - internal fun rexOpVarResolved( - ref: Int? = null, - block: RexOpVarResolvedBuilder.() -> Unit = {}, - ): Rex.Op.Var.Resolved { - val builder = RexOpVarResolvedBuilder(ref) - builder.block() - return builder.build() - } - - internal fun rexOpVarUnresolved( - identifier: Identifier? = null, - scope: Rex.Op.Var.Scope? = null, - block: RexOpVarUnresolvedBuilder.() -> Unit = {}, - ): Rex.Op.Var.Unresolved { - val builder = RexOpVarUnresolvedBuilder(identifier, scope) - builder.block() - return builder.build() - } - - internal fun rexOpGlobal( - ref: Catalog.Symbol.Ref? = null, - block: RexOpGlobalBuilder.() -> Unit = {} - ): Rex.Op.Global { - val builder = RexOpGlobalBuilder(ref) - builder.block() - return builder.build() - } - - internal fun rexOpPathIndex( - root: Rex? = null, - key: Rex? = null, - block: RexOpPathIndexBuilder.() -> Unit = {}, - ): Rex.Op.Path.Index { - val builder = RexOpPathIndexBuilder(root, key) - builder.block() - return builder.build() - } - - internal fun rexOpPathKey( - root: Rex? = null, - key: Rex? = null, - block: RexOpPathKeyBuilder.() -> Unit = {}, - ): Rex.Op.Path.Key { - val builder = RexOpPathKeyBuilder(root, key) - builder.block() - return builder.build() - } - - internal fun rexOpPathSymbol( - root: Rex? = null, - key: String? = null, - block: RexOpPathSymbolBuilder.() -> Unit = {}, - ): Rex.Op.Path.Symbol { - val builder = RexOpPathSymbolBuilder(root, key) - builder.block() - return builder.build() - } - - internal fun rexOpCallStatic( - fn: Fn? = null, - args: MutableList = mutableListOf(), - block: RexOpCallStaticBuilder.() -> Unit = {}, - ): Rex.Op.Call.Static { - val builder = RexOpCallStaticBuilder(fn, args) - builder.block() - return builder.build() - } - - internal fun rexOpCallDynamic( - args: MutableList = mutableListOf(), - candidates: MutableList = mutableListOf(), - block: RexOpCallDynamicBuilder.() -> Unit = {}, - ): Rex.Op.Call.Dynamic { - val builder = RexOpCallDynamicBuilder(args, candidates) - builder.block() - return builder.build() - } - - internal fun rexOpCallDynamicCandidate( - fn: Fn.Resolved? = null, - coercions: MutableList = mutableListOf(), - block: RexOpCallDynamicCandidateBuilder.() -> Unit = {}, - ): Rex.Op.Call.Dynamic.Candidate { - val builder = RexOpCallDynamicCandidateBuilder(fn, coercions) - builder.block() - return builder.build() - } - - internal fun rexOpCase( - branches: MutableList = mutableListOf(), - default: Rex? = null, - block: RexOpCaseBuilder.() -> Unit = {}, - ): Rex.Op.Case { - val builder = RexOpCaseBuilder(branches, default) - builder.block() - return builder.build() - } - - internal fun rexOpCaseBranch( - condition: Rex? = null, - rex: Rex? = null, - block: RexOpCaseBranchBuilder.() -> Unit = {}, - ): Rex.Op.Case.Branch { - val builder = RexOpCaseBranchBuilder(condition, rex) - builder.block() - return builder.build() - } - - internal fun rexOpCollection( - values: MutableList = mutableListOf(), - block: RexOpCollectionBuilder.() -> Unit = {}, - ): Rex.Op.Collection { - val builder = RexOpCollectionBuilder(values) - builder.block() - return builder.build() - } - - internal fun rexOpStruct( - fields: MutableList = mutableListOf(), - block: RexOpStructBuilder.() -> Unit = {}, - ): Rex.Op.Struct { - val builder = RexOpStructBuilder(fields) - builder.block() - return builder.build() - } - - internal fun rexOpStructField( - k: Rex? = null, - v: Rex? = null, - block: RexOpStructFieldBuilder.() -> Unit = {}, - ): Rex.Op.Struct.Field { - val builder = RexOpStructFieldBuilder(k, v) - builder.block() - return builder.build() - } - - internal fun rexOpPivot( - key: Rex? = null, - `value`: Rex? = null, - rel: Rel? = null, - block: RexOpPivotBuilder.() -> Unit = {}, - ): Rex.Op.Pivot { - val builder = RexOpPivotBuilder(key, value, rel) - builder.block() - return builder.build() - } - - internal fun rexOpSubquery( - select: Rex.Op.Select? = null, - coercion: Rex.Op.Subquery.Coercion? = null, - block: RexOpSubqueryBuilder.() -> Unit = {}, - ): Rex.Op.Subquery { - val builder = RexOpSubqueryBuilder(select, coercion) - builder.block() - return builder.build() - } - - internal fun rexOpSelect( - `constructor`: Rex? = null, - rel: Rel? = null, - block: RexOpSelectBuilder.() -> Unit = {}, - ): Rex.Op.Select { - val builder = RexOpSelectBuilder(constructor, rel) - builder.block() - return builder.build() - } - - internal fun rexOpTupleUnion( - args: MutableList = mutableListOf(), - block: RexOpTupleUnionBuilder.() -> Unit = {}, - ): Rex.Op.TupleUnion { - val builder = RexOpTupleUnionBuilder(args) - builder.block() - return builder.build() - } - - internal fun rexOpErr(message: String? = null, block: RexOpErrBuilder.() -> Unit = {}): Rex.Op.Err { - val builder = RexOpErrBuilder(message) - builder.block() - return builder.build() - } - - internal fun rel( - type: Rel.Type? = null, - op: Rel.Op? = null, - block: RelBuilder.() -> Unit = {}, - ): Rel { - val builder = RelBuilder(type, op) - builder.block() - return builder.build() - } - - internal fun relType( - schema: MutableList = mutableListOf(), - props: MutableSet = mutableSetOf(), - block: RelTypeBuilder.() -> Unit = {}, - ): Rel.Type { - val builder = RelTypeBuilder(schema, props) - builder.block() - return builder.build() - } - - internal fun relOpScan(rex: Rex? = null, block: RelOpScanBuilder.() -> Unit = {}): Rel.Op.Scan { - val builder = RelOpScanBuilder(rex) - builder.block() - return builder.build() - } - - internal fun relOpScanIndexed( - rex: Rex? = null, - block: RelOpScanIndexedBuilder.() -> Unit = {}, - ): Rel.Op.ScanIndexed { - val builder = RelOpScanIndexedBuilder(rex) - builder.block() - return builder.build() - } - - internal fun relOpUnpivot(rex: Rex? = null, block: RelOpUnpivotBuilder.() -> Unit = {}): Rel.Op.Unpivot { - val builder = RelOpUnpivotBuilder(rex) - builder.block() - return builder.build() - } - - internal fun relOpDistinct(input: Rel? = null, block: RelOpDistinctBuilder.() -> Unit = {}): Rel.Op.Distinct { - val builder = RelOpDistinctBuilder(input) - builder.block() - return builder.build() - } - - internal fun relOpFilter( - input: Rel? = null, - predicate: Rex? = null, - block: RelOpFilterBuilder.() -> Unit = {}, - ): Rel.Op.Filter { - val builder = RelOpFilterBuilder(input, predicate) - builder.block() - return builder.build() - } - - internal fun relOpSort( - input: Rel? = null, - specs: MutableList = mutableListOf(), - block: RelOpSortBuilder.() -> Unit = {}, - ): Rel.Op.Sort { - val builder = RelOpSortBuilder(input, specs) - builder.block() - return builder.build() - } - - internal fun relOpSortSpec( - rex: Rex? = null, - order: Rel.Op.Sort.Order? = null, - block: RelOpSortSpecBuilder.() -> Unit = {}, - ): Rel.Op.Sort.Spec { - val builder = RelOpSortSpecBuilder(rex, order) - builder.block() - return builder.build() - } - - internal fun relOpUnion( - lhs: Rel? = null, - rhs: Rel? = null, - block: RelOpUnionBuilder.() -> Unit = {}, - ): Rel.Op.Union { - val builder = RelOpUnionBuilder(lhs, rhs) - builder.block() - return builder.build() - } - - internal fun relOpIntersect( - lhs: Rel? = null, - rhs: Rel? = null, - block: RelOpIntersectBuilder.() -> Unit = {}, - ): Rel.Op.Intersect { - val builder = RelOpIntersectBuilder(lhs, rhs) - builder.block() - return builder.build() - } - - internal fun relOpExcept( - lhs: Rel? = null, - rhs: Rel? = null, - block: RelOpExceptBuilder.() -> Unit = {}, - ): Rel.Op.Except { - val builder = RelOpExceptBuilder(lhs, rhs) - builder.block() - return builder.build() - } - - internal fun relOpLimit( - input: Rel? = null, - limit: Rex? = null, - block: RelOpLimitBuilder.() -> Unit = {}, - ): Rel.Op.Limit { - val builder = RelOpLimitBuilder(input, limit) - builder.block() - return builder.build() - } - - internal fun relOpOffset( - input: Rel? = null, - offset: Rex? = null, - block: RelOpOffsetBuilder.() -> Unit = {}, - ): Rel.Op.Offset { - val builder = RelOpOffsetBuilder(input, offset) - builder.block() - return builder.build() - } - - internal fun relOpProject( - input: Rel? = null, - projections: MutableList = mutableListOf(), - block: RelOpProjectBuilder.() -> Unit = {}, - ): Rel.Op.Project { - val builder = RelOpProjectBuilder(input, projections) - builder.block() - return builder.build() - } - - internal fun relOpJoin( - lhs: Rel? = null, - rhs: Rel? = null, - rex: Rex? = null, - type: Rel.Op.Join.Type? = null, - block: RelOpJoinBuilder.() -> Unit = {}, - ): Rel.Op.Join { - val builder = RelOpJoinBuilder(lhs, rhs, rex, type) - builder.block() - return builder.build() - } - - internal fun relOpAggregate( - input: Rel? = null, - strategy: Rel.Op.Aggregate.Strategy? = null, - calls: MutableList = mutableListOf(), - groups: MutableList = mutableListOf(), - block: RelOpAggregateBuilder.() -> Unit = {}, - ): Rel.Op.Aggregate { - val builder = RelOpAggregateBuilder(input, strategy, calls, groups) - builder.block() - return builder.build() - } - - internal fun relOpAggregateCall( - agg: Agg? = null, - args: MutableList = mutableListOf(), - block: RelOpAggregateCallBuilder.() -> Unit = {}, - ): Rel.Op.Aggregate.Call { - val builder = RelOpAggregateCallBuilder(agg, args) - builder.block() - return builder.build() - } - - internal fun relOpExclude( - input: Rel? = null, - items: MutableList = mutableListOf(), - block: RelOpExcludeBuilder.() -> Unit = {}, - ): Rel.Op.Exclude { - val builder = RelOpExcludeBuilder(input, items) - builder.block() - return builder.build() - } - - internal fun relOpExcludeItem( - root: Rex.Op.Var? = null, - steps: MutableList = mutableListOf(), - block: RelOpExcludeItemBuilder.() -> Unit = {}, - ): Rel.Op.Exclude.Item { - val builder = RelOpExcludeItemBuilder(root, steps) - builder.block() - return builder.build() - } - - internal fun relOpExcludeStepStructField( - symbol: Identifier.Symbol? = null, - block: RelOpExcludeStepStructFieldBuilder.() -> Unit = {} - ): Rel.Op.Exclude.Step.StructField { - val builder = RelOpExcludeStepStructFieldBuilder(symbol) - builder.block() - return builder.build() - } - - internal fun relOpExcludeStepCollIndex( - index: Int? = null, - block: RelOpExcludeStepCollIndexBuilder.() -> Unit = {} - ): Rel.Op.Exclude.Step.CollIndex { - val builder = RelOpExcludeStepCollIndexBuilder(index) - builder.block() - return builder.build() - } - - internal fun relOpExcludeStepStructWildcard( - block: RelOpExcludeStepStructWildcardBuilder.() -> Unit = - {} - ): Rel.Op.Exclude.Step.StructWildcard { - val builder = RelOpExcludeStepStructWildcardBuilder() - builder.block() - return builder.build() - } - - internal fun relOpExcludeStepCollWildcard( - block: RelOpExcludeStepCollWildcardBuilder.() -> Unit = - {} - ): Rel.Op.Exclude.Step.CollWildcard { - val builder = RelOpExcludeStepCollWildcardBuilder() - builder.block() - return builder.build() - } - - internal fun relOpErr(message: String? = null, block: RelOpErrBuilder.() -> Unit = {}): Rel.Op.Err { - val builder = RelOpErrBuilder(message) - builder.block() - return builder.build() - } - - internal fun relBinding( - name: String? = null, - type: StaticType? = null, - block: RelBindingBuilder.() -> Unit = {}, - ): Rel.Binding { - val builder = RelBindingBuilder(name, type) - builder.block() - return builder.build() - } -} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilders.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilders.kt deleted file mode 100644 index be428c8c7..000000000 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/builder/PlanBuilders.kt +++ /dev/null @@ -1,846 +0,0 @@ -@file:OptIn(PartiQLValueExperimental::class) - -package org.partiql.planner.internal.ir.builder - -import org.partiql.planner.internal.ir.Agg -import org.partiql.planner.internal.ir.Catalog -import org.partiql.planner.internal.ir.Fn -import org.partiql.planner.internal.ir.Identifier -import org.partiql.planner.internal.ir.PartiQLPlan -import org.partiql.planner.internal.ir.PartiQLVersion -import org.partiql.planner.internal.ir.Rel -import org.partiql.planner.internal.ir.Rex -import org.partiql.planner.internal.ir.Statement -import org.partiql.types.StaticType -import org.partiql.types.function.FunctionSignature -import org.partiql.value.PartiQLValue -import org.partiql.value.PartiQLValueExperimental - -internal class PartiQlPlanBuilder( - internal var version: PartiQLVersion? = null, - internal var catalogs: MutableList = mutableListOf(), - internal var statement: Statement? = null, -) { - internal fun version(version: PartiQLVersion?): PartiQlPlanBuilder = this.apply { - this.version = version - } - - internal fun catalogs(catalogs: MutableList): PartiQlPlanBuilder = this.apply { - this.catalogs = catalogs - } - - internal fun statement(statement: Statement?): PartiQlPlanBuilder = this.apply { - this.statement = statement - } - - internal fun build(): PartiQLPlan = PartiQLPlan( - version = version!!, catalogs = catalogs, - statement = - statement!! - ) -} - -internal class CatalogBuilder( - internal var name: String? = null, - internal var symbols: MutableList = mutableListOf(), -) { - internal fun name(name: String?): CatalogBuilder = this.apply { - this.name = name - } - - internal fun symbols(symbols: MutableList): CatalogBuilder = this.apply { - this.symbols = symbols - } - - internal fun build(): Catalog = Catalog(name = name!!, symbols = symbols) -} - -internal class CatalogSymbolBuilder( - internal var path: MutableList = mutableListOf(), - internal var type: StaticType? = null, -) { - internal fun path(path: MutableList): CatalogSymbolBuilder = this.apply { - this.path = path - } - - internal fun type(type: StaticType?): CatalogSymbolBuilder = this.apply { - this.type = type - } - - internal fun build(): Catalog.Symbol = Catalog.Symbol(path = path, type = type!!) -} - -internal class CatalogSymbolRefBuilder( - internal var catalog: Int? = null, - internal var symbol: Int? = null, -) { - internal fun catalog(catalog: Int?): CatalogSymbolRefBuilder = this.apply { - this.catalog = catalog - } - - internal fun symbol(symbol: Int?): CatalogSymbolRefBuilder = this.apply { - this.symbol = symbol - } - - internal fun build(): Catalog.Symbol.Ref = Catalog.Symbol.Ref( - catalog = catalog!!, - symbol = - symbol!! - ) -} - -internal class FnResolvedBuilder( - internal var signature: FunctionSignature.Scalar? = null, -) { - internal fun signature(signature: FunctionSignature.Scalar?): FnResolvedBuilder = this.apply { - this.signature = signature - } - - internal fun build(): Fn.Resolved = Fn.Resolved(signature = signature!!) -} - -internal class FnUnresolvedBuilder( - internal var identifier: Identifier? = null, - internal var isHidden: Boolean? = null, -) { - internal fun identifier(identifier: Identifier?): FnUnresolvedBuilder = this.apply { - this.identifier = identifier - } - - internal fun isHidden(isHidden: Boolean?): FnUnresolvedBuilder = this.apply { - this.isHidden = isHidden - } - - internal fun build(): Fn.Unresolved = Fn.Unresolved( - identifier = identifier!!, - isHidden = - isHidden!! - ) -} - -internal class AggResolvedBuilder( - internal var signature: FunctionSignature.Aggregation? = null, -) { - internal fun signature(signature: FunctionSignature.Aggregation?): AggResolvedBuilder = this.apply { - this.signature = signature - } - - internal fun build(): Agg.Resolved = Agg.Resolved(signature = signature!!) -} - -internal class AggUnresolvedBuilder( - internal var identifier: Identifier? = null, -) { - internal fun identifier(identifier: Identifier?): AggUnresolvedBuilder = this.apply { - this.identifier = identifier - } - - internal fun build(): Agg.Unresolved = Agg.Unresolved(identifier = identifier!!) -} - -internal class StatementQueryBuilder( - internal var root: Rex? = null, -) { - internal fun root(root: Rex?): StatementQueryBuilder = this.apply { - this.root = root - } - - internal fun build(): Statement.Query = Statement.Query(root = root!!) -} - -internal class IdentifierSymbolBuilder( - internal var symbol: String? = null, - internal var caseSensitivity: Identifier.CaseSensitivity? = null, -) { - internal fun symbol(symbol: String?): IdentifierSymbolBuilder = this.apply { - this.symbol = symbol - } - - internal fun caseSensitivity(caseSensitivity: Identifier.CaseSensitivity?): IdentifierSymbolBuilder = this.apply { - this.caseSensitivity = caseSensitivity - } - - internal fun build(): Identifier.Symbol = Identifier.Symbol( - symbol = symbol!!, - caseSensitivity = - caseSensitivity!! - ) -} - -internal class IdentifierQualifiedBuilder( - internal var root: Identifier.Symbol? = null, - internal var steps: MutableList = mutableListOf(), -) { - internal fun root(root: Identifier.Symbol?): IdentifierQualifiedBuilder = this.apply { - this.root = root - } - - internal fun steps(steps: MutableList): IdentifierQualifiedBuilder = this.apply { - this.steps = steps - } - - internal fun build(): Identifier.Qualified = Identifier.Qualified(root = root!!, steps = steps) -} - -internal class RexBuilder( - internal var type: StaticType? = null, - internal var op: Rex.Op? = null, -) { - internal fun type(type: StaticType?): RexBuilder = this.apply { - this.type = type - } - - internal fun op(op: Rex.Op?): RexBuilder = this.apply { - this.op = op - } - - internal fun build(): Rex = Rex(type = type!!, op = op!!) -} - -internal class RexOpLitBuilder( - internal var `value`: PartiQLValue? = null, -) { - @OptIn(PartiQLValueExperimental::class) - internal fun `value`(`value`: PartiQLValue?): RexOpLitBuilder = this.apply { - this.`value` = `value` - } - - @OptIn(PartiQLValueExperimental::class) - internal fun build(): Rex.Op.Lit = Rex.Op.Lit(value = value!!) -} - -internal class RexOpVarResolvedBuilder( - internal var ref: Int? = null, -) { - internal fun ref(ref: Int?): RexOpVarResolvedBuilder = this.apply { - this.ref = ref - } - - internal fun build(): Rex.Op.Var.Resolved = Rex.Op.Var.Resolved(ref = ref!!) -} - -internal class RexOpVarUnresolvedBuilder( - internal var identifier: Identifier? = null, - internal var scope: Rex.Op.Var.Scope? = null, -) { - internal fun identifier(identifier: Identifier?): RexOpVarUnresolvedBuilder = this.apply { - this.identifier = identifier - } - - internal fun scope(scope: Rex.Op.Var.Scope?): RexOpVarUnresolvedBuilder = this.apply { - this.scope = scope - } - - internal fun build(): Rex.Op.Var.Unresolved = Rex.Op.Var.Unresolved( - identifier = identifier!!, - scope = - scope!! - ) -} - -internal class RexOpGlobalBuilder( - internal var ref: Catalog.Symbol.Ref? = null, -) { - internal fun ref(ref: Catalog.Symbol.Ref?): RexOpGlobalBuilder = this.apply { - this.ref = ref - } - - internal fun build(): Rex.Op.Global = Rex.Op.Global(ref = ref!!) -} - -internal class RexOpPathIndexBuilder( - internal var root: Rex? = null, - internal var key: Rex? = null, -) { - internal fun root(root: Rex?): RexOpPathIndexBuilder = this.apply { - this.root = root - } - - internal fun key(key: Rex?): RexOpPathIndexBuilder = this.apply { - this.key = key - } - - internal fun build(): Rex.Op.Path.Index = Rex.Op.Path.Index(root = root!!, key = key!!) -} - -internal class RexOpPathKeyBuilder( - internal var root: Rex? = null, - internal var key: Rex? = null, -) { - internal fun root(root: Rex?): RexOpPathKeyBuilder = this.apply { - this.root = root - } - - internal fun key(key: Rex?): RexOpPathKeyBuilder = this.apply { - this.key = key - } - - internal fun build(): Rex.Op.Path.Key = Rex.Op.Path.Key(root = root!!, key = key!!) -} - -internal class RexOpPathSymbolBuilder( - internal var root: Rex? = null, - internal var key: String? = null, -) { - internal fun root(root: Rex?): RexOpPathSymbolBuilder = this.apply { - this.root = root - } - - internal fun key(key: String?): RexOpPathSymbolBuilder = this.apply { - this.key = key - } - - internal fun build(): Rex.Op.Path.Symbol = Rex.Op.Path.Symbol(root = root!!, key = key!!) -} - -internal class RexOpCallStaticBuilder( - internal var fn: Fn? = null, - internal var args: MutableList = mutableListOf(), -) { - internal fun fn(fn: Fn?): RexOpCallStaticBuilder = this.apply { - this.fn = fn - } - - internal fun args(args: MutableList): RexOpCallStaticBuilder = this.apply { - this.args = args - } - - internal fun build(): Rex.Op.Call.Static = Rex.Op.Call.Static(fn = fn!!, args = args) -} - -internal class RexOpCallDynamicBuilder( - internal var args: MutableList = mutableListOf(), - internal var candidates: MutableList = mutableListOf(), -) { - internal fun args(args: MutableList): RexOpCallDynamicBuilder = this.apply { - this.args = args - } - - internal fun candidates(candidates: MutableList): - RexOpCallDynamicBuilder = this.apply { - this.candidates = candidates - } - - internal fun build(): Rex.Op.Call.Dynamic = Rex.Op.Call.Dynamic( - args = args, - candidates = - candidates - ) -} - -internal class RexOpCallDynamicCandidateBuilder( - internal var fn: Fn.Resolved? = null, - internal var coercions: MutableList = mutableListOf(), -) { - internal fun fn(fn: Fn.Resolved?): RexOpCallDynamicCandidateBuilder = this.apply { - this.fn = fn - } - - internal fun coercions(coercions: MutableList): RexOpCallDynamicCandidateBuilder = - this.apply { - this.coercions = coercions - } - - internal fun build(): Rex.Op.Call.Dynamic.Candidate = Rex.Op.Call.Dynamic.Candidate( - fn = fn!!, - coercions = coercions - ) -} - -internal class RexOpCaseBuilder( - internal var branches: MutableList = mutableListOf(), - internal var default: Rex? = null, -) { - internal fun branches(branches: MutableList): RexOpCaseBuilder = this.apply { - this.branches = branches - } - - internal fun default(default: Rex?): RexOpCaseBuilder = this.apply { - this.default = default - } - - internal fun build(): Rex.Op.Case = Rex.Op.Case(branches = branches, default = default!!) -} - -internal class RexOpCaseBranchBuilder( - internal var condition: Rex? = null, - internal var rex: Rex? = null, -) { - internal fun condition(condition: Rex?): RexOpCaseBranchBuilder = this.apply { - this.condition = condition - } - - internal fun rex(rex: Rex?): RexOpCaseBranchBuilder = this.apply { - this.rex = rex - } - - internal fun build(): Rex.Op.Case.Branch = Rex.Op.Case.Branch(condition = condition!!, rex = rex!!) -} - -internal class RexOpCollectionBuilder( - internal var values: MutableList = mutableListOf(), -) { - internal fun values(values: MutableList): RexOpCollectionBuilder = this.apply { - this.values = values - } - - internal fun build(): Rex.Op.Collection = Rex.Op.Collection(values = values) -} - -internal class RexOpStructBuilder( - internal var fields: MutableList = mutableListOf(), -) { - internal fun fields(fields: MutableList): RexOpStructBuilder = this.apply { - this.fields = fields - } - - internal fun build(): Rex.Op.Struct = Rex.Op.Struct(fields = fields) -} - -internal class RexOpStructFieldBuilder( - internal var k: Rex? = null, - internal var v: Rex? = null, -) { - internal fun k(k: Rex?): RexOpStructFieldBuilder = this.apply { - this.k = k - } - - internal fun v(v: Rex?): RexOpStructFieldBuilder = this.apply { - this.v = v - } - - internal fun build(): Rex.Op.Struct.Field = Rex.Op.Struct.Field(k = k!!, v = v!!) -} - -internal class RexOpPivotBuilder( - internal var key: Rex? = null, - internal var `value`: Rex? = null, - internal var rel: Rel? = null, -) { - internal fun key(key: Rex?): RexOpPivotBuilder = this.apply { - this.key = key - } - - internal fun `value`(`value`: Rex?): RexOpPivotBuilder = this.apply { - this.`value` = `value` - } - - internal fun rel(rel: Rel?): RexOpPivotBuilder = this.apply { - this.rel = rel - } - - internal fun build(): Rex.Op.Pivot = Rex.Op.Pivot(key = key!!, value = value!!, rel = rel!!) -} - -internal class RexOpSubqueryBuilder( - internal var select: Rex.Op.Select? = null, - internal var coercion: Rex.Op.Subquery.Coercion? = null, -) { - internal fun select(select: Rex.Op.Select?): RexOpSubqueryBuilder = this.apply { - this.select = select - } - - internal fun coercion(coercion: Rex.Op.Subquery.Coercion?): RexOpSubqueryBuilder = this.apply { - this.coercion = coercion - } - - internal fun build(): Rex.Op.Subquery = Rex.Op.Subquery(select = select!!, coercion = coercion!!) -} - -internal class RexOpSelectBuilder( - internal var `constructor`: Rex? = null, - internal var rel: Rel? = null, -) { - internal fun `constructor`(`constructor`: Rex?): RexOpSelectBuilder = this.apply { - this.`constructor` = `constructor` - } - - internal fun rel(rel: Rel?): RexOpSelectBuilder = this.apply { - this.rel = rel - } - - internal fun build(): Rex.Op.Select = Rex.Op.Select(constructor = constructor!!, rel = rel!!) -} - -internal class RexOpTupleUnionBuilder( - internal var args: MutableList = mutableListOf(), -) { - internal fun args(args: MutableList): RexOpTupleUnionBuilder = this.apply { - this.args = args - } - - internal fun build(): Rex.Op.TupleUnion = Rex.Op.TupleUnion(args = args) -} - -internal class RexOpErrBuilder( - internal var message: String? = null, -) { - internal fun message(message: String?): RexOpErrBuilder = this.apply { - this.message = message - } - - internal fun build(): Rex.Op.Err = Rex.Op.Err(message = message!!) -} - -internal class RelBuilder( - internal var type: Rel.Type? = null, - internal var op: Rel.Op? = null, -) { - internal fun type(type: Rel.Type?): RelBuilder = this.apply { - this.type = type - } - - internal fun op(op: Rel.Op?): RelBuilder = this.apply { - this.op = op - } - - internal fun build(): Rel = Rel(type = type!!, op = op!!) -} - -internal class RelTypeBuilder( - internal var schema: MutableList = mutableListOf(), - internal var props: MutableSet = mutableSetOf(), -) { - internal fun schema(schema: MutableList): RelTypeBuilder = this.apply { - this.schema = schema - } - - internal fun props(props: MutableSet): RelTypeBuilder = this.apply { - this.props = props - } - - internal fun build(): Rel.Type = Rel.Type(schema = schema, props = props) -} - -internal class RelOpScanBuilder( - internal var rex: Rex? = null, -) { - internal fun rex(rex: Rex?): RelOpScanBuilder = this.apply { - this.rex = rex - } - - internal fun build(): Rel.Op.Scan = Rel.Op.Scan(rex = rex!!) -} - -internal class RelOpScanIndexedBuilder( - internal var rex: Rex? = null, -) { - internal fun rex(rex: Rex?): RelOpScanIndexedBuilder = this.apply { - this.rex = rex - } - - internal fun build(): Rel.Op.ScanIndexed = Rel.Op.ScanIndexed(rex = rex!!) -} - -internal class RelOpUnpivotBuilder( - internal var rex: Rex? = null, -) { - internal fun rex(rex: Rex?): RelOpUnpivotBuilder = this.apply { - this.rex = rex - } - - internal fun build(): Rel.Op.Unpivot = Rel.Op.Unpivot(rex = rex!!) -} - -internal class RelOpDistinctBuilder( - internal var input: Rel? = null, -) { - internal fun input(input: Rel?): RelOpDistinctBuilder = this.apply { - this.input = input - } - - internal fun build(): Rel.Op.Distinct = Rel.Op.Distinct(input = input!!) -} - -internal class RelOpFilterBuilder( - internal var input: Rel? = null, - internal var predicate: Rex? = null, -) { - internal fun input(input: Rel?): RelOpFilterBuilder = this.apply { - this.input = input - } - - internal fun predicate(predicate: Rex?): RelOpFilterBuilder = this.apply { - this.predicate = predicate - } - - internal fun build(): Rel.Op.Filter = Rel.Op.Filter(input = input!!, predicate = predicate!!) -} - -internal class RelOpSortBuilder( - internal var input: Rel? = null, - internal var specs: MutableList = mutableListOf(), -) { - internal fun input(input: Rel?): RelOpSortBuilder = this.apply { - this.input = input - } - - internal fun specs(specs: MutableList): RelOpSortBuilder = this.apply { - this.specs = specs - } - - internal fun build(): Rel.Op.Sort = Rel.Op.Sort(input = input!!, specs = specs) -} - -internal class RelOpSortSpecBuilder( - internal var rex: Rex? = null, - internal var order: Rel.Op.Sort.Order? = null, -) { - internal fun rex(rex: Rex?): RelOpSortSpecBuilder = this.apply { - this.rex = rex - } - - internal fun order(order: Rel.Op.Sort.Order?): RelOpSortSpecBuilder = this.apply { - this.order = order - } - - internal fun build(): Rel.Op.Sort.Spec = Rel.Op.Sort.Spec(rex = rex!!, order = order!!) -} - -internal class RelOpUnionBuilder( - internal var lhs: Rel? = null, - internal var rhs: Rel? = null, -) { - internal fun lhs(lhs: Rel?): RelOpUnionBuilder = this.apply { - this.lhs = lhs - } - - internal fun rhs(rhs: Rel?): RelOpUnionBuilder = this.apply { - this.rhs = rhs - } - - internal fun build(): Rel.Op.Union = Rel.Op.Union(lhs = lhs!!, rhs = rhs!!) -} - -internal class RelOpIntersectBuilder( - internal var lhs: Rel? = null, - internal var rhs: Rel? = null, -) { - internal fun lhs(lhs: Rel?): RelOpIntersectBuilder = this.apply { - this.lhs = lhs - } - - internal fun rhs(rhs: Rel?): RelOpIntersectBuilder = this.apply { - this.rhs = rhs - } - - internal fun build(): Rel.Op.Intersect = Rel.Op.Intersect(lhs = lhs!!, rhs = rhs!!) -} - -internal class RelOpExceptBuilder( - internal var lhs: Rel? = null, - internal var rhs: Rel? = null, -) { - internal fun lhs(lhs: Rel?): RelOpExceptBuilder = this.apply { - this.lhs = lhs - } - - internal fun rhs(rhs: Rel?): RelOpExceptBuilder = this.apply { - this.rhs = rhs - } - - internal fun build(): Rel.Op.Except = Rel.Op.Except(lhs = lhs!!, rhs = rhs!!) -} - -internal class RelOpLimitBuilder( - internal var input: Rel? = null, - internal var limit: Rex? = null, -) { - internal fun input(input: Rel?): RelOpLimitBuilder = this.apply { - this.input = input - } - - internal fun limit(limit: Rex?): RelOpLimitBuilder = this.apply { - this.limit = limit - } - - internal fun build(): Rel.Op.Limit = Rel.Op.Limit(input = input!!, limit = limit!!) -} - -internal class RelOpOffsetBuilder( - internal var input: Rel? = null, - internal var offset: Rex? = null, -) { - internal fun input(input: Rel?): RelOpOffsetBuilder = this.apply { - this.input = input - } - - internal fun offset(offset: Rex?): RelOpOffsetBuilder = this.apply { - this.offset = offset - } - - internal fun build(): Rel.Op.Offset = Rel.Op.Offset(input = input!!, offset = offset!!) -} - -internal class RelOpProjectBuilder( - internal var input: Rel? = null, - internal var projections: MutableList = mutableListOf(), -) { - internal fun input(input: Rel?): RelOpProjectBuilder = this.apply { - this.input = input - } - - internal fun projections(projections: MutableList): RelOpProjectBuilder = this.apply { - this.projections = projections - } - - internal fun build(): Rel.Op.Project = Rel.Op.Project(input = input!!, projections = projections) -} - -internal class RelOpJoinBuilder( - internal var lhs: Rel? = null, - internal var rhs: Rel? = null, - internal var rex: Rex? = null, - internal var type: Rel.Op.Join.Type? = null, -) { - internal fun lhs(lhs: Rel?): RelOpJoinBuilder = this.apply { - this.lhs = lhs - } - - internal fun rhs(rhs: Rel?): RelOpJoinBuilder = this.apply { - this.rhs = rhs - } - - internal fun rex(rex: Rex?): RelOpJoinBuilder = this.apply { - this.rex = rex - } - - internal fun type(type: Rel.Op.Join.Type?): RelOpJoinBuilder = this.apply { - this.type = type - } - - internal fun build(): Rel.Op.Join = Rel.Op.Join( - lhs = lhs!!, rhs = rhs!!, rex = rex!!, - type = - type!! - ) -} - -internal class RelOpAggregateBuilder( - internal var input: Rel? = null, - internal var strategy: Rel.Op.Aggregate.Strategy? = null, - internal var calls: MutableList = mutableListOf(), - internal var groups: MutableList = mutableListOf(), -) { - internal fun input(input: Rel?): RelOpAggregateBuilder = this.apply { - this.input = input - } - - internal fun strategy(strategy: Rel.Op.Aggregate.Strategy?): RelOpAggregateBuilder = this.apply { - this.strategy = strategy - } - - internal fun calls(calls: MutableList): RelOpAggregateBuilder = this.apply { - this.calls = calls - } - - internal fun groups(groups: MutableList): RelOpAggregateBuilder = this.apply { - this.groups = groups - } - - internal fun build(): Rel.Op.Aggregate = Rel.Op.Aggregate( - input = input!!, strategy = strategy!!, - calls = calls, groups = groups - ) -} - -internal class RelOpAggregateCallBuilder( - internal var agg: Agg? = null, - internal var args: MutableList = mutableListOf(), -) { - internal fun agg(agg: Agg?): RelOpAggregateCallBuilder = this.apply { - this.agg = agg - } - - internal fun args(args: MutableList): RelOpAggregateCallBuilder = this.apply { - this.args = args - } - - internal fun build(): Rel.Op.Aggregate.Call = Rel.Op.Aggregate.Call(agg = agg!!, args = args) -} - -internal class RelOpExcludeBuilder( - internal var input: Rel? = null, - internal var items: MutableList = mutableListOf(), -) { - internal fun input(input: Rel?): RelOpExcludeBuilder = this.apply { - this.input = input - } - - internal fun items(items: MutableList): RelOpExcludeBuilder = this.apply { - this.items = items - } - - internal fun build(): Rel.Op.Exclude = Rel.Op.Exclude(input = input!!, items = items) -} - -internal class RelOpExcludeItemBuilder( - internal var root: Rex.Op.Var? = null, - internal var steps: MutableList = mutableListOf(), -) { - internal fun root(root: Rex.Op.Var?): RelOpExcludeItemBuilder = this.apply { - this.root = root - } - - internal fun steps(steps: MutableList): RelOpExcludeItemBuilder = this.apply { - this.steps = steps - } - - internal fun build(): Rel.Op.Exclude.Item = Rel.Op.Exclude.Item(root = root!!, steps = steps) -} - -internal class RelOpExcludeStepStructFieldBuilder( - internal var symbol: Identifier.Symbol? = null, -) { - internal fun symbol(symbol: Identifier.Symbol?): RelOpExcludeStepStructFieldBuilder = this.apply { - this.symbol = symbol - } - - internal fun build(): Rel.Op.Exclude.Step.StructField = Rel.Op.Exclude.Step.StructField( - symbol = - symbol!! - ) -} - -internal class RelOpExcludeStepCollIndexBuilder( - internal var index: Int? = null, -) { - internal fun index(index: Int?): RelOpExcludeStepCollIndexBuilder = this.apply { - this.index = index - } - - internal fun build(): Rel.Op.Exclude.Step.CollIndex = Rel.Op.Exclude.Step.CollIndex(index = index!!) -} - -internal class RelOpExcludeStepStructWildcardBuilder() { - internal fun build(): Rel.Op.Exclude.Step.StructWildcard = Rel.Op.Exclude.Step.StructWildcard() -} - -internal class RelOpExcludeStepCollWildcardBuilder() { - internal fun build(): Rel.Op.Exclude.Step.CollWildcard = Rel.Op.Exclude.Step.CollWildcard() -} - -internal class RelOpErrBuilder( - internal var message: String? = null, -) { - internal fun message(message: String?): RelOpErrBuilder = this.apply { - this.message = message - } - - internal fun build(): Rel.Op.Err = Rel.Op.Err(message = message!!) -} - -internal class RelBindingBuilder( - internal var name: String? = null, - internal var type: StaticType? = null, -) { - internal fun name(name: String?): RelBindingBuilder = this.apply { - this.name = name - } - - internal fun type(type: StaticType?): RelBindingBuilder = this.apply { - this.type = type - } - - internal fun build(): Rel.Binding = Rel.Binding(name = name!!, type = type!!) -} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/util/PlanRewriter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/util/PlanRewriter.kt deleted file mode 100644 index a9e807160..000000000 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/util/PlanRewriter.kt +++ /dev/null @@ -1,606 +0,0 @@ -@file:Suppress( - "UNUSED_PARAMETER", - "UNUSED_VARIABLE", -) @file:OptIn(PartiQLValueExperimental::class) - -package org.partiql.planner.internal.ir.util - -import org.partiql.planner.internal.ir.Agg -import org.partiql.planner.internal.ir.Catalog -import org.partiql.planner.internal.ir.Fn -import org.partiql.planner.internal.ir.Identifier -import org.partiql.planner.internal.ir.PartiQLPlan -import org.partiql.planner.internal.ir.PlanNode -import org.partiql.planner.internal.ir.Rel -import org.partiql.planner.internal.ir.Rex -import org.partiql.planner.internal.ir.Statement -import org.partiql.planner.internal.ir.visitor.PlanBaseVisitor -import org.partiql.value.PartiQLValueExperimental - -internal abstract class PlanRewriter : PlanBaseVisitor() { - - override fun defaultReturn(node: PlanNode, ctx: C): PlanNode = node - - private inline fun _visitList( - nodes: List, - ctx: C, - method: (node: T, ctx: C) -> PlanNode, - ): List { - if (nodes.isEmpty()) return nodes - var diff = false - val transformed = ArrayList(nodes.size) - nodes.forEach { - val n = method(it, ctx) as T - if (it !== n) diff = true - transformed.add(n) - } - return if (diff) transformed else nodes - } - - private inline fun _visitListNull( - nodes: List, - ctx: C, - method: (node: T, ctx: C) -> PlanNode, - ): List { - if (nodes.isEmpty()) return nodes - var diff = false - val transformed = ArrayList(nodes.size) - nodes.forEach { - val n = if (it == null) null else method(it, ctx) as T - if (it !== n) diff = true - transformed.add(n) - } - return if (diff) transformed else nodes - } - - private inline fun _visitSet( - nodes: Set, - ctx: C, - method: (node: T, ctx: C) -> PlanNode, - ): Set { - if (nodes.isEmpty()) return nodes - var diff = false - val transformed = HashSet(nodes.size) - nodes.forEach { - val n = method(it, ctx) as T - if (it !== n) diff = true - transformed.add(n) - } - return if (diff) transformed else nodes - } - - private inline fun _visitSetNull( - nodes: Set, - ctx: C, - method: (node: T, ctx: C) -> PlanNode, - ): Set { - if (nodes.isEmpty()) return nodes - var diff = false - val transformed = HashSet(nodes.size) - nodes.forEach { - val n = if (it == null) null else method(it, ctx) as T - if (it !== n) diff = true - transformed.add(n) - } - return if (diff) transformed else nodes - } - - override fun visitPartiQLPlan(node: PartiQLPlan, ctx: C): PlanNode { - val version = node.version - val globals = _visitList(node.catalogs, ctx, ::visitCatalog) - val statement = visitStatement(node.statement, ctx) as Statement - return if (version !== node.version || globals !== node.catalogs || statement !== node.statement) { - PartiQLPlan(version, globals, statement) - } else { - node - } - } - - override fun visitCatalog(node: Catalog, ctx: C): PlanNode { - val name = node.name - val symbols = _visitList(node.symbols, ctx, ::visitCatalogSymbol) - return if (name !== node.name || symbols !== node.symbols) { - Catalog(name, symbols) - } else { - node - } - } - - override fun visitCatalogSymbol(node: Catalog.Symbol, ctx: C): PlanNode { - val path = node.path - val type = node.type - return node - } - - override fun visitCatalogSymbolRef(node: Catalog.Symbol.Ref, ctx: C): PlanNode { - val catalog = node.catalog - val symbol = node.symbol - return node - } - - override fun visitFnResolved(node: Fn.Resolved, ctx: C): PlanNode { - val signature = node.signature - return node - } - - override fun visitFnUnresolved(node: Fn.Unresolved, ctx: C): PlanNode { - val identifier = visitIdentifier(node.identifier, ctx) as Identifier - val isHidden = node.isHidden - return if (identifier !== node.identifier || isHidden !== node.isHidden) { - Fn.Unresolved(identifier, isHidden) - } else { - node - } - } - - override fun visitAggResolved(node: Agg.Resolved, ctx: C): PlanNode { - val signature = node.signature - return node - } - - override fun visitAggUnresolved(node: Agg.Unresolved, ctx: C): PlanNode { - val identifier = visitIdentifier(node.identifier, ctx) as Identifier - return if (identifier !== node.identifier) { - Agg.Unresolved(identifier) - } else { - node - } - } - - override fun visitStatementQuery(node: Statement.Query, ctx: C): PlanNode { - val root = visitRex(node.root, ctx) as Rex - return if (root !== node.root) { - Statement.Query(root) - } else { - node - } - } - - override fun visitIdentifierSymbol(node: Identifier.Symbol, ctx: C): PlanNode { - val symbol = node.symbol - val caseSensitivity = node.caseSensitivity - return node - } - - override fun visitIdentifierQualified(node: Identifier.Qualified, ctx: C): PlanNode { - val root = visitIdentifierSymbol(node.root, ctx) as Identifier.Symbol - val steps = _visitList(node.steps, ctx, ::visitIdentifierSymbol) - return if (root !== node.root || steps !== node.steps) { - Identifier.Qualified(root, steps) - } else { - node - } - } - - override fun visitRex(node: Rex, ctx: C): PlanNode { - val type = node.type - val op = visitRexOp(node.op, ctx) as Rex.Op - return if (type !== node.type || op !== node.op) { - Rex(type, op) - } else { - node - } - } - - @OptIn(PartiQLValueExperimental::class) - override fun visitRexOpLit(node: Rex.Op.Lit, ctx: C): PlanNode { - val value = node.value - return node - } - - override fun visitRexOpVarResolved(node: Rex.Op.Var.Resolved, ctx: C): PlanNode { - val ref = node.ref - return node - } - - override fun visitRexOpVarUnresolved(node: Rex.Op.Var.Unresolved, ctx: C): PlanNode { - val identifier = visitIdentifier(node.identifier, ctx) as Identifier - val scope = node.scope - return if (identifier !== node.identifier || scope !== node.scope) { - Rex.Op.Var.Unresolved(identifier, scope) - } else { - node - } - } - - override fun visitRexOpGlobal(node: Rex.Op.Global, ctx: C): PlanNode { - val ref = visitCatalogSymbolRef(node.ref, ctx) as Catalog.Symbol.Ref - return if (ref !== node.ref) { - Rex.Op.Global(ref) - } else { - node - } - } - - override fun visitRexOpPathIndex(node: Rex.Op.Path.Index, ctx: C): PlanNode { - val root = visitRex(node.root, ctx) as Rex - val key = visitRex(node.key, ctx) as Rex - return if (root !== node.root || key !== node.key) { - Rex.Op.Path.Index(root, key) - } else { - node - } - } - - override fun visitRexOpPathKey(node: Rex.Op.Path.Key, ctx: C): PlanNode { - val root = visitRex(node.root, ctx) as Rex - val key = visitRex(node.key, ctx) as Rex - return if (root !== node.root || key !== node.key) { - Rex.Op.Path.Key(root, key) - } else { - node - } - } - - override fun visitRexOpPathSymbol(node: Rex.Op.Path.Symbol, ctx: C): PlanNode { - val root = visitRex(node.root, ctx) as Rex - val key = node.key - return if (root !== node.root || key !== node.key) { - Rex.Op.Path.Symbol(root, key) - } else { - node - } - } - - override fun visitRexOpCallStatic(node: Rex.Op.Call.Static, ctx: C): PlanNode { - val fn = visitFn(node.fn, ctx) as Fn - val args = _visitList(node.args, ctx, ::visitRex) - return if (fn !== node.fn || args !== node.args) { - Rex.Op.Call.Static(fn, args) - } else { - node - } - } - - override fun visitRexOpCallDynamic(node: Rex.Op.Call.Dynamic, ctx: C): PlanNode { - val args = _visitList(node.args, ctx, ::visitRex) - val candidates = _visitList(node.candidates, ctx, ::visitRexOpCallDynamicCandidate) - return if (args !== node.args || candidates !== node.candidates) { - Rex.Op.Call.Dynamic(args, candidates) - } else { - node - } - } - - override fun visitRexOpCallDynamicCandidate(node: Rex.Op.Call.Dynamic.Candidate, ctx: C): PlanNode { - val fn = visitFnResolved(node.fn, ctx) as Fn.Resolved - val coercions = _visitListNull(node.coercions, ctx, ::visitFnResolved) - return if (fn !== node.fn || coercions !== node.coercions) { - Rex.Op.Call.Dynamic.Candidate(fn, coercions) - } else { - node - } - } - - override fun visitRexOpCase(node: Rex.Op.Case, ctx: C): PlanNode { - val branches = _visitList(node.branches, ctx, ::visitRexOpCaseBranch) - val default = visitRex(node.default, ctx) as Rex - return if (branches !== node.branches || default !== node.default) { - Rex.Op.Case(branches, default) - } else { - node - } - } - - override fun visitRexOpCaseBranch(node: Rex.Op.Case.Branch, ctx: C): PlanNode { - val condition = visitRex(node.condition, ctx) as Rex - val rex = visitRex(node.rex, ctx) as Rex - return if (condition !== node.condition || rex !== node.rex) { - Rex.Op.Case.Branch(condition, rex) - } else { - node - } - } - - override fun visitRexOpCollection(node: Rex.Op.Collection, ctx: C): PlanNode { - val values = _visitList(node.values, ctx, ::visitRex) - return if (values !== node.values) { - Rex.Op.Collection(values) - } else { - node - } - } - - override fun visitRexOpStruct(node: Rex.Op.Struct, ctx: C): PlanNode { - val fields = _visitList(node.fields, ctx, ::visitRexOpStructField) - return if (fields !== node.fields) { - Rex.Op.Struct(fields) - } else { - node - } - } - - override fun visitRexOpStructField(node: Rex.Op.Struct.Field, ctx: C): PlanNode { - val k = visitRex(node.k, ctx) as Rex - val v = visitRex(node.v, ctx) as Rex - return if (k !== node.k || v !== node.v) { - Rex.Op.Struct.Field(k, v) - } else { - node - } - } - - override fun visitRexOpPivot(node: Rex.Op.Pivot, ctx: C): PlanNode { - val key = visitRex(node.key, ctx) as Rex - val value = visitRex(node.value, ctx) as Rex - val rel = visitRel(node.rel, ctx) as Rel - return if (key !== node.key || value !== node.value || rel !== node.rel) { - Rex.Op.Pivot(key, value, rel) - } else { - node - } - } - - override fun visitRexOpSubquery(node: Rex.Op.Subquery, ctx: C): PlanNode { - val select = visitRexOpSelect(node.select, ctx) as Rex.Op.Select - val coercion = node.coercion - return if (select !== node.select || coercion !== node.coercion) { - Rex.Op.Subquery(select, coercion) - } else { - node - } - } - - override fun visitRexOpSelect(node: Rex.Op.Select, ctx: C): PlanNode { - val constructor = visitRex(node.constructor, ctx) as Rex - val rel = visitRel(node.rel, ctx) as Rel - return if (constructor !== node.constructor || rel !== node.rel) { - Rex.Op.Select(constructor, rel) - } else { - node - } - } - - override fun visitRexOpTupleUnion(node: Rex.Op.TupleUnion, ctx: C): PlanNode { - val args = _visitList(node.args, ctx, ::visitRex) - return if (args !== node.args) { - Rex.Op.TupleUnion(args) - } else { - node - } - } - - override fun visitRexOpErr(node: Rex.Op.Err, ctx: C): PlanNode { - val message = node.message - return node - } - - override fun visitRel(node: Rel, ctx: C): PlanNode { - val type = visitRelType(node.type, ctx) as Rel.Type - val op = visitRelOp(node.op, ctx) as Rel.Op - return if (type !== node.type || op !== node.op) { - Rel(type, op) - } else { - node - } - } - - override fun visitRelType(node: Rel.Type, ctx: C): PlanNode { - val schema = _visitList(node.schema, ctx, ::visitRelBinding) - val props = node.props - return if (schema !== node.schema || props !== node.props) { - Rel.Type(schema, props) - } else { - node - } - } - - override fun visitRelOpScan(node: Rel.Op.Scan, ctx: C): PlanNode { - val rex = visitRex(node.rex, ctx) as Rex - return if (rex !== node.rex) { - Rel.Op.Scan(rex) - } else { - node - } - } - - override fun visitRelOpScanIndexed(node: Rel.Op.ScanIndexed, ctx: C): PlanNode { - val rex = visitRex(node.rex, ctx) as Rex - return if (rex !== node.rex) { - Rel.Op.ScanIndexed(rex) - } else { - node - } - } - - override fun visitRelOpUnpivot(node: Rel.Op.Unpivot, ctx: C): PlanNode { - val rex = visitRex(node.rex, ctx) as Rex - return if (rex !== node.rex) { - Rel.Op.Unpivot(rex) - } else { - node - } - } - - override fun visitRelOpDistinct(node: Rel.Op.Distinct, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - return if (input !== node.input) { - Rel.Op.Distinct(input) - } else { - node - } - } - - override fun visitRelOpFilter(node: Rel.Op.Filter, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val predicate = visitRex(node.predicate, ctx) as Rex - return if (input !== node.input || predicate !== node.predicate) { - Rel.Op.Filter(input, predicate) - } else { - node - } - } - - override fun visitRelOpSort(node: Rel.Op.Sort, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val specs = _visitList(node.specs, ctx, ::visitRelOpSortSpec) - return if (input !== node.input || specs !== node.specs) { - Rel.Op.Sort(input, specs) - } else { - node - } - } - - override fun visitRelOpSortSpec(node: Rel.Op.Sort.Spec, ctx: C): PlanNode { - val rex = visitRex(node.rex, ctx) as Rex - val order = node.order - return if (rex !== node.rex || order !== node.order) { - Rel.Op.Sort.Spec(rex, order) - } else { - node - } - } - - override fun visitRelOpUnion(node: Rel.Op.Union, ctx: C): PlanNode { - val lhs = visitRel(node.lhs, ctx) as Rel - val rhs = visitRel(node.rhs, ctx) as Rel - return if (lhs !== node.lhs || rhs !== node.rhs) { - Rel.Op.Union(lhs, rhs) - } else { - node - } - } - - override fun visitRelOpIntersect(node: Rel.Op.Intersect, ctx: C): PlanNode { - val lhs = visitRel(node.lhs, ctx) as Rel - val rhs = visitRel(node.rhs, ctx) as Rel - return if (lhs !== node.lhs || rhs !== node.rhs) { - Rel.Op.Intersect(lhs, rhs) - } else { - node - } - } - - override fun visitRelOpExcept(node: Rel.Op.Except, ctx: C): PlanNode { - val lhs = visitRel(node.lhs, ctx) as Rel - val rhs = visitRel(node.rhs, ctx) as Rel - return if (lhs !== node.lhs || rhs !== node.rhs) { - Rel.Op.Except(lhs, rhs) - } else { - node - } - } - - override fun visitRelOpLimit(node: Rel.Op.Limit, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val limit = visitRex(node.limit, ctx) as Rex - return if (input !== node.input || limit !== node.limit) { - Rel.Op.Limit(input, limit) - } else { - node - } - } - - override fun visitRelOpOffset(node: Rel.Op.Offset, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val offset = visitRex(node.offset, ctx) as Rex - return if (input !== node.input || offset !== node.offset) { - Rel.Op.Offset(input, offset) - } else { - node - } - } - - override fun visitRelOpProject(node: Rel.Op.Project, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val projections = _visitList(node.projections, ctx, ::visitRex) - return if (input !== node.input || projections !== node.projections) { - Rel.Op.Project(input, projections) - } else { - node - } - } - - override fun visitRelOpJoin(node: Rel.Op.Join, ctx: C): PlanNode { - val lhs = visitRel(node.lhs, ctx) as Rel - val rhs = visitRel(node.rhs, ctx) as Rel - val rex = visitRex(node.rex, ctx) as Rex - val type = node.type - return if (lhs !== node.lhs || rhs !== node.rhs || rex !== node.rex || type !== node.type) { - Rel.Op.Join(lhs, rhs, rex, type) - } else { - node - } - } - - override fun visitRelOpAggregate(node: Rel.Op.Aggregate, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val strategy = node.strategy - val calls = _visitList(node.calls, ctx, ::visitRelOpAggregateCall) - val groups = _visitList(node.groups, ctx, ::visitRex) - return if (input !== node.input || strategy !== node.strategy || calls !== node.calls || groups !== node.groups) { - Rel.Op.Aggregate(input, strategy, calls, groups) - } else { - node - } - } - - override fun visitRelOpAggregateCall(node: Rel.Op.Aggregate.Call, ctx: C): PlanNode { - val agg = visitAgg(node.agg, ctx) as Agg - val args = _visitList(node.args, ctx, ::visitRex) - return if (agg !== node.agg || args !== node.args) { - Rel.Op.Aggregate.Call(agg, args) - } else { - node - } - } - - override fun visitRelOpExclude(node: Rel.Op.Exclude, ctx: C): PlanNode { - val input = visitRel(node.input, ctx) as Rel - val items = _visitList(node.items, ctx, ::visitRelOpExcludeItem) - return if (input !== node.input || items !== node.items) { - Rel.Op.Exclude(input, items) - } else { - node - } - } - - override fun visitRelOpExcludeItem(node: Rel.Op.Exclude.Item, ctx: C): PlanNode { - val root = visitRexOpVar(node.root, ctx) as Rex.Op.Var - val steps = _visitList(node.steps, ctx, ::visitRelOpExcludeStep) - return if (root !== node.root || steps !== node.steps) { - Rel.Op.Exclude.Item(root, steps) - } else { - node - } - } - - override fun visitRelOpExcludeStepStructField( - node: Rel.Op.Exclude.Step.StructField, - ctx: C - ): PlanNode { - val symbol = visitIdentifierSymbol(node.symbol, ctx) as Identifier.Symbol - return if (symbol !== node.symbol) { - Rel.Op.Exclude.Step.StructField(symbol) - } else { - node - } - } - - override fun visitRelOpExcludeStepCollIndex(node: Rel.Op.Exclude.Step.CollIndex, ctx: C): - PlanNode { - val index = node.index - return node - } - - override fun visitRelOpExcludeStepStructWildcard( - node: Rel.Op.Exclude.Step.StructWildcard, - ctx: C - ): PlanNode = node - - override fun visitRelOpExcludeStepCollWildcard( - node: Rel.Op.Exclude.Step.CollWildcard, - ctx: C - ): PlanNode = node - - override fun visitRelOpErr(node: Rel.Op.Err, ctx: C): PlanNode { - val message = node.message - return node - } - - override fun visitRelBinding(node: Rel.Binding, ctx: C): PlanNode { - val name = node.name - val type = node.type - return node - } -} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanBaseVisitor.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanBaseVisitor.kt deleted file mode 100644 index 901d17895..000000000 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanBaseVisitor.kt +++ /dev/null @@ -1,273 +0,0 @@ -@file:OptIn(PartiQLValueExperimental::class) - -package org.partiql.planner.internal.ir.visitor - -import org.partiql.planner.internal.ir.Agg -import org.partiql.planner.internal.ir.Catalog -import org.partiql.planner.internal.ir.Fn -import org.partiql.planner.internal.ir.Identifier -import org.partiql.planner.internal.ir.PartiQLPlan -import org.partiql.planner.internal.ir.PlanNode -import org.partiql.planner.internal.ir.Rel -import org.partiql.planner.internal.ir.Rex -import org.partiql.planner.internal.ir.Statement -import org.partiql.value.PartiQLValueExperimental - -internal abstract class PlanBaseVisitor : PlanVisitor { - override fun visit(node: PlanNode, ctx: C): R = node.accept(this, ctx) - - override fun visitPartiQLPlan(node: PartiQLPlan, ctx: C): R = defaultVisit(node, ctx) - - public override fun visitCatalog(node: Catalog, ctx: C): R = defaultVisit(node, ctx) - - public override fun visitCatalogSymbol(node: Catalog.Symbol, ctx: C): R = defaultVisit(node, ctx) - - public override fun visitCatalogSymbolRef(node: Catalog.Symbol.Ref, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitFn(node: Fn, ctx: C): R = when (node) { - is Fn.Resolved -> visitFnResolved(node, ctx) - is Fn.Unresolved -> visitFnUnresolved(node, ctx) - } - - override fun visitFnResolved(node: Fn.Resolved, ctx: C): R = defaultVisit(node, ctx) - - override fun visitFnUnresolved(node: Fn.Unresolved, ctx: C): R = defaultVisit(node, ctx) - - override fun visitAgg(node: Agg, ctx: C): R = when (node) { - is Agg.Resolved -> visitAggResolved(node, ctx) - is Agg.Unresolved -> visitAggUnresolved(node, ctx) - } - - override fun visitAggResolved(node: Agg.Resolved, ctx: C): R = defaultVisit(node, ctx) - - override fun visitAggUnresolved(node: Agg.Unresolved, ctx: C): R = defaultVisit(node, ctx) - - override fun visitStatement(node: Statement, ctx: C): R = when (node) { - is Statement.Query -> visitStatementQuery(node, ctx) - } - - override fun visitStatementQuery(node: Statement.Query, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitIdentifier(node: Identifier, ctx: C): R = when (node) { - is Identifier.Symbol -> visitIdentifierSymbol(node, ctx) - is Identifier.Qualified -> visitIdentifierQualified(node, ctx) - } - - override fun visitIdentifierSymbol(node: Identifier.Symbol, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitIdentifierQualified(node: Identifier.Qualified, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRex(node: Rex, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOp(node: Rex.Op, ctx: C): R = when (node) { - is Rex.Op.Lit -> visitRexOpLit(node, ctx) - is Rex.Op.Var -> visitRexOpVar(node, ctx) - is Rex.Op.Global -> visitRexOpGlobal(node, ctx) - is Rex.Op.Path -> visitRexOpPath(node, ctx) - is Rex.Op.Call -> visitRexOpCall(node, ctx) - is Rex.Op.Case -> visitRexOpCase(node, ctx) - is Rex.Op.Collection -> visitRexOpCollection(node, ctx) - is Rex.Op.Struct -> visitRexOpStruct(node, ctx) - is Rex.Op.Pivot -> visitRexOpPivot(node, ctx) - is Rex.Op.Subquery -> visitRexOpSubquery(node, ctx) - is Rex.Op.Select -> visitRexOpSelect(node, ctx) - is Rex.Op.TupleUnion -> visitRexOpTupleUnion(node, ctx) - is Rex.Op.Err -> visitRexOpErr(node, ctx) - } - - override fun visitRexOpLit(node: Rex.Op.Lit, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpVar(node: Rex.Op.Var, ctx: C): R = when (node) { - is Rex.Op.Var.Resolved -> visitRexOpVarResolved(node, ctx) - is Rex.Op.Var.Unresolved -> visitRexOpVarUnresolved(node, ctx) - } - - override fun visitRexOpVarResolved(node: Rex.Op.Var.Resolved, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRexOpVarUnresolved(node: Rex.Op.Var.Unresolved, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRexOpGlobal(node: Rex.Op.Global, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpPath(node: Rex.Op.Path, ctx: C): R = when (node) { - is Rex.Op.Path.Index -> visitRexOpPathIndex(node, ctx) - is Rex.Op.Path.Key -> visitRexOpPathKey(node, ctx) - is Rex.Op.Path.Symbol -> visitRexOpPathSymbol(node, ctx) - } - - override fun visitRexOpPathIndex(node: Rex.Op.Path.Index, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRexOpPathKey(node: Rex.Op.Path.Key, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpPathSymbol(node: Rex.Op.Path.Symbol, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRexOpCall(node: Rex.Op.Call, ctx: C): R = when (node) { - is Rex.Op.Call.Static -> visitRexOpCallStatic(node, ctx) - is Rex.Op.Call.Dynamic -> visitRexOpCallDynamic(node, ctx) - } - - override fun visitRexOpCallStatic(node: Rex.Op.Call.Static, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRexOpCallDynamic(node: Rex.Op.Call.Dynamic, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRexOpCallDynamicCandidate(node: Rex.Op.Call.Dynamic.Candidate, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRexOpCase(node: Rex.Op.Case, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpCaseBranch(node: Rex.Op.Case.Branch, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRexOpCollection(node: Rex.Op.Collection, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRexOpStruct(node: Rex.Op.Struct, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpStructField(node: Rex.Op.Struct.Field, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRexOpPivot(node: Rex.Op.Pivot, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpSubquery(node: Rex.Op.Subquery, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpSelect(node: Rex.Op.Select, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRexOpTupleUnion(node: Rex.Op.TupleUnion, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRexOpErr(node: Rex.Op.Err, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRel(node: Rel, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelType(node: Rel.Type, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOp(node: Rel.Op, ctx: C): R = when (node) { - is Rel.Op.Scan -> visitRelOpScan(node, ctx) - is Rel.Op.ScanIndexed -> visitRelOpScanIndexed(node, ctx) - is Rel.Op.Unpivot -> visitRelOpUnpivot(node, ctx) - is Rel.Op.Distinct -> visitRelOpDistinct(node, ctx) - is Rel.Op.Filter -> visitRelOpFilter(node, ctx) - is Rel.Op.Sort -> visitRelOpSort(node, ctx) - is Rel.Op.Union -> visitRelOpUnion(node, ctx) - is Rel.Op.Intersect -> visitRelOpIntersect(node, ctx) - is Rel.Op.Except -> visitRelOpExcept(node, ctx) - is Rel.Op.Limit -> visitRelOpLimit(node, ctx) - is Rel.Op.Offset -> visitRelOpOffset(node, ctx) - is Rel.Op.Project -> visitRelOpProject(node, ctx) - is Rel.Op.Join -> visitRelOpJoin(node, ctx) - is Rel.Op.Aggregate -> visitRelOpAggregate(node, ctx) - is Rel.Op.Exclude -> visitRelOpExclude(node, ctx) - is Rel.Op.Err -> visitRelOpErr(node, ctx) - } - - override fun visitRelOpScan(node: Rel.Op.Scan, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpScanIndexed(node: Rel.Op.ScanIndexed, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRelOpUnpivot(node: Rel.Op.Unpivot, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpDistinct(node: Rel.Op.Distinct, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpFilter(node: Rel.Op.Filter, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpSort(node: Rel.Op.Sort, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpSortSpec(node: Rel.Op.Sort.Spec, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRelOpUnion(node: Rel.Op.Union, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpIntersect(node: Rel.Op.Intersect, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRelOpExcept(node: Rel.Op.Except, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpLimit(node: Rel.Op.Limit, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpOffset(node: Rel.Op.Offset, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpProject(node: Rel.Op.Project, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpJoin(node: Rel.Op.Join, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpAggregate(node: Rel.Op.Aggregate, ctx: C): R = defaultVisit( - node, - ctx - ) - - override fun visitRelOpAggregateCall(node: Rel.Op.Aggregate.Call, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRelOpExclude(node: Rel.Op.Exclude, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelOpExcludeItem(node: Rel.Op.Exclude.Item, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRelOpExcludeStep(node: Rel.Op.Exclude.Step, ctx: C): R = when (node) { - is Rel.Op.Exclude.Step.StructField -> visitRelOpExcludeStepStructField(node, ctx) - is Rel.Op.Exclude.Step.CollIndex -> visitRelOpExcludeStepCollIndex(node, ctx) - is Rel.Op.Exclude.Step.StructWildcard -> visitRelOpExcludeStepStructWildcard(node, ctx) - is Rel.Op.Exclude.Step.CollWildcard -> visitRelOpExcludeStepCollWildcard(node, ctx) - } - - override fun visitRelOpExcludeStepStructField( - node: Rel.Op.Exclude.Step.StructField, - ctx: C - ): R = defaultVisit(node, ctx) - - override fun visitRelOpExcludeStepCollIndex(node: Rel.Op.Exclude.Step.CollIndex, ctx: C): R = - defaultVisit(node, ctx) - - override fun visitRelOpExcludeStepStructWildcard( - node: Rel.Op.Exclude.Step.StructWildcard, - ctx: C - ): R = defaultVisit(node, ctx) - - override fun visitRelOpExcludeStepCollWildcard( - node: Rel.Op.Exclude.Step.CollWildcard, - ctx: C - ): R = defaultVisit(node, ctx) - - override fun visitRelOpErr(node: Rel.Op.Err, ctx: C): R = defaultVisit(node, ctx) - - override fun visitRelBinding(node: Rel.Binding, ctx: C): R = defaultVisit(node, ctx) - - internal open fun defaultVisit(node: PlanNode, ctx: C): R { - for (child in node.children) { - child.accept(this, ctx) - } - return defaultReturn(node, ctx) - } - - internal abstract fun defaultReturn(node: PlanNode, ctx: C): R -} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanVisitor.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanVisitor.kt deleted file mode 100644 index c2fd04e7b..000000000 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/ir/visitor/PlanVisitor.kt +++ /dev/null @@ -1,153 +0,0 @@ -@file:OptIn(PartiQLValueExperimental::class) - -package org.partiql.planner.internal.ir.visitor - -import org.partiql.planner.internal.ir.Agg -import org.partiql.planner.internal.ir.Catalog -import org.partiql.planner.internal.ir.Fn -import org.partiql.planner.internal.ir.Identifier -import org.partiql.planner.internal.ir.PartiQLPlan -import org.partiql.planner.internal.ir.PlanNode -import org.partiql.planner.internal.ir.Rel -import org.partiql.planner.internal.ir.Rex -import org.partiql.planner.internal.ir.Statement -import org.partiql.value.PartiQLValueExperimental - -internal interface PlanVisitor { - fun visit(node: PlanNode, ctx: C): R - - fun visitPartiQLPlan(node: PartiQLPlan, ctx: C): R - - public fun visitCatalog(node: Catalog, ctx: C): R - - public fun visitCatalogSymbol(node: Catalog.Symbol, ctx: C): R - - public fun visitCatalogSymbolRef(node: Catalog.Symbol.Ref, ctx: C): R - - fun visitFn(node: Fn, ctx: C): R - - fun visitFnResolved(node: Fn.Resolved, ctx: C): R - - fun visitFnUnresolved(node: Fn.Unresolved, ctx: C): R - - fun visitAgg(node: Agg, ctx: C): R - - fun visitAggResolved(node: Agg.Resolved, ctx: C): R - - fun visitAggUnresolved(node: Agg.Unresolved, ctx: C): R - - fun visitStatement(node: Statement, ctx: C): R - - fun visitStatementQuery(node: Statement.Query, ctx: C): R - - fun visitIdentifier(node: Identifier, ctx: C): R - - fun visitIdentifierSymbol(node: Identifier.Symbol, ctx: C): R - - fun visitIdentifierQualified(node: Identifier.Qualified, ctx: C): R - - fun visitRex(node: Rex, ctx: C): R - - fun visitRexOp(node: Rex.Op, ctx: C): R - - fun visitRexOpLit(node: Rex.Op.Lit, ctx: C): R - - fun visitRexOpVar(node: Rex.Op.Var, ctx: C): R - - fun visitRexOpVarResolved(node: Rex.Op.Var.Resolved, ctx: C): R - - fun visitRexOpVarUnresolved(node: Rex.Op.Var.Unresolved, ctx: C): R - - fun visitRexOpGlobal(node: Rex.Op.Global, ctx: C): R - - fun visitRexOpPath(node: Rex.Op.Path, ctx: C): R - - fun visitRexOpPathIndex(node: Rex.Op.Path.Index, ctx: C): R - - fun visitRexOpPathKey(node: Rex.Op.Path.Key, ctx: C): R - - fun visitRexOpPathSymbol(node: Rex.Op.Path.Symbol, ctx: C): R - - fun visitRexOpCall(node: Rex.Op.Call, ctx: C): R - - fun visitRexOpCallStatic(node: Rex.Op.Call.Static, ctx: C): R - - fun visitRexOpCallDynamic(node: Rex.Op.Call.Dynamic, ctx: C): R - - fun visitRexOpCallDynamicCandidate(node: Rex.Op.Call.Dynamic.Candidate, ctx: C): R - - fun visitRexOpCase(node: Rex.Op.Case, ctx: C): R - - fun visitRexOpCaseBranch(node: Rex.Op.Case.Branch, ctx: C): R - - fun visitRexOpCollection(node: Rex.Op.Collection, ctx: C): R - - fun visitRexOpStruct(node: Rex.Op.Struct, ctx: C): R - - fun visitRexOpStructField(node: Rex.Op.Struct.Field, ctx: C): R - - fun visitRexOpPivot(node: Rex.Op.Pivot, ctx: C): R - - fun visitRexOpSubquery(node: Rex.Op.Subquery, ctx: C): R - - fun visitRexOpSelect(node: Rex.Op.Select, ctx: C): R - - fun visitRexOpTupleUnion(node: Rex.Op.TupleUnion, ctx: C): R - - fun visitRexOpErr(node: Rex.Op.Err, ctx: C): R - - fun visitRel(node: Rel, ctx: C): R - - fun visitRelType(node: Rel.Type, ctx: C): R - - fun visitRelOp(node: Rel.Op, ctx: C): R - - fun visitRelOpScan(node: Rel.Op.Scan, ctx: C): R - - fun visitRelOpScanIndexed(node: Rel.Op.ScanIndexed, ctx: C): R - - fun visitRelOpUnpivot(node: Rel.Op.Unpivot, ctx: C): R - - fun visitRelOpDistinct(node: Rel.Op.Distinct, ctx: C): R - - fun visitRelOpFilter(node: Rel.Op.Filter, ctx: C): R - - fun visitRelOpSort(node: Rel.Op.Sort, ctx: C): R - - fun visitRelOpSortSpec(node: Rel.Op.Sort.Spec, ctx: C): R - - fun visitRelOpUnion(node: Rel.Op.Union, ctx: C): R - - fun visitRelOpIntersect(node: Rel.Op.Intersect, ctx: C): R - - fun visitRelOpExcept(node: Rel.Op.Except, ctx: C): R - - fun visitRelOpLimit(node: Rel.Op.Limit, ctx: C): R - - fun visitRelOpOffset(node: Rel.Op.Offset, ctx: C): R - - fun visitRelOpProject(node: Rel.Op.Project, ctx: C): R - - fun visitRelOpJoin(node: Rel.Op.Join, ctx: C): R - - fun visitRelOpAggregate(node: Rel.Op.Aggregate, ctx: C): R - - fun visitRelOpAggregateCall(node: Rel.Op.Aggregate.Call, ctx: C): R - - fun visitRelOpExclude(node: Rel.Op.Exclude, ctx: C): R - - fun visitRelOpExcludeItem(node: Rel.Op.Exclude.Item, ctx: C): R - - fun visitRelOpExcludeStep(node: Rel.Op.Exclude.Step, ctx: C): R - - fun visitRelOpExcludeStepStructField(node: Rel.Op.Exclude.Step.StructField, ctx: C): R - - fun visitRelOpExcludeStepCollIndex(node: Rel.Op.Exclude.Step.CollIndex, ctx: C): R - - fun visitRelOpExcludeStepStructWildcard(node: Rel.Op.Exclude.Step.StructWildcard, ctx: C): - R - - fun visitRelOpExcludeStepCollWildcard(node: Rel.Op.Exclude.Step.CollWildcard, ctx: C): R fun visitRelOpErr(node: Rel.Op.Err, ctx: C): R - - fun visitRelBinding(node: Rel.Binding, ctx: C): R -} diff --git a/partiql-planner/src/main/resources/builtins.sql b/partiql-planner/src/main/resources/builtins.sql deleted file mode 100644 index a15ead3f6..000000000 --- a/partiql-planner/src/main/resources/builtins.sql +++ /dev/null @@ -1,1681 +0,0 @@ --- [trim] --------- - -CREATE FUNCTION "TRIM"( - VALUE STRING) - RETURNS STRING - SPECIFIC - - RETURN TRIM ( VALUE ); - -CREATE FUNCTION "TRIM"( - VALUE NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN TRIM ( VALUE ); - -CREATE FUNCTION "TRIM"( - VALUE SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN TRIM ( VALUE ); - -CREATE FUNCTION "TRIM"( - VALUE NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN TRIM ( VALUE ); - - --- [trim_leading] --------- - -CREATE FUNCTION "TRIM_LEADING"( - VALUE STRING) - RETURNS STRING - SPECIFIC - - RETURN TRIM_LEADING ( VALUE ); - -CREATE FUNCTION "TRIM_LEADING"( - VALUE NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN TRIM_LEADING ( VALUE ); - -CREATE FUNCTION "TRIM_LEADING"( - VALUE SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN TRIM_LEADING ( VALUE ); - -CREATE FUNCTION "TRIM_LEADING"( - VALUE NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN TRIM_LEADING ( VALUE ); - - --- [trim_trailing] --------- - -CREATE FUNCTION "TRIM_TRAILING"( - VALUE STRING) - RETURNS STRING - SPECIFIC - - RETURN TRIM_TRAILING ( VALUE ); - -CREATE FUNCTION "TRIM_TRAILING"( - VALUE NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN TRIM_TRAILING ( VALUE ); - -CREATE FUNCTION "TRIM_TRAILING"( - VALUE SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN TRIM_TRAILING ( VALUE ); - -CREATE FUNCTION "TRIM_TRAILING"( - VALUE NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN TRIM_TRAILING ( VALUE ); - - --- [null_if] --------- - -CREATE FUNCTION "NULL_IF"( - VALUE NULL - NULLIFIER BOOL) - RETURNS NULL - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE MISSING - NULLIFIER BOOL) - RETURNS MISSING - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_BOOL - NULLIFIER BOOL) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_INT8 - NULLIFIER BOOL) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_INT16 - NULLIFIER BOOL) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_INT32 - NULLIFIER BOOL) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_INT64 - NULLIFIER BOOL) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_INT - NULLIFIER BOOL) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_DECIMAL - NULLIFIER BOOL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_FLOAT32 - NULLIFIER BOOL) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_FLOAT64 - NULLIFIER BOOL) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_CHAR - NULLIFIER BOOL) - RETURNS NULLABLE_CHAR - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_STRING - NULLIFIER BOOL) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_SYMBOL - NULLIFIER BOOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_CLOB - NULLIFIER BOOL) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_BINARY - NULLIFIER BOOL) - RETURNS NULLABLE_BINARY - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_BYTE - NULLIFIER BOOL) - RETURNS NULLABLE_BYTE - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_BLOB - NULLIFIER BOOL) - RETURNS NULLABLE_BLOB - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_DATE - NULLIFIER BOOL) - RETURNS NULLABLE_DATE - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_TIME - NULLIFIER BOOL) - RETURNS NULLABLE_TIME - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_TIMESTAMP - NULLIFIER BOOL) - RETURNS NULLABLE_TIMESTAMP - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_INTERVAL - NULLIFIER BOOL) - RETURNS NULLABLE_INTERVAL - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_LIST - NULLIFIER BOOL) - RETURNS NULLABLE_LIST - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_BAG - NULLIFIER BOOL) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_SEXP - NULLIFIER BOOL) - RETURNS NULLABLE_SEXP - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - -CREATE FUNCTION "NULL_IF"( - VALUE NULLABLE_STRUCT - NULLIFIER BOOL) - RETURNS NULLABLE_STRUCT - SPECIFIC - - RETURN NULL_IF ( VALUE, NULLIFIER ); - - --- [in_collection] --------- - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE MISSING - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE MISSING - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE MISSING - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BOOL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BOOL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BOOL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BOOL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BOOL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BOOL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT8 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT8 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT8 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT8 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT8 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT8 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT16 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT16 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT16 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT16 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT16 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT16 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT32 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT32 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT32 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT32 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT32 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT32 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT64 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT64 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT64 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT64 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT64 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT64 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INT - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INT - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE DECIMAL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE DECIMAL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE DECIMAL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_DECIMAL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_DECIMAL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_DECIMAL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE FLOAT32 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE FLOAT32 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE FLOAT32 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_FLOAT32 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_FLOAT32 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_FLOAT32 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE FLOAT64 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE FLOAT64 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE FLOAT64 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_FLOAT64 - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_FLOAT64 - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_FLOAT64 - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE CHAR - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE CHAR - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE CHAR - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_CHAR - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_CHAR - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_CHAR - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE STRING - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE STRING - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE STRING - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_STRING - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_STRING - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_STRING - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE SYMBOL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE SYMBOL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE SYMBOL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_SYMBOL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_SYMBOL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_SYMBOL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE CLOB - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE CLOB - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE CLOB - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_CLOB - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_CLOB - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_CLOB - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BINARY - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BINARY - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BINARY - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BINARY - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BINARY - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BINARY - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BYTE - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BYTE - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BYTE - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BYTE - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BYTE - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BYTE - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BLOB - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BLOB - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BLOB - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BLOB - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BLOB - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BLOB - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE DATE - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE DATE - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE DATE - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_DATE - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_DATE - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_DATE - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE TIME - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE TIME - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE TIME - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_TIME - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_TIME - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_TIME - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE TIMESTAMP - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE TIMESTAMP - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE TIMESTAMP - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_TIMESTAMP - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_TIMESTAMP - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_TIMESTAMP - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INTERVAL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INTERVAL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE INTERVAL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INTERVAL - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INTERVAL - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_INTERVAL - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE LIST - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE LIST - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE LIST - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_LIST - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_LIST - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_LIST - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BAG - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BAG - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE BAG - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BAG - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BAG - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_BAG - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE SEXP - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE SEXP - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE SEXP - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_SEXP - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_SEXP - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_SEXP - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE STRUCT - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE STRUCT - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE STRUCT - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_STRUCT - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_STRUCT - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE NULLABLE_STRUCT - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE GRAPH - COLLECTION LIST) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE GRAPH - COLLECTION BAG) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - -CREATE FUNCTION "IN_COLLECTION"( - VALUE GRAPH - COLLECTION SEXP) - RETURNS BOOL - SPECIFIC - - RETURN IN_COLLECTION ( VALUE, COLLECTION ); - - --- [substring] --------- - -CREATE FUNCTION "SUBSTRING"( - VALUE STRING - START INT64) - RETURNS STRING - SPECIFIC - - RETURN SUBSTRING ( VALUE, START ); - -CREATE FUNCTION "SUBSTRING"( - VALUE NULLABLE_STRING - START INT64) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN SUBSTRING ( VALUE, START ); - -CREATE FUNCTION "SUBSTRING"( - VALUE SYMBOL - START INT64) - RETURNS SYMBOL - SPECIFIC - - RETURN SUBSTRING ( VALUE, START ); - -CREATE FUNCTION "SUBSTRING"( - VALUE NULLABLE_SYMBOL - START INT64) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN SUBSTRING ( VALUE, START ); - - --- [like] --------- - -CREATE FUNCTION "LIKE"( - VALUE STRING - PATTERN STRING) - RETURNS BOOL - SPECIFIC - - RETURN LIKE ( VALUE, PATTERN ); - - --- [position] --------- - -CREATE FUNCTION "POSITION"( - PROBE STRING - VALUE STRING) - RETURNS INT64 - SPECIFIC - - RETURN POSITION ( PROBE, VALUE ); - -CREATE FUNCTION "POSITION"( - PROBE NULLABLE_STRING - VALUE NULLABLE_STRING) - RETURNS INT64 - SPECIFIC - - RETURN POSITION ( PROBE, VALUE ); - -CREATE FUNCTION "POSITION"( - PROBE SYMBOL - VALUE SYMBOL) - RETURNS INT64 - SPECIFIC - - RETURN POSITION ( PROBE, VALUE ); - -CREATE FUNCTION "POSITION"( - PROBE NULLABLE_SYMBOL - VALUE NULLABLE_SYMBOL) - RETURNS INT64 - SPECIFIC - - RETURN POSITION ( PROBE, VALUE ); - - --- [trim_chars] --------- - -CREATE FUNCTION "TRIM_CHARS"( - VALUE STRING - CHARS STRING) - RETURNS STRING - SPECIFIC - - RETURN TRIM_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_CHARS"( - VALUE NULLABLE_STRING - CHARS NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN TRIM_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_CHARS"( - VALUE SYMBOL - CHARS SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN TRIM_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_CHARS"( - VALUE NULLABLE_SYMBOL - CHARS NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN TRIM_CHARS ( VALUE, CHARS ); - - --- [trim_leading_chars] --------- - -CREATE FUNCTION "TRIM_LEADING_CHARS"( - VALUE STRING - CHARS STRING) - RETURNS STRING - SPECIFIC - - RETURN TRIM_LEADING_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_LEADING_CHARS"( - VALUE NULLABLE_STRING - CHARS NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN TRIM_LEADING_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_LEADING_CHARS"( - VALUE SYMBOL - CHARS SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN TRIM_LEADING_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_LEADING_CHARS"( - VALUE NULLABLE_SYMBOL - CHARS NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN TRIM_LEADING_CHARS ( VALUE, CHARS ); - - --- [trim_trailing_chars] --------- - -CREATE FUNCTION "TRIM_TRAILING_CHARS"( - VALUE STRING - CHARS STRING) - RETURNS STRING - SPECIFIC - - RETURN TRIM_TRAILING_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_TRAILING_CHARS"( - VALUE NULLABLE_STRING - CHARS NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN TRIM_TRAILING_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_TRAILING_CHARS"( - VALUE SYMBOL - CHARS SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN TRIM_TRAILING_CHARS ( VALUE, CHARS ); - -CREATE FUNCTION "TRIM_TRAILING_CHARS"( - VALUE NULLABLE_SYMBOL - CHARS NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN TRIM_TRAILING_CHARS ( VALUE, CHARS ); - - --- [between] --------- - -CREATE FUNCTION "BETWEEN"( - VALUE INT8 - LOWER INT8 - UPPER INT8) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_INT8 - LOWER NULLABLE_INT8 - UPPER NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE INT16 - LOWER INT16 - UPPER INT16) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_INT16 - LOWER NULLABLE_INT16 - UPPER NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE INT32 - LOWER INT32 - UPPER INT32) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_INT32 - LOWER NULLABLE_INT32 - UPPER NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE INT64 - LOWER INT64 - UPPER INT64) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_INT64 - LOWER NULLABLE_INT64 - UPPER NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE INT - LOWER INT - UPPER INT) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_INT - LOWER NULLABLE_INT - UPPER NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE DECIMAL - LOWER DECIMAL - UPPER DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_DECIMAL - LOWER NULLABLE_DECIMAL - UPPER NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE FLOAT32 - LOWER FLOAT32 - UPPER FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_FLOAT32 - LOWER NULLABLE_FLOAT32 - UPPER NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE FLOAT64 - LOWER FLOAT64 - UPPER FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - -CREATE FUNCTION "BETWEEN"( - VALUE NULLABLE_FLOAT64 - LOWER NULLABLE_FLOAT64 - UPPER NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN BETWEEN ( VALUE, LOWER, UPPER ); - - --- [substring_length] --------- - -CREATE FUNCTION "SUBSTRING_LENGTH"( - VALUE STRING - START INT64 - END INT64) - RETURNS STRING - SPECIFIC - - RETURN SUBSTRING_LENGTH ( VALUE, START, END ); - -CREATE FUNCTION "SUBSTRING_LENGTH"( - VALUE NULLABLE_STRING - START INT64 - END INT64) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN SUBSTRING_LENGTH ( VALUE, START, END ); - -CREATE FUNCTION "SUBSTRING_LENGTH"( - VALUE SYMBOL - START INT64 - END INT64) - RETURNS SYMBOL - SPECIFIC - - RETURN SUBSTRING_LENGTH ( VALUE, START, END ); - -CREATE FUNCTION "SUBSTRING_LENGTH"( - VALUE NULLABLE_SYMBOL - START INT64 - END INT64) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN SUBSTRING_LENGTH ( VALUE, START, END ); - - --- [like_escape] --------- - -CREATE FUNCTION "LIKE_ESCAPE"( - VALUE STRING - PATTERN STRING - ESCAPE STRING) - RETURNS BOOL - SPECIFIC - - RETURN LIKE_ESCAPE ( VALUE, PATTERN, ESCAPE ); - diff --git a/partiql-planner/src/main/resources/casts.sql b/partiql-planner/src/main/resources/casts.sql deleted file mode 100644 index d985ddc24..000000000 --- a/partiql-planner/src/main/resources/casts.sql +++ /dev/null @@ -1,1982 +0,0 @@ --- [cast] --------- - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (INT8)) - RETURNS INT8 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (INT16)) - RETURNS INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (INT32)) - RETURNS INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (INT64)) - RETURNS INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (INT)) - RETURNS INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (CHAR)) - RETURNS CHAR - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_INT8)) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_INT16)) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_CHAR)) - RETURNS NULLABLE_CHAR - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BOOL - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_INT8)) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_INT16)) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_CHAR)) - RETURNS NULLABLE_CHAR - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BOOL - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (INT8)) - RETURNS INT8 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (INT16)) - RETURNS INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (INT32)) - RETURNS INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (INT64)) - RETURNS INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (INT)) - RETURNS INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_INT8)) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_INT16)) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT8 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_INT8)) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_INT16)) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT8 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (INT16)) - RETURNS INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (INT32)) - RETURNS INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (INT64)) - RETURNS INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (INT)) - RETURNS INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_INT16)) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT16 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_INT16)) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT16 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (INT32)) - RETURNS INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (INT64)) - RETURNS INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (INT)) - RETURNS INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT32 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_INT32)) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT32 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (INT64)) - RETURNS INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (INT)) - RETURNS INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT64 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_INT64)) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT64 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (INT)) - RETURNS INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE INT - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_INT)) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_INT - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (DECIMAL)) - RETURNS DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE DECIMAL - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_DECIMAL - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_DECIMAL - TYPE TYPE (NULLABLE_DECIMAL)) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_DECIMAL - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_DECIMAL - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_DECIMAL - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_DECIMAL - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (FLOAT32)) - RETURNS FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT32 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT32 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT32 - TYPE TYPE (NULLABLE_FLOAT32)) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT32 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT32 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT32 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (FLOAT64)) - RETURNS FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE FLOAT64 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT64 - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT64 - TYPE TYPE (NULLABLE_FLOAT64)) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT64 - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_FLOAT64 - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (CHAR)) - RETURNS CHAR - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (NULLABLE_CHAR)) - RETURNS NULLABLE_CHAR - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CHAR - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_CHAR - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_CHAR - TYPE TYPE (NULLABLE_CHAR)) - RETURNS NULLABLE_CHAR - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_CHAR - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_CHAR - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (CLOB)) - RETURNS CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRING - TYPE TYPE (NULLABLE_CLOB)) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (CLOB)) - RETURNS CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRING - TYPE TYPE (NULLABLE_CLOB)) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (BOOL)) - RETURNS BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (STRING)) - RETURNS STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (SYMBOL)) - RETURNS SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (CLOB)) - RETURNS CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SYMBOL - TYPE TYPE (NULLABLE_CLOB)) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SYMBOL - TYPE TYPE (NULLABLE_BOOL)) - RETURNS NULLABLE_BOOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SYMBOL - TYPE TYPE (NULLABLE_STRING)) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SYMBOL - TYPE TYPE (NULLABLE_SYMBOL)) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SYMBOL - TYPE TYPE (NULLABLE_CLOB)) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CLOB - TYPE TYPE (CLOB)) - RETURNS CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE CLOB - TYPE TYPE (NULLABLE_CLOB)) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_CLOB - TYPE TYPE (NULLABLE_CLOB)) - RETURNS NULLABLE_CLOB - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE LIST - TYPE TYPE (BAG)) - RETURNS BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE LIST - TYPE TYPE (LIST)) - RETURNS LIST - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE LIST - TYPE TYPE (SEXP)) - RETURNS SEXP - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE LIST - TYPE TYPE (NULLABLE_BAG)) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE LIST - TYPE TYPE (NULLABLE_LIST)) - RETURNS NULLABLE_LIST - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE LIST - TYPE TYPE (NULLABLE_SEXP)) - RETURNS NULLABLE_SEXP - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_LIST - TYPE TYPE (NULLABLE_BAG)) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_LIST - TYPE TYPE (NULLABLE_LIST)) - RETURNS NULLABLE_LIST - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_LIST - TYPE TYPE (NULLABLE_SEXP)) - RETURNS NULLABLE_SEXP - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BAG - TYPE TYPE (BAG)) - RETURNS BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE BAG - TYPE TYPE (NULLABLE_BAG)) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_BAG - TYPE TYPE (NULLABLE_BAG)) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SEXP - TYPE TYPE (BAG)) - RETURNS BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SEXP - TYPE TYPE (LIST)) - RETURNS LIST - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SEXP - TYPE TYPE (SEXP)) - RETURNS SEXP - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SEXP - TYPE TYPE (NULLABLE_BAG)) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SEXP - TYPE TYPE (NULLABLE_LIST)) - RETURNS NULLABLE_LIST - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE SEXP - TYPE TYPE (NULLABLE_SEXP)) - RETURNS NULLABLE_SEXP - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SEXP - TYPE TYPE (NULLABLE_BAG)) - RETURNS NULLABLE_BAG - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SEXP - TYPE TYPE (NULLABLE_LIST)) - RETURNS NULLABLE_LIST - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_SEXP - TYPE TYPE (NULLABLE_SEXP)) - RETURNS NULLABLE_SEXP - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRUCT - TYPE TYPE (STRUCT)) - RETURNS STRUCT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE STRUCT - TYPE TYPE (NULLABLE_STRUCT)) - RETURNS NULLABLE_STRUCT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); - -CREATE FUNCTION "CAST"( - VALUE NULLABLE_STRUCT - TYPE TYPE (NULLABLE_STRUCT)) - RETURNS NULLABLE_STRUCT - SPECIFIC - - RETURN CAST ( VALUE, TYPE ); diff --git a/partiql-planner/src/main/resources/operators.sql b/partiql-planner/src/main/resources/operators.sql deleted file mode 100644 index a4e17f855..000000000 --- a/partiql-planner/src/main/resources/operators.sql +++ /dev/null @@ -1,2031 +0,0 @@ ---- [not] --------- - -CREATE FUNCTION "NOT"( - VALUE BOOL) - RETURNS BOOL - SPECIFIC - - RETURN NOT ( VALUE ); - -CREATE FUNCTION "NOT"( - VALUE BOOL) - RETURNS BOOL - SPECIFIC - - RETURN NOT ( VALUE ); - - ---- [pos] --------- - -CREATE FUNCTION "POS"( - VALUE INT8) - RETURNS INT8 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE INT16) - RETURNS INT16 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE INT32) - RETURNS INT32 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE INT64) - RETURNS INT64 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE INT) - RETURNS INT - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN POS ( VALUE ); - -CREATE FUNCTION "POS"( - VALUE NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN POS ( VALUE ); - - ---- [neg] --------- - -CREATE FUNCTION "NEG"( - VALUE INT8) - RETURNS INT8 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE INT16) - RETURNS INT16 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE INT32) - RETURNS INT32 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE INT64) - RETURNS INT64 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE INT) - RETURNS INT - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN NEG ( VALUE ); - -CREATE FUNCTION "NEG"( - VALUE NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN NEG ( VALUE ); - - ---- [eq] --------- - -CREATE FUNCTION "EQ"( - LHS NULL - RHS NULL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS MISSING - RHS MISSING) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS BOOL - RHS BOOL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_BOOL - RHS NULLABLE_BOOL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS INT8 - RHS INT8) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS INT16 - RHS INT16) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS INT32 - RHS INT32) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS INT64 - RHS INT64) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS INT - RHS INT) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS DECIMAL - RHS DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS CHAR - RHS CHAR) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_CHAR - RHS NULLABLE_CHAR) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS SYMBOL - RHS SYMBOL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_SYMBOL - RHS NULLABLE_SYMBOL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS STRING - RHS STRING) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_STRING - RHS NULLABLE_STRING) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS CLOB - RHS CLOB) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_CLOB - RHS NULLABLE_CLOB) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS BINARY - RHS BINARY) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_BINARY - RHS NULLABLE_BINARY) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS BYTE - RHS BYTE) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_BYTE - RHS NULLABLE_BYTE) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS BLOB - RHS BLOB) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_BLOB - RHS NULLABLE_BLOB) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS DATE - RHS DATE) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_DATE - RHS NULLABLE_DATE) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS TIME - RHS TIME) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_TIME - RHS NULLABLE_TIME) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS TIMESTAMP - RHS TIMESTAMP) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_TIMESTAMP - RHS NULLABLE_TIMESTAMP) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS INTERVAL - RHS INTERVAL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_INTERVAL - RHS NULLABLE_INTERVAL) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS LIST - RHS LIST) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_LIST - RHS NULLABLE_LIST) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS BAG - RHS BAG) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_BAG - RHS NULLABLE_BAG) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS SEXP - RHS SEXP) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_SEXP - RHS NULLABLE_SEXP) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS STRUCT - RHS STRUCT) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS NULLABLE_STRUCT - RHS NULLABLE_STRUCT) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - -CREATE FUNCTION "EQ"( - LHS GRAPH - RHS GRAPH) - RETURNS BOOL - SPECIFIC - - RETURN EQ ( LHS, RHS ); - - ---- [neq] --------- - -CREATE FUNCTION "NEQ"( - LHS NULL - RHS NULL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS MISSING - RHS MISSING) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS BOOL - RHS BOOL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_BOOL - RHS NULLABLE_BOOL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS INT8 - RHS INT8) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS INT16 - RHS INT16) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS INT32 - RHS INT32) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS INT64 - RHS INT64) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS INT - RHS INT) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS DECIMAL - RHS DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS CHAR - RHS CHAR) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_CHAR - RHS NULLABLE_CHAR) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS SYMBOL - RHS SYMBOL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_SYMBOL - RHS NULLABLE_SYMBOL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS STRING - RHS STRING) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_STRING - RHS NULLABLE_STRING) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS CLOB - RHS CLOB) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_CLOB - RHS NULLABLE_CLOB) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS BINARY - RHS BINARY) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_BINARY - RHS NULLABLE_BINARY) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS BYTE - RHS BYTE) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_BYTE - RHS NULLABLE_BYTE) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS BLOB - RHS BLOB) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_BLOB - RHS NULLABLE_BLOB) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS DATE - RHS DATE) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_DATE - RHS NULLABLE_DATE) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS TIME - RHS TIME) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_TIME - RHS NULLABLE_TIME) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS TIMESTAMP - RHS TIMESTAMP) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_TIMESTAMP - RHS NULLABLE_TIMESTAMP) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS INTERVAL - RHS INTERVAL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_INTERVAL - RHS NULLABLE_INTERVAL) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS LIST - RHS LIST) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_LIST - RHS NULLABLE_LIST) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS BAG - RHS BAG) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_BAG - RHS NULLABLE_BAG) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS SEXP - RHS SEXP) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_SEXP - RHS NULLABLE_SEXP) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS STRUCT - RHS STRUCT) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS NULLABLE_STRUCT - RHS NULLABLE_STRUCT) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - -CREATE FUNCTION "NEQ"( - LHS GRAPH - RHS GRAPH) - RETURNS BOOL - SPECIFIC - - RETURN NEQ ( LHS, RHS ); - - ---- [and] --------- - -CREATE FUNCTION "AND"( - LHS BOOL - RHS BOOL) - RETURNS BOOL - SPECIFIC - - RETURN AND ( LHS, RHS ); - -CREATE FUNCTION "AND"( - LHS NULLABLE_BOOL - RHS NULLABLE_BOOL) - RETURNS BOOL - SPECIFIC - - RETURN AND ( LHS, RHS ); - - ---- [or] --------- - -CREATE FUNCTION "OR"( - LHS BOOL - RHS BOOL) - RETURNS BOOL - SPECIFIC - - RETURN OR ( LHS, RHS ); - -CREATE FUNCTION "OR"( - LHS NULLABLE_BOOL - RHS NULLABLE_BOOL) - RETURNS BOOL - SPECIFIC - - RETURN OR ( LHS, RHS ); - - ---- [lt] --------- - -CREATE FUNCTION "LT"( - LHS INT8 - RHS INT8) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS INT16 - RHS INT16) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS INT32 - RHS INT32) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS INT64 - RHS INT64) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS INT - RHS INT) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS DECIMAL - RHS DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - -CREATE FUNCTION "LT"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN LT ( LHS, RHS ); - - ---- [lte] --------- - -CREATE FUNCTION "LTE"( - LHS INT8 - RHS INT8) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS INT16 - RHS INT16) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS INT32 - RHS INT32) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS INT64 - RHS INT64) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS INT - RHS INT) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS DECIMAL - RHS DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - -CREATE FUNCTION "LTE"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN LTE ( LHS, RHS ); - - ---- [gt] --------- - -CREATE FUNCTION "GT"( - LHS INT8 - RHS INT8) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS INT16 - RHS INT16) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS INT32 - RHS INT32) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS INT64 - RHS INT64) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS INT - RHS INT) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS DECIMAL - RHS DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - -CREATE FUNCTION "GT"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN GT ( LHS, RHS ); - - ---- [gte] --------- - -CREATE FUNCTION "GTE"( - LHS INT8 - RHS INT8) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS INT16 - RHS INT16) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS INT32 - RHS INT32) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS INT64 - RHS INT64) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS INT - RHS INT) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS DECIMAL - RHS DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - -CREATE FUNCTION "GTE"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS BOOL - SPECIFIC - - RETURN GTE ( LHS, RHS ); - - ---- [plus] --------- - -CREATE FUNCTION "PLUS"( - LHS INT8 - RHS INT8) - RETURNS INT8 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS INT16 - RHS INT16) - RETURNS INT16 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS INT32 - RHS INT32) - RETURNS INT32 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS INT64 - RHS INT64) - RETURNS INT64 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS INT - RHS INT) - RETURNS INT - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS DECIMAL - RHS DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - -CREATE FUNCTION "PLUS"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN PLUS ( LHS, RHS ); - - ---- [minus] --------- - -CREATE FUNCTION "MINUS"( - LHS INT8 - RHS INT8) - RETURNS INT8 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS INT16 - RHS INT16) - RETURNS INT16 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS INT32 - RHS INT32) - RETURNS INT32 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS INT64 - RHS INT64) - RETURNS INT64 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS INT - RHS INT) - RETURNS INT - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS DECIMAL - RHS DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - -CREATE FUNCTION "MINUS"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN MINUS ( LHS, RHS ); - - ---- [times] --------- - -CREATE FUNCTION "TIMES"( - LHS INT8 - RHS INT8) - RETURNS INT8 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS INT16 - RHS INT16) - RETURNS INT16 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS INT32 - RHS INT32) - RETURNS INT32 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS INT64 - RHS INT64) - RETURNS INT64 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS INT - RHS INT) - RETURNS INT - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS DECIMAL - RHS DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - -CREATE FUNCTION "TIMES"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN TIMES ( LHS, RHS ); - - ---- [div] --------- - -CREATE FUNCTION "DIV"( - LHS INT8 - RHS INT8) - RETURNS INT8 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS INT16 - RHS INT16) - RETURNS INT16 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS INT32 - RHS INT32) - RETURNS INT32 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS INT64 - RHS INT64) - RETURNS INT64 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS INT - RHS INT) - RETURNS INT - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS DECIMAL - RHS DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - -CREATE FUNCTION "DIV"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN DIV ( LHS, RHS ); - - ---- [mod] --------- - -CREATE FUNCTION "MOD"( - LHS INT8 - RHS INT8) - RETURNS INT8 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_INT8 - RHS NULLABLE_INT8) - RETURNS NULLABLE_INT8 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS INT16 - RHS INT16) - RETURNS INT16 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_INT16 - RHS NULLABLE_INT16) - RETURNS NULLABLE_INT16 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS INT32 - RHS INT32) - RETURNS INT32 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_INT32 - RHS NULLABLE_INT32) - RETURNS NULLABLE_INT32 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS INT64 - RHS INT64) - RETURNS INT64 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_INT64 - RHS NULLABLE_INT64) - RETURNS NULLABLE_INT64 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS INT - RHS INT) - RETURNS INT - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_INT - RHS NULLABLE_INT) - RETURNS NULLABLE_INT - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS DECIMAL - RHS DECIMAL) - RETURNS DECIMAL - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_DECIMAL - RHS NULLABLE_DECIMAL) - RETURNS NULLABLE_DECIMAL - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS FLOAT32 - RHS FLOAT32) - RETURNS FLOAT32 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_FLOAT32 - RHS NULLABLE_FLOAT32) - RETURNS NULLABLE_FLOAT32 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS FLOAT64 - RHS FLOAT64) - RETURNS FLOAT64 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - -CREATE FUNCTION "MOD"( - LHS NULLABLE_FLOAT64 - RHS NULLABLE_FLOAT64) - RETURNS NULLABLE_FLOAT64 - SPECIFIC - - RETURN MOD ( LHS, RHS ); - - ---- [concat] --------- - -CREATE FUNCTION "CONCAT"( - LHS SYMBOL - RHS SYMBOL) - RETURNS SYMBOL - SPECIFIC - - RETURN CONCAT ( LHS, RHS ); - -CREATE FUNCTION "CONCAT"( - LHS NULLABLE_SYMBOL - RHS NULLABLE_SYMBOL) - RETURNS NULLABLE_SYMBOL - SPECIFIC - - RETURN CONCAT ( LHS, RHS ); - -CREATE FUNCTION "CONCAT"( - LHS STRING - RHS STRING) - RETURNS STRING - SPECIFIC - - RETURN CONCAT ( LHS, RHS ); - -CREATE FUNCTION "CONCAT"( - LHS NULLABLE_STRING - RHS NULLABLE_STRING) - RETURNS NULLABLE_STRING - SPECIFIC - - RETURN CONCAT ( LHS, RHS ); diff --git a/partiql-planner/src/main/resources/partiql_plan_internal.ion b/partiql-planner/src/main/resources/partiql_plan_internal.ion new file mode 100644 index 000000000..d2cf418e6 --- /dev/null +++ b/partiql-planner/src/main/resources/partiql_plan_internal.ion @@ -0,0 +1,342 @@ +imports::{ + kotlin: [ + partiql_value::'org.partiql.value.PartiQLValue', + static_type::'org.partiql.types.StaticType', + scalar_signature::'org.partiql.types.function.FunctionSignature$Scalar', + aggregation_signature::'org.partiql.types.function.FunctionSignature$Aggregation', + ], +} + +parti_q_l_plan::{ + catalogs: list::[catalog], // (catalogs ...) + statement: statement, // (statement ...) +} + +// Represent an instance of a database. +// - Currently, `symbols` represents all values from this catalog to be used in this plan. +// - Eventually, TODO functions may be resolved to a specific namespace within a catalog. +catalog::{ + name: string, + symbols: list::[symbol], + _: [ + // A reference to a value contained within a catalog. + symbol::{ + // The path to a value WITHIN a catalog. Note: This should not start with the catalog's name. Also, this + // should not be empty + path: list::[string], + type: static_type, + _: [ + // A reference to a symbol + ref::{ + catalog: int, + symbol: int + } + ] + } + ] +} + +// Functions + +fn::[ + resolved::{ + signature: scalar_signature, + }, + unresolved::{ + identifier: identifier, + isHidden: bool, + }, +] + +agg::[ + resolved::{ + signature: aggregation_signature, + }, + unresolved::{ + identifier: identifier, + }, +] + +// Statements + +statement::[ + query::{ + root: rex, + }, +] + +// Identifiers + +identifier::[ + symbol::{ + symbol: string, + case_sensitivity: case_sensitivity, + }, + qualified::{ + root: symbol, + steps: list::[symbol], + }, + _::[ + case_sensitivity::[ + SENSITIVE, + INSENSITIVE, + ], + ], +] + +// Rex +rex::{ + type: static_type, + op:[ + + lit::{ + value: partiql_value, + }, + + var::[ + resolved::{ + ref: int, + }, + unresolved::{ + identifier: identifier, + scope: scope, + }, + _::[ + scope::[ + DEFAULT, // x.y.z + LOCAL, // @x.y.z + ], + ], + ], + + global::{ + ref: '.catalog.symbol.ref' + }, + + path::[ + // The key MUST be an integer expression. Ex: a[0], a[1 + 1] + index::{ root: rex, key: rex }, + + // Case-sensitive lookup. The key MUST be a string expression. Ex: a["b"], a."b", a[CAST(b AS STRING)] + key::{ root: rex, key: rex }, + + // Case-insensitive lookup. The key MUST be a literal string. Ex: a.b + symbol::{ root: rex, key: string }, + ], + + call::[ + static::{ + fn: fn, + args: list::[rex] + }, + + // Represents a dynamic function call. If all candidates are exhausted, dynamic calls will return MISSING. + // + // args: represent the original typed arguments. These will eventually be wrapped by coercions from [candidates]. + // candidates: represent the potentially applicable resolved functions with coercions. Each of these candidates + // should be overloaded functions of the same name and number of arguments. + dynamic::{ + args: list::[rex], + candidates: list::[candidate], + _: [ + candidate::{ + fn: fn, + coercions: list::[optional::fn] + } + ] + } + ], + + case::{ + branches: list::[branch], + default: rex, + _: [ + branch::{ + condition: rex, + rex: rex, + }, + ], + }, + + collection::{ + values: list::[rex], + }, + + struct::{ + fields: list::[field], + _: [ + field::{ + k: rex, + v: rex, + }, + ], + }, + + pivot::{ + key: rex, + value: rex, + rel: rel, + }, + + subquery::{ + select: select, + coercion: [ SCALAR, ROW ], + }, + + select::{ + constructor: rex, + rel: rel, + }, + + // SELECT v1.*, e2 AS a, v3.* + // + // SELECT VALUE TUPLEUNION( + // CASE WHEN v1 IS TUPLE THEN v1 ELSE {'_1': v1} END, + // {'a':e2 }, + // CASE WHEN v3 IS TUPLE THEN v3 ELSE {'_2': v3} END + // ) + // + // Tuple Union Function Signature: (Array) -> Struct + tuple_union::{ + args: list::[rex], + }, + + err::{ + message: string, + }, + ], +} + +// Rel + +rel::{ + type: { + schema: list::[binding], + props: set::[prop], + }, + op: [ + + scan::{ + rex: rex, + }, + + scan_indexed::{ + rex: rex, + }, + + unpivot::{ + rex: rex, + }, + + distinct::{ + input: rel, + }, + + filter::{ + input: rel, + predicate: rex, + }, + + sort::{ + input: rel, + specs: list::[spec], + _: [ + spec::{ + rex: rex, + order: order, + }, + order::[ + ASC_NULLS_LAST, + ASC_NULLS_FIRST, + DESC_NULLS_LAST, + DESC_NULLS_FIRST, + ], + ], + }, + + union::{ + lhs: rel, + rhs: rel, + }, + + intersect::{ + lhs: rel, + rhs: rel, + }, + + except::{ + lhs: rel, + rhs: rel, + }, + + limit::{ + input: rel, + limit: rex, + }, + + offset::{ + input: rel, + offset: rex, + }, + + project::{ + input: rel, + projections: list::[rex], + }, + + join::{ + lhs: rel, + rhs: rel, + rex: rex, // The Join Expression (required) (can be set to TRUE) + type: [ + INNER, // Inner Join + LEFT, // Left Outer Join + RIGHT, // Right Outer Join + FULL // Full Outer Join + ], + }, + + aggregate::{ + input: rel, + strategy: [ FULL, PARTIAL ], + calls: list::[call], + groups: list::[rex], + _: [ + call::{ + agg: agg, + args: list::[rex], + }, + ], + }, + + exclude::{ + input: rel, + items: list::[item], + _: [ + item::{ + root: '.rex.op.var', + steps: list::[step], + }, + step::[ + struct_field::{ symbol: '.identifier.symbol' }, + coll_index::{ index: int }, + struct_wildcard::{}, + coll_wildcard::{}, + ], + ], + }, + + err::{ + message: string, + }, + ], + _: [ + prop::[ + ORDERED, + ], + binding::{ + name: string, + type: static_type, + }, + ] +}