Skip to content

Commit

Permalink
Adds paths to V1 plans (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
RCHowell authored Aug 28, 2024
1 parent ffa368a commit a54f6ad
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 103 deletions.
63 changes: 31 additions & 32 deletions partiql-plan/api/partiql-plan.api
Original file line number Diff line number Diff line change
Expand Up @@ -2549,17 +2549,20 @@ public abstract interface class org/partiql/plan/v1/builder/PlanFactory {
public abstract fun rexError (Ljava/lang/String;Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexError;
public abstract fun rexLit (Lorg/partiql/eval/value/Datum;)Lorg/partiql/plan/v1/operator/rex/RexLit;
public abstract fun rexMissing (Ljava/lang/String;Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexMissing;
public abstract fun rexPathIndex (Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexPathIndex;
public abstract fun rexPathKey (Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexPathKey;
public abstract fun rexPathSymbol (Lorg/partiql/plan/v1/operator/rex/Rex;Ljava/lang/String;)Lorg/partiql/plan/v1/operator/rex/RexPathSymbol;
public abstract fun rexPivot (Lorg/partiql/plan/v1/operator/rel/Rel;Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexPivot;
public abstract fun rexSelect (Lorg/partiql/plan/v1/operator/rel/Rel;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexSelect;
public abstract fun rexSpread (Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexSpread;
public abstract fun rexStruct (Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexStruct;
public abstract fun rexSubquery (Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubquery;
public abstract fun rexSubquery (Lorg/partiql/plan/v1/operator/rel/Rel;Lorg/partiql/plan/v1/operator/rex/Rex;Z)Lorg/partiql/plan/v1/operator/rex/RexSubquery;
public abstract fun rexSubqueryComp (Ljava/util/List;Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp$Comp;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp;
public abstract fun rexSubqueryComp (Ljava/util/List;Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp$Comp;Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp$Quantifier;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp;
public abstract fun rexSubqueryIn (Ljava/util/List;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryIn;
public abstract fun rexSubqueryIn (Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryIn;
public abstract fun rexSubqueryTest (Lorg/partiql/plan/v1/operator/rex/RexSubqueryTest$Test;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryTest;
public abstract fun rexTable (Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/plan/v1/operator/rex/RexTable;
public abstract fun rexTable (Lorg/partiql/planner/catalog/Table;)Lorg/partiql/plan/v1/operator/rex/RexTable;
}

public final class org/partiql/plan/v1/builder/PlanFactory$Companion {
Expand Down Expand Up @@ -2599,17 +2602,20 @@ public final class org/partiql/plan/v1/builder/PlanFactory$DefaultImpls {
public static fun rexError (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/lang/String;Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexError;
public static fun rexLit (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/eval/value/Datum;)Lorg/partiql/plan/v1/operator/rex/RexLit;
public static fun rexMissing (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/lang/String;Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexMissing;
public static fun rexPathIndex (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexPathIndex;
public static fun rexPathKey (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexPathKey;
public static fun rexPathSymbol (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rex/Rex;Ljava/lang/String;)Lorg/partiql/plan/v1/operator/rex/RexPathSymbol;
public static fun rexPivot (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rel/Rel;Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexPivot;
public static fun rexSelect (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rel/Rel;Lorg/partiql/plan/v1/operator/rex/Rex;)Lorg/partiql/plan/v1/operator/rex/RexSelect;
public static fun rexSpread (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexSpread;
public static fun rexStruct (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/util/List;)Lorg/partiql/plan/v1/operator/rex/RexStruct;
public static fun rexSubquery (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubquery;
public static fun rexSubquery (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rel/Rel;Lorg/partiql/plan/v1/operator/rex/Rex;Z)Lorg/partiql/plan/v1/operator/rex/RexSubquery;
public static fun rexSubqueryComp (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/util/List;Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp$Comp;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp;
public static fun rexSubqueryComp (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/util/List;Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp$Comp;Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp$Quantifier;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryComp;
public static fun rexSubqueryIn (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/util/List;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryIn;
public static fun rexSubqueryIn (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rex/Rex;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryIn;
public static fun rexSubqueryTest (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/plan/v1/operator/rex/RexSubqueryTest$Test;Lorg/partiql/plan/v1/operator/rel/Rel;)Lorg/partiql/plan/v1/operator/rex/RexSubqueryTest;
public static fun rexTable (Lorg/partiql/plan/v1/builder/PlanFactory;Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/plan/v1/operator/rex/RexTable;
public static fun rexTable (Lorg/partiql/plan/v1/builder/PlanFactory;Lorg/partiql/planner/catalog/Table;)Lorg/partiql/plan/v1/operator/rex/RexTable;
}

public final class org/partiql/plan/v1/builder/RelBuilder {
Expand Down Expand Up @@ -3188,40 +3194,34 @@ public final class org/partiql/plan/v1/operator/rex/RexMissing$DefaultImpls {
public static fun getType (Lorg/partiql/plan/v1/operator/rex/RexMissing;)Lorg/partiql/types/PType;
}

public abstract interface class org/partiql/plan/v1/operator/rex/RexPath : org/partiql/plan/v1/operator/rex/Rex {
public abstract fun accept (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun getRoot ()Lorg/partiql/plan/v1/operator/rex/Rex;
}

public final class org/partiql/plan/v1/operator/rex/RexPath$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPath;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
}

public abstract interface class org/partiql/plan/v1/operator/rex/RexPath$Index : org/partiql/plan/v1/operator/rex/RexPath {
public abstract interface class org/partiql/plan/v1/operator/rex/RexPathIndex : org/partiql/plan/v1/operator/rex/Rex {
public abstract fun accept (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun getIndex ()Lorg/partiql/plan/v1/operator/rex/Rex;
public abstract fun getOperand ()Lorg/partiql/plan/v1/operator/rex/Rex;
}

public final class org/partiql/plan/v1/operator/rex/RexPath$Index$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPath$Index;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public final class org/partiql/plan/v1/operator/rex/RexPathIndex$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPathIndex;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
}

public abstract interface class org/partiql/plan/v1/operator/rex/RexPath$Key : org/partiql/plan/v1/operator/rex/RexPath {
public abstract interface class org/partiql/plan/v1/operator/rex/RexPathKey : org/partiql/plan/v1/operator/rex/Rex {
public abstract fun accept (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun getKey ()Lorg/partiql/plan/v1/operator/rex/Rex;
public abstract fun getOperand ()Lorg/partiql/plan/v1/operator/rex/Rex;
}

public final class org/partiql/plan/v1/operator/rex/RexPath$Key$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPath$Key;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public final class org/partiql/plan/v1/operator/rex/RexPathKey$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPathKey;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
}

public abstract interface class org/partiql/plan/v1/operator/rex/RexPath$Symbol : org/partiql/plan/v1/operator/rex/RexPath {
public abstract interface class org/partiql/plan/v1/operator/rex/RexPathSymbol : org/partiql/plan/v1/operator/rex/Rex {
public abstract fun accept (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun getOperand ()Lorg/partiql/plan/v1/operator/rex/Rex;
public abstract fun getSymbol ()Ljava/lang/String;
}

public final class org/partiql/plan/v1/operator/rex/RexPath$Symbol$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPath$Symbol;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public final class org/partiql/plan/v1/operator/rex/RexPathSymbol$DefaultImpls {
public static fun accept (Lorg/partiql/plan/v1/operator/rex/RexPathSymbol;Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
}

public abstract interface class org/partiql/plan/v1/operator/rex/RexPivot : org/partiql/plan/v1/operator/rex/Rex {
Expand Down Expand Up @@ -3286,6 +3286,8 @@ public abstract interface class org/partiql/plan/v1/operator/rex/RexStruct$Field

public abstract interface class org/partiql/plan/v1/operator/rex/RexSubquery : org/partiql/plan/v1/operator/rex/Rex {
public abstract fun accept (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun asScalar ()Z
public abstract fun getConstructor ()Lorg/partiql/plan/v1/operator/rex/Rex;
public abstract fun getRel ()Lorg/partiql/plan/v1/operator/rel/Rel;
}

Expand Down Expand Up @@ -3356,9 +3358,8 @@ public final class org/partiql/plan/v1/operator/rex/RexSubqueryTest$Test : java/

public abstract interface class org/partiql/plan/v1/operator/rex/RexTable : org/partiql/plan/v1/operator/rex/Rex {
public abstract fun accept (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun getCatalog ()Ljava/lang/String;
public abstract fun getChildren ()Ljava/util/Collection;
public abstract fun getName ()Ljava/lang/String;
public abstract fun getTable ()Lorg/partiql/planner/catalog/Table;
}

public final class org/partiql/plan/v1/operator/rex/RexTable$DefaultImpls {
Expand Down Expand Up @@ -3391,10 +3392,9 @@ public abstract interface class org/partiql/plan/v1/operator/rex/RexVisitor {
public abstract fun visitError (Lorg/partiql/plan/v1/operator/rex/RexError;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitLit (Lorg/partiql/plan/v1/operator/rex/RexLit;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitMissing (Lorg/partiql/plan/v1/operator/rex/RexMissing;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPath (Lorg/partiql/plan/v1/operator/rex/RexPath;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPathIndex (Lorg/partiql/plan/v1/operator/rex/RexPath$Index;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPathKey (Lorg/partiql/plan/v1/operator/rex/RexPath$Key;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPathSymbol (Lorg/partiql/plan/v1/operator/rex/RexPath$Symbol;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPathIndex (Lorg/partiql/plan/v1/operator/rex/RexPathIndex;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPathKey (Lorg/partiql/plan/v1/operator/rex/RexPathKey;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPathSymbol (Lorg/partiql/plan/v1/operator/rex/RexPathSymbol;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitPivot (Lorg/partiql/plan/v1/operator/rex/RexPivot;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitSelect (Lorg/partiql/plan/v1/operator/rex/RexSelect;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitSpread (Lorg/partiql/plan/v1/operator/rex/RexSpread;Ljava/lang/Object;)Ljava/lang/Object;
Expand All @@ -3419,10 +3419,9 @@ public final class org/partiql/plan/v1/operator/rex/RexVisitor$DefaultImpls {
public static fun visitError (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexError;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitLit (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexLit;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitMissing (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexMissing;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPath (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPath;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPathIndex (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPath$Index;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPathKey (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPath$Key;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPathSymbol (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPath$Symbol;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPathIndex (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPathIndex;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPathKey (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPathKey;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPathSymbol (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPathSymbol;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitPivot (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexPivot;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitSelect (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexSelect;Ljava/lang/Object;)Ljava/lang/Object;
public static fun visitSpread (Lorg/partiql/plan/v1/operator/rex/RexVisitor;Lorg/partiql/plan/v1/operator/rex/RexSpread;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ import org.partiql.plan.v1.operator.rex.RexLit
import org.partiql.plan.v1.operator.rex.RexLitImpl
import org.partiql.plan.v1.operator.rex.RexMissing
import org.partiql.plan.v1.operator.rex.RexMissingImpl
import org.partiql.plan.v1.operator.rex.RexPathIndex
import org.partiql.plan.v1.operator.rex.RexPathIndexImpl
import org.partiql.plan.v1.operator.rex.RexPathKey
import org.partiql.plan.v1.operator.rex.RexPathKeyImpl
import org.partiql.plan.v1.operator.rex.RexPathSymbol
import org.partiql.plan.v1.operator.rex.RexPathSymbolImpl
import org.partiql.plan.v1.operator.rex.RexPivot
import org.partiql.plan.v1.operator.rex.RexPivotImpl
import org.partiql.plan.v1.operator.rex.RexSelect
Expand All @@ -77,6 +83,7 @@ import org.partiql.plan.v1.operator.rex.RexTable
import org.partiql.plan.v1.operator.rex.RexTableImpl
import org.partiql.plan.v1.operator.rex.RexVar
import org.partiql.plan.v1.operator.rex.RexVarImpl
import org.partiql.planner.catalog.Table
import org.partiql.spi.fn.Fn
import org.partiql.types.PType

Expand Down Expand Up @@ -397,7 +404,32 @@ public interface PlanFactory {
*/
public fun rexLit(value: Datum): RexLit = RexLitImpl(value)

// TODO PATHS
/**
* Create a [RexPathIndex] instance.
*
* @param operand
* @param index
* @return
*/
public fun rexPathIndex(operand: Rex, index: Rex): RexPathIndex = RexPathIndexImpl(operand, index)

/**
* Create a [RexPathKey] instance.
*
* @param operand
* @param key
* @return
*/
public fun rexPathKey(operand: Rex, key: Rex): RexPathKey = RexPathKeyImpl(operand, key)

/**
* Create a [RexPathSymbol] instance.
*
* @param operand
* @param symbol
* @return
*/
public fun rexPathSymbol(operand: Rex, symbol: String): RexPathSymbol = RexPathSymbolImpl(operand, symbol)

/**
* Create a [RexPivot] instance.
Expand Down Expand Up @@ -437,10 +469,12 @@ public interface PlanFactory {
/**
* Create a [RexSubquery] instance.
*
* TODO REMOVE constructor AND asScalar – TEMPORARY UNTIL SUBQUERIES ARE FIXED IN THE PLANNER.
*
* @param rel
* @return
*/
public fun rexSubquery(rel: Rel): RexSubquery = RexSubqueryImpl(rel)
public fun rexSubquery(rel: Rel, constructor: Rex, asScalar: Boolean): RexSubquery = RexSubqueryImpl(rel, constructor, asScalar)

/**
* Create a [RexSubqueryComp] instance.
Expand Down Expand Up @@ -499,9 +533,8 @@ public interface PlanFactory {
/**
* Create a [RexTable] instance.
*
* @param catalog
* @param name
* @param table
* @return
*/
public fun rexTable(catalog: String, name: String): RexTable = RexTableImpl(catalog, name)
public fun rexTable(table: Table): RexTable = RexTableImpl(table)
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ public class RexBuilder private constructor(rex: Builder) {
*/
@JvmStatic
public fun subquery(rel: RelBuilder): RexBuilder = RexBuilder {
val _rel = rel.build(it)
it.rexSubquery(_rel)
error("subquery builders are removed until they are fixed in partiql-planner")
// val _rel = rel.build(it)
// it.rexSubquery(_rel)
}

/**
Expand Down

This file was deleted.

Loading

0 comments on commit a54f6ad

Please sign in to comment.