diff --git a/partiql-ast/api/partiql-ast.api b/partiql-ast/api/partiql-ast.api index 070e1e9980..4c0692c909 100644 --- a/partiql-ast/api/partiql-ast.api +++ b/partiql-ast/api/partiql-ast.api @@ -1,5 +1,13 @@ public final class org/partiql/ast/Ast { public static final field INSTANCE Lorg/partiql/ast/Ast; + public static final fun conflictTargetConstraint (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/ConflictTarget$Constraint; + public static final fun conflictTargetIndex (Ljava/util/List;)Lorg/partiql/ast/ConflictTarget$Index; + public static final fun delete (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/Delete; + public static final fun doNothing ()Lorg/partiql/ast/ConflictAction$DoNothing; + public static final fun doReplace (Lorg/partiql/ast/DoReplaceAction;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/ConflictAction$DoReplace; + public static final fun doReplaceActionExcluded ()Lorg/partiql/ast/DoReplaceAction$Excluded; + public static final fun doUpdate (Lorg/partiql/ast/DoUpdateAction;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/ConflictAction$DoUpdate; + public static final fun doUpdateActionExcluded ()Lorg/partiql/ast/DoUpdateAction$Excluded; public static final fun exclude (Ljava/util/List;)Lorg/partiql/ast/Exclude; public static final fun excludePath (Lorg/partiql/ast/expr/ExprVarRef;Ljava/util/List;)Lorg/partiql/ast/ExcludePath; public static final fun excludeStepCollIndex (I)Lorg/partiql/ast/ExcludeStep$CollIndex; @@ -35,11 +43,13 @@ public final class org/partiql/ast/Ast { public static final fun exprPathStepField (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/expr/PathStep;)Lorg/partiql/ast/expr/PathStep$Field; public static final fun exprPosition (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/expr/ExprPosition; public static final fun exprQuerySet (Lorg/partiql/ast/QueryBody;Lorg/partiql/ast/OrderBy;Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/expr/ExprQuerySet; + public static final fun exprRow (ZLjava/util/List;)Lorg/partiql/ast/expr/ExprRow; public static final fun exprRowValue (Ljava/util/List;)Lorg/partiql/ast/expr/ExprRowValue; public static final fun exprSessionAttribute (Lorg/partiql/ast/expr/SessionAttribute;)Lorg/partiql/ast/expr/ExprSessionAttribute; public static final fun exprStruct (Ljava/util/List;)Lorg/partiql/ast/expr/ExprStruct; public static final fun exprStructField (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/expr/ExprStruct$Field; public static final fun exprSubstring (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/expr/ExprSubstring; + public static final fun exprTable (Ljava/util/List;)Lorg/partiql/ast/expr/ExprValues; public static final fun exprTrim (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/TrimSpec;)Lorg/partiql/ast/expr/ExprTrim; public static final fun exprValues (Ljava/util/List;)Lorg/partiql/ast/expr/ExprValues; public static final fun exprVarRef (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/expr/Scope;)Lorg/partiql/ast/expr/ExprVarRef; @@ -70,20 +80,32 @@ public final class org/partiql/ast/Ast { public static final fun groupByKey (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/GroupBy$Key; public static final fun identifier (Ljava/lang/String;Z)Lorg/partiql/ast/Identifier; public static final fun identifierChain (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/IdentifierChain;)Lorg/partiql/ast/IdentifierChain; + public static final fun insert (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/InsertSource;Lorg/partiql/ast/OnConflict;)Lorg/partiql/ast/Insert; + public static final fun insertSourceDefault ()Lorg/partiql/ast/InsertSource$FromDefault; + public static final fun insertSourceExpr (Ljava/util/List;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/InsertSource$FromSubquery; public static final fun let (Ljava/util/List;)Lorg/partiql/ast/Let; public static final fun letBinding (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/Let$Binding; + public static final fun onConflict (Lorg/partiql/ast/ConflictAction;Lorg/partiql/ast/ConflictTarget;)Lorg/partiql/ast/OnConflict; public static final fun orderBy (Ljava/util/List;)Lorg/partiql/ast/OrderBy; public static final fun query (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/Query; public static final fun queryBodySFW (Lorg/partiql/ast/Select;Lorg/partiql/ast/Exclude;Lorg/partiql/ast/From;Lorg/partiql/ast/Let;Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/GroupBy;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/QueryBody$SFW; public static final fun queryBodySetOp (Lorg/partiql/ast/SetOp;ZLorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/QueryBody$SetOp; + public static final fun replace (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/InsertSource;)Lorg/partiql/ast/Replace; public static final fun selectItemExpr (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/SelectItem$Expr; public static final fun selectItemStar (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/SelectItem$Star; public static final fun selectList (Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/SelectList; public static final fun selectPivot (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/SelectPivot; public static final fun selectStar (Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/SelectStar; public static final fun selectValue (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/SelectValue; + public static final fun setClause (Lorg/partiql/ast/AstNode;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/SetClause; public static final fun setOp (Lorg/partiql/ast/SetOpType;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/SetOp; public static final fun sort (Lorg/partiql/ast/expr/Expr;Lorg/partiql/ast/Order;Lorg/partiql/ast/Nulls;)Lorg/partiql/ast/Sort; + public static final fun update (Lorg/partiql/ast/IdentifierChain;Ljava/util/List;Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/Update; + public static final fun updateTarget (Lorg/partiql/ast/Identifier;Ljava/util/List;)Lorg/partiql/ast/UpdateTarget; + public static final fun updateTargetStepElement (I)Lorg/partiql/ast/UpdateTargetStep$Element; + public static final fun updateTargetStepElement (Ljava/lang/String;)Lorg/partiql/ast/UpdateTargetStep$Element; + public static final fun updateTargetStepField (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/UpdateTargetStep$Field; + public static final fun upsert (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/InsertSource;)Lorg/partiql/ast/Upsert; } public abstract class org/partiql/ast/AstEnum : org/partiql/ast/AstNode { @@ -258,7 +280,19 @@ public abstract class org/partiql/ast/AstVisitor { public abstract fun defaultReturn (Lorg/partiql/ast/AstNode;Ljava/lang/Object;)Ljava/lang/Object; public fun defaultVisit (Lorg/partiql/ast/AstNode;Ljava/lang/Object;)Ljava/lang/Object; public fun visit (Lorg/partiql/ast/AstNode;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictAction (Lorg/partiql/ast/ConflictAction;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictActionDoNothing (Lorg/partiql/ast/ConflictAction$DoNothing;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictActionDoReplace (Lorg/partiql/ast/ConflictAction$DoReplace;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictActionDoUpdate (Lorg/partiql/ast/ConflictAction$DoUpdate;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictTarget (Lorg/partiql/ast/ConflictTarget;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictTargetConstraint (Lorg/partiql/ast/ConflictTarget$Constraint;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitConflictTargetIndex (Lorg/partiql/ast/ConflictTarget$Index;Ljava/lang/Object;)Ljava/lang/Object; public fun visitDataType (Lorg/partiql/ast/DataType;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitDelete (Lorg/partiql/ast/Delete;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitDoReplaceAction (Lorg/partiql/ast/DoReplaceAction;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitDoReplaceActionExcluded (Lorg/partiql/ast/DoReplaceAction$Excluded;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitDoUpdateAction (Lorg/partiql/ast/DoUpdateAction;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitDoUpdateActionExcluded (Lorg/partiql/ast/DoUpdateAction$Excluded;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExclude (Lorg/partiql/ast/Exclude;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExcludePath (Lorg/partiql/ast/ExcludePath;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExcludeStep (Lorg/partiql/ast/ExcludeStep;Ljava/lang/Object;)Ljava/lang/Object; @@ -292,6 +326,7 @@ public abstract class org/partiql/ast/AstVisitor { public fun visitExprPath (Lorg/partiql/ast/expr/ExprPath;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExprPosition (Lorg/partiql/ast/expr/ExprPosition;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExprQuerySet (Lorg/partiql/ast/expr/ExprQuerySet;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitExprRow (Lorg/partiql/ast/expr/ExprRow;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExprRowValue (Lorg/partiql/ast/expr/ExprRowValue;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExprSessionAttribute (Lorg/partiql/ast/expr/ExprSessionAttribute;Ljava/lang/Object;)Ljava/lang/Object; public fun visitExprStruct (Lorg/partiql/ast/expr/ExprStruct;Ljava/lang/Object;)Ljava/lang/Object; @@ -331,8 +366,14 @@ public abstract class org/partiql/ast/AstVisitor { public fun visitGroupByKey (Lorg/partiql/ast/GroupBy$Key;Ljava/lang/Object;)Ljava/lang/Object; public fun visitIdentifier (Lorg/partiql/ast/Identifier;Ljava/lang/Object;)Ljava/lang/Object; public fun visitIdentifierChain (Lorg/partiql/ast/IdentifierChain;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitInsert (Lorg/partiql/ast/Insert;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitInsertColumnList (Lorg/partiql/ast/InsertColumnList;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitInsertSource (Lorg/partiql/ast/InsertSource;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitInsertSourceFromDefault (Lorg/partiql/ast/InsertSource$FromDefault;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitInsertSourceFromSubquery (Lorg/partiql/ast/InsertSource$FromSubquery;Ljava/lang/Object;)Ljava/lang/Object; public fun visitLet (Lorg/partiql/ast/Let;Ljava/lang/Object;)Ljava/lang/Object; public fun visitLetBinding (Lorg/partiql/ast/Let$Binding;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitOnConflict (Lorg/partiql/ast/OnConflict;Ljava/lang/Object;)Ljava/lang/Object; public fun visitOrderBy (Lorg/partiql/ast/OrderBy;Ljava/lang/Object;)Ljava/lang/Object; public fun visitPathStep (Lorg/partiql/ast/expr/PathStep;Ljava/lang/Object;)Ljava/lang/Object; public fun visitPathStepAllElements (Lorg/partiql/ast/expr/PathStep$AllElements;Ljava/lang/Object;)Ljava/lang/Object; @@ -343,6 +384,7 @@ public abstract class org/partiql/ast/AstVisitor { public fun visitQueryBody (Lorg/partiql/ast/QueryBody;Ljava/lang/Object;)Ljava/lang/Object; public fun visitQueryBodySFW (Lorg/partiql/ast/QueryBody$SFW;Ljava/lang/Object;)Ljava/lang/Object; public fun visitQueryBodySetOp (Lorg/partiql/ast/QueryBody$SetOp;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitReplace (Lorg/partiql/ast/Replace;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSelect (Lorg/partiql/ast/Select;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSelectItem (Lorg/partiql/ast/SelectItem;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSelectItemExpr (Lorg/partiql/ast/SelectItem$Expr;Ljava/lang/Object;)Ljava/lang/Object; @@ -351,9 +393,103 @@ public abstract class org/partiql/ast/AstVisitor { public fun visitSelectPivot (Lorg/partiql/ast/SelectPivot;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSelectStar (Lorg/partiql/ast/SelectStar;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSelectValue (Lorg/partiql/ast/SelectValue;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitSetClause (Lorg/partiql/ast/SetClause;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSetOp (Lorg/partiql/ast/SetOp;Ljava/lang/Object;)Ljava/lang/Object; public fun visitSort (Lorg/partiql/ast/Sort;Ljava/lang/Object;)Ljava/lang/Object; public fun visitStatement (Lorg/partiql/ast/Statement;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitUpdate (Lorg/partiql/ast/Update;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitUpdateTarget (Lorg/partiql/ast/UpdateTarget;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitUpdateTargetStep (Lorg/partiql/ast/UpdateTarget;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitUpdateTargetStepElement (Lorg/partiql/ast/UpdateTargetStep$Element;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitUpdateTargetStepField (Lorg/partiql/ast/UpdateTargetStep$Field;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitUpsert (Lorg/partiql/ast/Upsert;Ljava/lang/Object;)Ljava/lang/Object; +} + +public abstract class org/partiql/ast/ConflictAction : org/partiql/ast/AstNode { + public fun ()V +} + +public final class org/partiql/ast/ConflictAction$DoNothing : org/partiql/ast/ConflictAction { + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/ConflictAction$DoNothing$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/ConflictAction$DoNothing$Builder { + public fun build ()Lorg/partiql/ast/ConflictAction$DoNothing; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/ConflictAction$DoReplace : org/partiql/ast/ConflictAction { + public final field action Lorg/partiql/ast/DoReplaceAction; + public final field condition Lorg/partiql/ast/expr/Expr; + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/ConflictAction$DoReplace$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/ConflictAction$DoReplace$Builder { + public fun action (Lorg/partiql/ast/DoReplaceAction;)Lorg/partiql/ast/ConflictAction$DoReplace$Builder; + public fun build ()Lorg/partiql/ast/ConflictAction$DoReplace; + public fun condition (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/ConflictAction$DoReplace$Builder; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/ConflictAction$DoUpdate : org/partiql/ast/ConflictAction { + public final field action Lorg/partiql/ast/DoUpdateAction; + public final field condition Lorg/partiql/ast/expr/Expr; + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/ConflictAction$DoUpdate$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/ConflictAction$DoUpdate$Builder { + public fun action (Lorg/partiql/ast/DoUpdateAction;)Lorg/partiql/ast/ConflictAction$DoUpdate$Builder; + public fun build ()Lorg/partiql/ast/ConflictAction$DoUpdate; + public fun condition (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/ConflictAction$DoUpdate$Builder; + public fun toString ()Ljava/lang/String; +} + +public abstract class org/partiql/ast/ConflictTarget : org/partiql/ast/AstNode { + public fun ()V +} + +public final class org/partiql/ast/ConflictTarget$Constraint : org/partiql/ast/ConflictTarget { + public final field constraintName Lorg/partiql/ast/Identifier; + public fun (Lorg/partiql/ast/Identifier;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/ConflictTarget$Constraint$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/ConflictTarget$Constraint$Builder { + public fun build ()Lorg/partiql/ast/ConflictTarget$Constraint; + public fun constraintName (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/ConflictTarget$Constraint$Builder; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/ConflictTarget$Index : org/partiql/ast/ConflictTarget { + public final field indexes Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/ConflictTarget$Index$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/ConflictTarget$Index$Builder { + public fun build ()Lorg/partiql/ast/ConflictTarget$Index; + public fun indexes (Ljava/util/List;)Lorg/partiql/ast/ConflictTarget$Index$Builder; + public fun toString ()Ljava/lang/String; } public class org/partiql/ast/DataType : org/partiql/ast/AstEnum { @@ -523,6 +659,58 @@ public class org/partiql/ast/DatetimeField : org/partiql/ast/AstEnum { public static fun parse (Ljava/lang/String;)Lorg/partiql/ast/DatetimeField; } +public final class org/partiql/ast/Delete : org/partiql/ast/Statement { + public final field condition Lorg/partiql/ast/expr/Expr; + public final field tableName Lorg/partiql/ast/IdentifierChain; + public fun (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/expr/Expr;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/Delete$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/Delete$Builder { + public fun build ()Lorg/partiql/ast/Delete; + public fun condition (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/Delete$Builder; + public fun tableName (Lorg/partiql/ast/IdentifierChain;)Lorg/partiql/ast/Delete$Builder; + public fun toString ()Ljava/lang/String; +} + +public abstract class org/partiql/ast/DoReplaceAction : org/partiql/ast/AstNode { + public fun ()V +} + +public final class org/partiql/ast/DoReplaceAction$Excluded : org/partiql/ast/DoReplaceAction { + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/DoReplaceAction$Excluded$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/DoReplaceAction$Excluded$Builder { + public fun build ()Lorg/partiql/ast/DoReplaceAction$Excluded; + public fun toString ()Ljava/lang/String; +} + +public abstract class org/partiql/ast/DoUpdateAction : org/partiql/ast/AstNode { + public fun ()V +} + +public final class org/partiql/ast/DoUpdateAction$Excluded : org/partiql/ast/DoUpdateAction { + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/DoUpdateAction$Excluded$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/DoUpdateAction$Excluded$Builder { + public fun build ()Lorg/partiql/ast/DoUpdateAction$Excluded; + public fun toString ()Ljava/lang/String; +} + public class org/partiql/ast/Exclude : org/partiql/ast/AstNode { public final field excludePaths Ljava/util/List; public fun (Ljava/util/List;)V @@ -824,6 +1012,79 @@ public class org/partiql/ast/IdentifierChain$Builder { public fun toString ()Ljava/lang/String; } +public final class org/partiql/ast/Insert : org/partiql/ast/Statement { + public final field asAlias Lorg/partiql/ast/Identifier; + public final field onConflict Lorg/partiql/ast/OnConflict; + public final field source Lorg/partiql/ast/InsertSource; + public final field tableName Lorg/partiql/ast/IdentifierChain; + public fun (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/InsertSource;Lorg/partiql/ast/OnConflict;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/Insert$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/Insert$Builder { + public fun asAlias (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/Insert$Builder; + public fun build ()Lorg/partiql/ast/Insert; + public fun onConflict (Lorg/partiql/ast/OnConflict;)Lorg/partiql/ast/Insert$Builder; + public fun source (Lorg/partiql/ast/InsertSource;)Lorg/partiql/ast/Insert$Builder; + public fun tableName (Lorg/partiql/ast/IdentifierChain;)Lorg/partiql/ast/Insert$Builder; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/InsertColumnList : org/partiql/ast/Statement { + public final field columns Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/InsertColumnList$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/InsertColumnList$Builder { + public fun build ()Lorg/partiql/ast/InsertColumnList; + public fun columns (Ljava/util/List;)Lorg/partiql/ast/InsertColumnList$Builder; + public fun toString ()Ljava/lang/String; +} + +public abstract class org/partiql/ast/InsertSource : org/partiql/ast/AstNode { + public fun ()V +} + +public final class org/partiql/ast/InsertSource$FromDefault : org/partiql/ast/InsertSource { + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/InsertSource$FromDefault$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/InsertSource$FromDefault$Builder { + public fun build ()Lorg/partiql/ast/InsertSource$FromDefault; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/InsertSource$FromSubquery : org/partiql/ast/InsertSource { + public final field columns Ljava/util/List; + public final field expr Lorg/partiql/ast/expr/Expr; + public fun (Ljava/util/List;Lorg/partiql/ast/expr/Expr;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/InsertSource$FromSubquery$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/InsertSource$FromSubquery$Builder { + public fun build ()Lorg/partiql/ast/InsertSource$FromSubquery; + public fun columns (Ljava/util/List;)Lorg/partiql/ast/InsertSource$FromSubquery$Builder; + public fun expr (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/InsertSource$FromSubquery$Builder; + public fun toString ()Ljava/lang/String; +} + public class org/partiql/ast/JoinType : org/partiql/ast/AstEnum { public static final field CROSS I public static final field FULL I @@ -907,6 +1168,24 @@ public class org/partiql/ast/Nulls : org/partiql/ast/AstEnum { public static fun parse (Ljava/lang/String;)Lorg/partiql/ast/Nulls; } +public final class org/partiql/ast/OnConflict : org/partiql/ast/AstNode { + public final field action Lorg/partiql/ast/ConflictAction; + public final field target Lorg/partiql/ast/ConflictTarget; + public fun (Lorg/partiql/ast/ConflictAction;Lorg/partiql/ast/ConflictTarget;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/OnConflict$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/OnConflict$Builder { + public fun action (Lorg/partiql/ast/ConflictAction;)Lorg/partiql/ast/OnConflict$Builder; + public fun build ()Lorg/partiql/ast/OnConflict; + public fun target (Lorg/partiql/ast/ConflictTarget;)Lorg/partiql/ast/OnConflict$Builder; + public fun toString ()Ljava/lang/String; +} + public class org/partiql/ast/Order : org/partiql/ast/AstEnum { public static final field ASC I public static final field DESC I @@ -1015,6 +1294,26 @@ public class org/partiql/ast/QueryBody$SetOp$Builder { public fun type (Lorg/partiql/ast/SetOp;)Lorg/partiql/ast/QueryBody$SetOp$Builder; } +public final class org/partiql/ast/Replace : org/partiql/ast/Statement { + public final field asAlias Lorg/partiql/ast/Identifier; + public final field source Lorg/partiql/ast/InsertSource; + public final field tableName Lorg/partiql/ast/IdentifierChain; + public fun (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/InsertSource;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/Replace$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/Replace$Builder { + public fun asAlias (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/Replace$Builder; + public fun build ()Lorg/partiql/ast/Replace; + public fun source (Lorg/partiql/ast/InsertSource;)Lorg/partiql/ast/Replace$Builder; + public fun tableName (Lorg/partiql/ast/IdentifierChain;)Lorg/partiql/ast/Replace$Builder; + public fun toString ()Ljava/lang/String; +} + public abstract class org/partiql/ast/Select : org/partiql/ast/AstNode { public fun ()V } @@ -1133,6 +1432,24 @@ public class org/partiql/ast/SelectValue$Builder { public fun toString ()Ljava/lang/String; } +public final class org/partiql/ast/SetClause : org/partiql/ast/AstNode { + public final field expr Lorg/partiql/ast/expr/Expr; + public final field target Lorg/partiql/ast/AstNode; + public fun (Lorg/partiql/ast/AstNode;Lorg/partiql/ast/expr/Expr;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/SetClause$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/SetClause$Builder { + public fun build ()Lorg/partiql/ast/SetClause; + public fun expr (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/SetClause$Builder; + public fun target (Lorg/partiql/ast/AstNode;)Lorg/partiql/ast/SetClause$Builder; + public fun toString ()Ljava/lang/String; +} + public class org/partiql/ast/SetOp : org/partiql/ast/AstNode { public final field setOpType Lorg/partiql/ast/SetOpType; public final field setq Lorg/partiql/ast/SetQuantifier; @@ -1215,6 +1532,102 @@ public abstract class org/partiql/ast/Statement : org/partiql/ast/AstNode { public fun ()V } +public final class org/partiql/ast/Update : org/partiql/ast/Statement { + public final field condition Lorg/partiql/ast/expr/Expr; + public final field setClauses Ljava/util/List; + public final field tableName Lorg/partiql/ast/IdentifierChain; + public fun (Lorg/partiql/ast/IdentifierChain;Ljava/util/List;Lorg/partiql/ast/expr/Expr;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/Update$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/Update$Builder { + public fun build ()Lorg/partiql/ast/Update; + public fun condition (Lorg/partiql/ast/expr/Expr;)Lorg/partiql/ast/Update$Builder; + public fun setClauses (Ljava/util/List;)Lorg/partiql/ast/Update$Builder; + public fun tableName (Lorg/partiql/ast/IdentifierChain;)Lorg/partiql/ast/Update$Builder; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/UpdateTarget : org/partiql/ast/AstNode { + public final field root Lorg/partiql/ast/Identifier; + public final field steps Ljava/util/List; + public fun (Lorg/partiql/ast/Identifier;Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/UpdateTarget$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/UpdateTarget$Builder { + public fun build ()Lorg/partiql/ast/UpdateTarget; + public fun root (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/UpdateTarget$Builder; + public fun steps (Ljava/util/List;)Lorg/partiql/ast/UpdateTarget$Builder; + public fun toString ()Ljava/lang/String; +} + +public abstract class org/partiql/ast/UpdateTargetStep : org/partiql/ast/AstNode { + public fun ()V +} + +public final class org/partiql/ast/UpdateTargetStep$Element : org/partiql/ast/UpdateTargetStep { + public final field key Lorg/partiql/ast/expr/ExprLit; + public fun (I)V + public fun (Ljava/lang/String;)V + public fun (Lorg/partiql/ast/expr/ExprLit;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/UpdateTargetStep$Element$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/UpdateTargetStep$Element$Builder { + public fun build ()Lorg/partiql/ast/UpdateTargetStep$Element; + public fun key (Lorg/partiql/ast/expr/ExprLit;)Lorg/partiql/ast/UpdateTargetStep$Element$Builder; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/UpdateTargetStep$Field : org/partiql/ast/UpdateTargetStep { + public final field key Lorg/partiql/ast/Identifier; + public fun (Lorg/partiql/ast/Identifier;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/UpdateTargetStep$Field$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/UpdateTargetStep$Field$Builder { + public fun build ()Lorg/partiql/ast/UpdateTargetStep$Field; + public fun key (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/UpdateTargetStep$Field$Builder; + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/Upsert : org/partiql/ast/Statement { + public final field asAlias Lorg/partiql/ast/Identifier; + public final field source Lorg/partiql/ast/InsertSource; + public final field tableName Lorg/partiql/ast/IdentifierChain; + public fun (Lorg/partiql/ast/IdentifierChain;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/InsertSource;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/Upsert$Builder; + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/Upsert$Builder { + public fun asAlias (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/Upsert$Builder; + public fun build ()Lorg/partiql/ast/Upsert; + public fun source (Lorg/partiql/ast/InsertSource;)Lorg/partiql/ast/Upsert$Builder; + public fun tableName (Lorg/partiql/ast/IdentifierChain;)Lorg/partiql/ast/Upsert$Builder; + public fun toString ()Ljava/lang/String; +} + public abstract class org/partiql/ast/expr/Expr : org/partiql/ast/AstNode { public fun ()V } @@ -1689,9 +2102,30 @@ public class org/partiql/ast/expr/ExprQuerySet$Builder { public fun toString ()Ljava/lang/String; } +public class org/partiql/ast/expr/ExprRow : org/partiql/ast/expr/Expr { + public field isExplicit Z + public final field values Ljava/util/List; + public fun (ZLjava/util/List;)V + public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static fun builder ()Lorg/partiql/ast/expr/ExprRow$Builder; + protected fun canEqual (Ljava/lang/Object;)Z + public fun children ()Ljava/util/Collection; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I +} + +public class org/partiql/ast/expr/ExprRow$Builder { + public fun build ()Lorg/partiql/ast/expr/ExprRow; + public fun isExplicit (Z)Lorg/partiql/ast/expr/ExprRow$Builder; + public fun toString ()Ljava/lang/String; + public fun values (Ljava/util/List;)Lorg/partiql/ast/expr/ExprRow$Builder; +} + public class org/partiql/ast/expr/ExprRowValue : org/partiql/ast/expr/Expr { + public field isExplicit Z public final field values Ljava/util/List; public fun (Ljava/util/List;)V + public fun (ZLjava/util/List;)V public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; public static fun builder ()Lorg/partiql/ast/expr/ExprRowValue$Builder; protected fun canEqual (Ljava/lang/Object;)Z @@ -1702,6 +2136,7 @@ public class org/partiql/ast/expr/ExprRowValue : org/partiql/ast/expr/Expr { public class org/partiql/ast/expr/ExprRowValue$Builder { public fun build ()Lorg/partiql/ast/expr/ExprRowValue; + public fun isExplicit (Z)Lorg/partiql/ast/expr/ExprRowValue$Builder; public fun toString ()Ljava/lang/String; public fun values (Ljava/util/List;)Lorg/partiql/ast/expr/ExprRowValue$Builder; } diff --git a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt index 7c1ee04450..f1d163bcba 100644 --- a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt +++ b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt @@ -157,10 +157,12 @@ import org.partiql.ast.SetOpType import org.partiql.ast.SetQuantifier import org.partiql.ast.Sort import org.partiql.ast.Statement +import org.partiql.ast.UpdateTargetStep import org.partiql.ast.expr.Expr import org.partiql.ast.expr.ExprArray import org.partiql.ast.expr.ExprBag import org.partiql.ast.expr.ExprCall +import org.partiql.ast.expr.ExprLit import org.partiql.ast.expr.ExprPath import org.partiql.ast.expr.ExprQuerySet import org.partiql.ast.expr.PathStep @@ -688,13 +690,26 @@ internal class PartiQLParserDefault : PartiQLParser { doUpdateActionExcluded() } - // "simple paths" used by previous DDL's CREATE INDEX override fun visitUpdateTarget(ctx: GeneratedParser.UpdateTargetContext) = translate(ctx) { val root = visitSymbolPrimitive(ctx.symbolPrimitive()) val steps = ctx.updateTargetStep().map { visitUpdateTargetStep(it) } updateTarget(root, steps) } + override fun visitUpdateTargetStep(ctx: GeneratedParser.UpdateTargetStepContext): UpdateTargetStep { + return super.visitUpdateTargetStep(ctx) as UpdateTargetStep + } + + override fun visitUpdateTargetStepElement(ctx: GeneratedParser.UpdateTargetStepElementContext) = translate(ctx) { + val literal = visit(ctx.literal()) as ExprLit // TODO: Literals should have their own base in the G4 to allow for overriding the visitLiteral to get type safety. + UpdateTargetStep.Element(literal) + } + + override fun visitUpdateTargetStepField(ctx: GeneratedParser.UpdateTargetStepFieldContext) = translate(ctx) { + val key = visitSymbolPrimitive(ctx.symbolPrimitive()) + UpdateTargetStep.Field(key) + } + override fun visitUpdateStatementSearched(ctx: GeneratedParser.UpdateStatementSearchedContext) = translate(ctx) { val tableName = visitQualifiedName(ctx.targetTable) val setClauseList = ctx.setClauseList().setClause().map { visitSetClause(it) } @@ -703,7 +718,7 @@ internal class PartiQLParserDefault : PartiQLParser { } override fun visitSetClause(ctx: GeneratedParser.SetClauseContext) = translate(ctx) { - val target = visitPathSimple(ctx.pathSimple()) + val target = visitUpdateTarget(ctx.updateTarget()) val value = visitExpr(ctx.expr()) setClause(target, value) }