Skip to content

Commit

Permalink
Simplify SPI functions in preparation for switch
Browse files Browse the repository at this point in the history
  • Loading branch information
RCHowell committed Jul 31, 2024
1 parent 7a7be9d commit 409cbda
Show file tree
Hide file tree
Showing 127 changed files with 530 additions and 528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import org.partiql.plan.Rex
import org.partiql.plan.Statement
import org.partiql.plan.debug.PlanPrinter
import org.partiql.plan.visitor.PlanBaseVisitor
import org.partiql.planner.internal.fn.Agg
import org.partiql.spi.fn.Agg
import org.partiql.types.PType
import org.partiql.value.PartiQLValueExperimental
import java.lang.IllegalStateException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import org.partiql.eval.internal.operator.rex.ExprVarGlobal
import org.partiql.plan.Catalog
import org.partiql.plan.PartiQLPlan
import org.partiql.plan.Ref
import org.partiql.planner.internal.fn.Agg
import org.partiql.planner.internal.fn.Fn
import org.partiql.planner.internal.fn.SqlFnProvider
import org.partiql.spi.connector.ConnectorBindings
import org.partiql.spi.connector.ConnectorPath
import org.partiql.spi.fn.Agg
import org.partiql.spi.fn.Fn
import org.partiql.spi.fn.SqlFnProvider

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.partiql.eval.internal.operator
import org.partiql.eval.internal.Environment
import org.partiql.eval.internal.Record
import org.partiql.eval.value.Datum
import org.partiql.planner.internal.fn.Agg
import org.partiql.spi.fn.Agg

internal sealed interface Operator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.partiql.eval.internal.Environment
import org.partiql.eval.internal.Record
import org.partiql.eval.internal.operator.Operator
import org.partiql.eval.value.Datum
import org.partiql.planner.internal.fn.Agg
import org.partiql.spi.fn.Agg
import org.partiql.value.PartiQLValue
import org.partiql.value.PartiQLValueExperimental
import org.partiql.value.PartiQLValueType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.partiql.eval.internal.Environment
import org.partiql.eval.internal.operator.Operator
import org.partiql.eval.value.Datum
import org.partiql.plan.Ref
import org.partiql.planner.internal.fn.Fn
import org.partiql.spi.fn.Fn
import org.partiql.types.PType
import org.partiql.value.PartiQLValue
import org.partiql.value.PartiQLValueExperimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.partiql.eval.internal.operator.rex
import org.partiql.eval.internal.Environment
import org.partiql.eval.internal.operator.Operator
import org.partiql.eval.value.Datum
import org.partiql.planner.internal.fn.Fn
import org.partiql.spi.fn.Fn
import org.partiql.value.PartiQLValueExperimental

@OptIn(PartiQLValueExperimental::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import org.partiql.eval.value.Datum.boolValue
import org.partiql.eval.value.Datum.int32Value
import org.partiql.eval.value.Datum.listValue
import org.partiql.eval.value.Datum.stringValue
import org.partiql.planner.internal.fn.Fn
import org.partiql.planner.internal.fn.FnParameter
import org.partiql.planner.internal.fn.FnSignature
import org.partiql.spi.fn.Fn
import org.partiql.spi.fn.FnParameter
import org.partiql.spi.fn.FnSignature
import org.partiql.value.PartiQLValue
import org.partiql.value.PartiQLValueExperimental
import org.partiql.value.PartiQLValueType
Expand Down
84 changes: 0 additions & 84 deletions partiql-planner/api/partiql-planner.api
Original file line number Diff line number Diff line change
Expand Up @@ -321,87 +321,3 @@ public final class org/partiql/planner/catalog/Table$Handle {
public fun <init> (Lorg/partiql/planner/catalog/Name;Lorg/partiql/planner/catalog/Table;)V
}

public abstract interface class org/partiql/planner/internal/fn/Agg {
public abstract fun accumulator ()Lorg/partiql/planner/internal/fn/Agg$Accumulator;
public abstract fun getSignature ()Lorg/partiql/planner/internal/fn/AggSignature;
}

public abstract interface class org/partiql/planner/internal/fn/Agg$Accumulator {
public abstract fun next ([Lorg/partiql/value/PartiQLValue;)V
public abstract fun value ()Lorg/partiql/value/PartiQLValue;
}

public final class org/partiql/planner/internal/fn/AggSignature {
public final field description Ljava/lang/String;
public final field isDecomposable Z
public final field isNullable Z
public final field name Ljava/lang/String;
public final field parameters Ljava/util/List;
public final field returns Lorg/partiql/types/PType;
public fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getSpecific ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public abstract interface class org/partiql/planner/internal/fn/Fn {
public abstract fun getSignature ()Lorg/partiql/planner/internal/fn/FnSignature;
public abstract fun invoke ([Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/PartiQLValue;
}

public final class org/partiql/planner/internal/fn/FnParameter {
public fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;)V
public fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lorg/partiql/types/PType;
public final fun copy (Ljava/lang/String;Lorg/partiql/types/PType;)Lorg/partiql/planner/internal/fn/FnParameter;
public static synthetic fun copy$default (Lorg/partiql/planner/internal/fn/FnParameter;Ljava/lang/String;Lorg/partiql/types/PType;ILjava/lang/Object;)Lorg/partiql/planner/internal/fn/FnParameter;
public fun equals (Ljava/lang/Object;)Z
public final fun getName ()Ljava/lang/String;
public final fun getType ()Lorg/partiql/types/PType;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/planner/internal/fn/FnSignature {
public final field description Ljava/lang/String;
public final field isDeterministic Z
public final field isMissable Z
public final field isMissingCall Z
public final field isNullCall Z
public final field isNullable Z
public final field name Ljava/lang/String;
public final field parameters Ljava/util/List;
public final field returns Lorg/partiql/types/PType;
public fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZZZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lorg/partiql/types/PType;
public final fun component3 ()Ljava/util/List;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Z
public final fun component6 ()Z
public final fun component7 ()Z
public final fun component8 ()Z
public final fun component9 ()Z
public final fun copy (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZ)Lorg/partiql/planner/internal/fn/FnSignature;
public static synthetic fun copy$default (Lorg/partiql/planner/internal/fn/FnSignature;Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZILjava/lang/Object;)Lorg/partiql/planner/internal/fn/FnSignature;
public fun equals (Ljava/lang/Object;)Z
public final fun getSpecific ()Ljava/lang/String;
public fun hashCode ()I
public final fun sql ()Ljava/lang/String;
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/planner/internal/fn/SqlFnProvider {
public static final field INSTANCE Lorg/partiql/planner/internal/fn/SqlFnProvider;
public final fun getAgg (Ljava/lang/String;)Lorg/partiql/planner/internal/fn/Agg;
public final fun getFn (Ljava/lang/String;)Lorg/partiql/planner/internal/fn/Fn;
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import org.partiql.planner.catalog.Name
import org.partiql.planner.catalog.Session
import org.partiql.planner.internal.casts.CastTable
import org.partiql.planner.internal.casts.Coercions
import org.partiql.planner.internal.fn.AggSignature
import org.partiql.planner.internal.fn.SqlFnProvider
import org.partiql.planner.internal.ir.Ref
import org.partiql.planner.internal.ir.Rel
import org.partiql.planner.internal.ir.Rex
Expand All @@ -22,6 +20,8 @@ import org.partiql.planner.internal.typer.CompilerType
import org.partiql.planner.internal.typer.Scope.Companion.toPath
import org.partiql.spi.BindingPath
import org.partiql.spi.connector.ConnectorMetadata
import org.partiql.spi.fn.AggSignature
import org.partiql.spi.fn.SqlFnProvider
import org.partiql.types.PType
import org.partiql.types.PType.Kind

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.partiql.planner.internal

import org.partiql.planner.internal.fn.FnParameter
import org.partiql.planner.internal.fn.FnSignature
import org.partiql.spi.fn.FnParameter
import org.partiql.spi.fn.FnSignature
import org.partiql.types.PType
import org.partiql.types.PType.Kind

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.partiql.planner.internal

import org.partiql.planner.internal.fn.FnSignature
import org.partiql.planner.internal.ir.Ref
import org.partiql.spi.fn.FnSignature

/**
* Result of matching an unresolved function.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.partiql.planner.internal

import org.partiql.planner.internal.casts.Coercions
import org.partiql.planner.internal.fn.FnSignature
import org.partiql.planner.internal.ir.Ref
import org.partiql.planner.internal.typer.CompilerType
import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType
import org.partiql.spi.fn.FnSignature
import org.partiql.types.PType.Kind

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package org.partiql.planner.`internal`.ir
import org.partiql.errors.Problem
import org.partiql.planner.catalog.Identifier
import org.partiql.planner.catalog.Name
import org.partiql.planner.internal.fn.AggSignature
import org.partiql.planner.internal.fn.FnSignature
import org.partiql.spi.fn.AggSignature
import org.partiql.spi.fn.FnSignature
import org.partiql.planner.internal.ir.builder.PartiQlPlanBuilder
import org.partiql.planner.internal.ir.builder.RefAggBuilder
import org.partiql.planner.internal.ir.builder.RefCastBuilder
Expand Down
4 changes: 2 additions & 2 deletions partiql-planner/src/main/resources/partiql_plan_internal.ion
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ imports::{
partiql_value::'org.partiql.value.PartiQLValue',
partiql_value_type::'org.partiql.planner.internal.typer.CompilerType',
static_type::'org.partiql.planner.internal.typer.CompilerType',
fn_signature::'org.partiql.planner.internal.fn.FnSignature',
agg_signature::'org.partiql.planner.internal.fn.AggSignature',
fn_signature::'org.partiql.spi.fn.FnSignature',
agg_signature::'org.partiql.spi.fn.AggSignature',
problem::'org.partiql.errors.Problem'
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.fail
import org.partiql.planner.internal.FnMatch
import org.partiql.planner.internal.FnResolver
import org.partiql.planner.internal.fn.FnParameter
import org.partiql.planner.internal.fn.FnSignature
import org.partiql.planner.internal.typer.PlanTyper.Companion.toCType
import org.partiql.spi.fn.FnParameter
import org.partiql.spi.fn.FnSignature
import org.partiql.types.PType
import org.partiql.value.PartiQLValueExperimental
import org.partiql.value.PartiQLValueType
Expand Down
86 changes: 86 additions & 0 deletions partiql-spi/api/partiql-spi.api
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,89 @@ public final class org/partiql/spi/connector/Constants {
public static final field INSTANCE Lorg/partiql/spi/connector/Constants;
}

public abstract interface class org/partiql/spi/fn/Agg {
public abstract fun accumulator ()Lorg/partiql/spi/fn/Agg$Accumulator;
public abstract fun getSignature ()Lorg/partiql/spi/fn/AggSignature;
}

public abstract interface class org/partiql/spi/fn/Agg$Accumulator {
public abstract fun next ([Lorg/partiql/value/PartiQLValue;)V
public abstract fun value ()Lorg/partiql/value/PartiQLValue;
}

public final class org/partiql/spi/fn/AggSignature {
public final field description Ljava/lang/String;
public final field isDecomposable Z
public final field isNullable Z
public final field name Ljava/lang/String;
public final field parameters Ljava/util/List;
public final field returns Lorg/partiql/types/PType;
public fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getSpecific ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public abstract interface class org/partiql/spi/fn/Fn {
public abstract fun getSignature ()Lorg/partiql/spi/fn/FnSignature;
public abstract fun invoke ([Lorg/partiql/value/PartiQLValue;)Lorg/partiql/value/PartiQLValue;
}

public final class org/partiql/spi/fn/FnParameter {
public fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;)V
public fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lorg/partiql/types/PType;
public final fun copy (Ljava/lang/String;Lorg/partiql/types/PType;)Lorg/partiql/spi/fn/FnParameter;
public static synthetic fun copy$default (Lorg/partiql/spi/fn/FnParameter;Ljava/lang/String;Lorg/partiql/types/PType;ILjava/lang/Object;)Lorg/partiql/spi/fn/FnParameter;
public fun equals (Ljava/lang/Object;)Z
public final fun getName ()Ljava/lang/String;
public final fun getType ()Lorg/partiql/types/PType;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/spi/fn/FnSignature {
public final field description Ljava/lang/String;
public final field isDeterministic Z
public final field isMissable Z
public final field isMissingCall Z
public final field isNullCall Z
public final field isNullable Z
public final field name Ljava/lang/String;
public final field parameters Ljava/util/List;
public final field returns Lorg/partiql/types/PType;
public fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZZZZ)V
public synthetic fun <init> (Ljava/lang/String;Lorg/partiql/value/PartiQLValueType;Ljava/util/List;Ljava/lang/String;ZZZZZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lorg/partiql/types/PType;
public final fun component3 ()Ljava/util/List;
public final fun component4 ()Ljava/lang/String;
public final fun component5 ()Z
public final fun component6 ()Z
public final fun component7 ()Z
public final fun component8 ()Z
public final fun component9 ()Z
public final fun copy (Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZ)Lorg/partiql/spi/fn/FnSignature;
public static synthetic fun copy$default (Lorg/partiql/spi/fn/FnSignature;Ljava/lang/String;Lorg/partiql/types/PType;Ljava/util/List;Ljava/lang/String;ZZZZZILjava/lang/Object;)Lorg/partiql/spi/fn/FnSignature;
public fun equals (Ljava/lang/Object;)Z
public final fun getSpecific ()Ljava/lang/String;
public fun hashCode ()I
public final fun sql ()Ljava/lang/String;
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/spi/fn/SqlFnProvider {
public static final field INSTANCE Lorg/partiql/spi/fn/SqlFnProvider;
public final fun getAgg (Ljava/lang/String;)Lorg/partiql/spi/fn/Agg;
public final fun getFn (Ljava/lang/String;)Lorg/partiql/spi/fn/Fn;
public final fun lookupAgg (Ljava/lang/String;)Ljava/util/List;
public final fun lookupFn (Ljava/lang/String;)Ljava/util/List;
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.partiql.planner.internal.fn
package org.partiql.spi.fn

import org.partiql.value.PartiQLValue
import org.partiql.value.PartiQLValueExperimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.partiql.planner.internal.fn
package org.partiql.spi.fn

import org.partiql.types.PType
import org.partiql.value.PartiQLValueExperimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.partiql.planner.internal.fn
package org.partiql.spi.fn

import org.partiql.value.PartiQLValue
import org.partiql.value.PartiQLValueExperimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.partiql.planner.internal.fn
package org.partiql.spi.fn

import org.partiql.types.PType
import org.partiql.value.PartiQLValueExperimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.partiql.planner.internal.fn
package org.partiql.spi.fn

import org.partiql.types.PType
import org.partiql.value.PartiQLValueExperimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.partiql.planner.internal.fn
package org.partiql.spi.fn

/* ktlint-disable no-wildcard-imports */
import org.partiql.planner.internal.fn.builtins.*
import org.partiql.spi.fn.builtins.*

/**
* This is where we will register all SQL builtins. For now, we wrap the generated header to keep the diff small.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* language governing permissions and limitations under the License.
*/

package org.partiql.planner.internal.fn
package org.partiql.spi.fn

/**
* TODO !! TEMPORARY AS FUNCTIONS ARE MOVED FROM CONNECTORS TO PLANNER.
Expand All @@ -27,8 +27,8 @@ public object SqlFnProvider {
//
// INTERNAL PLANNER APIS
//
internal fun lookupFn(name: String) = fnNameIndex[name]
internal fun lookupAgg(name: String) = aggNameIndex[name]
public fun lookupFn(name: String): List<FnSignature>? = fnNameIndex[name]
public fun lookupAgg(name: String): List<AggSignature>? = aggNameIndex[name]

//
// TEMPORARY PUBLIC EVALUATOR APIS
Expand Down
Loading

0 comments on commit 409cbda

Please sign in to comment.