diff --git a/partiql-ast/api/partiql-ast.api b/partiql-ast/api/partiql-ast.api index 63afbb2eb..a39e8ac48 100644 --- a/partiql-ast/api/partiql-ast.api +++ b/partiql-ast/api/partiql-ast.api @@ -5543,6 +5543,1139 @@ public abstract class org/partiql/ast/util/AstRewriter : org/partiql/ast/visitor public fun visitTypeVarchar (Lorg/partiql/ast/Type$Varchar;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; } +public abstract class org/partiql/ast/v1/AstNode { + public field tag Ljava/lang/String; + public fun ()V + public abstract fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun children ()Ljava/util/Collection; +} + +public abstract interface class org/partiql/ast/v1/AstVisitor { + public abstract fun visit (Lorg/partiql/ast/v1/AstNode;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExclude (Lorg/partiql/ast/v1/Exclude;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExcludePath (Lorg/partiql/ast/v1/ExcludePath;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExcludeStep (Lorg/partiql/ast/v1/ExcludeStep;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExcludeStepCollIndex (Lorg/partiql/ast/v1/ExcludeStep$CollIndex;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExcludeStepCollWildcard (Lorg/partiql/ast/v1/ExcludeStep$CollWildcard;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExcludeStepStructField (Lorg/partiql/ast/v1/ExcludeStep$StructField;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExcludeStepStructWildcard (Lorg/partiql/ast/v1/ExcludeStep$StructWildcard;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExplain (Lorg/partiql/ast/v1/Explain;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExpr (Lorg/partiql/ast/v1/expr/Expr;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprAnd (Lorg/partiql/ast/v1/expr/ExprAnd;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprArray (Lorg/partiql/ast/v1/expr/ExprArray;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprBag (Lorg/partiql/ast/v1/expr/ExprBag;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprBetween (Lorg/partiql/ast/v1/expr/ExprBetween;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprCall (Lorg/partiql/ast/v1/expr/ExprCall;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprCase (Lorg/partiql/ast/v1/expr/ExprCase;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprCaseBranch (Lorg/partiql/ast/v1/expr/ExprCase$Branch;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprCast (Lorg/partiql/ast/v1/expr/ExprCast;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprCoalesce (Lorg/partiql/ast/v1/expr/ExprCoalesce;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprExtract (Lorg/partiql/ast/v1/expr/ExprExtract;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprInCollection (Lorg/partiql/ast/v1/expr/ExprInCollection;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprIsType (Lorg/partiql/ast/v1/expr/ExprIsType;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprLike (Lorg/partiql/ast/v1/expr/ExprLike;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprLit (Lorg/partiql/ast/v1/expr/ExprLit;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprMatch (Lorg/partiql/ast/v1/expr/ExprMatch;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprNot (Lorg/partiql/ast/v1/expr/ExprNot;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprNullIf (Lorg/partiql/ast/v1/expr/ExprNullIf;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprOperator (Lorg/partiql/ast/v1/expr/ExprOperator;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprOr (Lorg/partiql/ast/v1/expr/ExprOr;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprOverlay (Lorg/partiql/ast/v1/expr/ExprOverlay;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprParameter (Lorg/partiql/ast/v1/expr/ExprParameter;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprPath (Lorg/partiql/ast/v1/expr/ExprPath;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprPosition (Lorg/partiql/ast/v1/expr/ExprPosition;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprQuerySet (Lorg/partiql/ast/v1/expr/ExprQuerySet;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprSessionAttribute (Lorg/partiql/ast/v1/expr/ExprSessionAttribute;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprStruct (Lorg/partiql/ast/v1/expr/ExprStruct;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprStructField (Lorg/partiql/ast/v1/expr/ExprStruct$Field;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprSubstring (Lorg/partiql/ast/v1/expr/ExprSubstring;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprTrim (Lorg/partiql/ast/v1/expr/ExprTrim;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprValues (Lorg/partiql/ast/v1/expr/ExprValues;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprValuesRow (Lorg/partiql/ast/v1/expr/ExprValues$Row;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprVarRef (Lorg/partiql/ast/v1/expr/ExprVarRef;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprVariant (Lorg/partiql/ast/v1/expr/ExprVariant;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprWindow (Lorg/partiql/ast/v1/expr/ExprWindow;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitExprWindowOver (Lorg/partiql/ast/v1/expr/ExprWindow$Over;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitFrom (Lorg/partiql/ast/v1/From;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitFromExpr (Lorg/partiql/ast/v1/FromExpr;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitFromJoin (Lorg/partiql/ast/v1/FromJoin;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphLabel (Lorg/partiql/ast/v1/graph/GraphLabel;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphLabelConj (Lorg/partiql/ast/v1/graph/GraphLabel$Conj;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphLabelDisj (Lorg/partiql/ast/v1/graph/GraphLabel$Disj;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphLabelName (Lorg/partiql/ast/v1/graph/GraphLabel$Name;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphLabelNegation (Lorg/partiql/ast/v1/graph/GraphLabel$Negation;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphLabelWildcard (Lorg/partiql/ast/v1/graph/GraphLabel$Wildcard;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphMatch (Lorg/partiql/ast/v1/graph/GraphMatch;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphMatchPattern (Lorg/partiql/ast/v1/graph/GraphPattern;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphPart (Lorg/partiql/ast/v1/graph/GraphPart;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphPartEdge (Lorg/partiql/ast/v1/graph/GraphPart$Edge;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphPartNode (Lorg/partiql/ast/v1/graph/GraphPart$Node;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphPartPattern (Lorg/partiql/ast/v1/graph/GraphPart$Pattern;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphQuantifier (Lorg/partiql/ast/v1/graph/GraphQuantifier;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelector (Lorg/partiql/ast/v1/graph/GraphSelector;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelectorAllShortest (Lorg/partiql/ast/v1/graph/GraphSelector$AllShortest;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelectorAny (Lorg/partiql/ast/v1/graph/GraphSelector$Any;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelectorAnyK (Lorg/partiql/ast/v1/graph/GraphSelector$AnyK;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelectorAnyShortest (Lorg/partiql/ast/v1/graph/GraphSelector$AnyShortest;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelectorShortestK (Lorg/partiql/ast/v1/graph/GraphSelector$ShortestK;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGraphSelectorShortestKGroup (Lorg/partiql/ast/v1/graph/GraphSelector$ShortestKGroup;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGroupBy (Lorg/partiql/ast/v1/GroupBy;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitGroupByKey (Lorg/partiql/ast/v1/GroupBy$Key;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitIdentifier (Lorg/partiql/ast/v1/Identifier;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitIdentifierChain (Lorg/partiql/ast/v1/IdentifierChain;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitLet (Lorg/partiql/ast/v1/Let;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitLetBinding (Lorg/partiql/ast/v1/Let$Binding;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitOrderBy (Lorg/partiql/ast/v1/OrderBy;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPathStep (Lorg/partiql/ast/v1/expr/PathStep;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPathStepAllElements (Lorg/partiql/ast/v1/expr/PathStep$AllElements;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPathStepAllFields (Lorg/partiql/ast/v1/expr/PathStep$AllFields;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPathStepElement (Lorg/partiql/ast/v1/expr/PathStep$Element;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPathStepField (Lorg/partiql/ast/v1/expr/PathStep$Field;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitQuery (Lorg/partiql/ast/v1/Query;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitQueryBody (Lorg/partiql/ast/v1/QueryBody;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitQueryBodySFW (Lorg/partiql/ast/v1/QueryBody$SFW;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitQueryBodySetOp (Lorg/partiql/ast/v1/QueryBody$SetOp;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelect (Lorg/partiql/ast/v1/Select;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectItem (Lorg/partiql/ast/v1/SelectItem;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectItemAll (Lorg/partiql/ast/v1/SelectItem$Star;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectItemExpr (Lorg/partiql/ast/v1/SelectItem$Expr;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectList (Lorg/partiql/ast/v1/SelectList;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectPivot (Lorg/partiql/ast/v1/SelectPivot;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectStar (Lorg/partiql/ast/v1/SelectStar;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSelectValue (Lorg/partiql/ast/v1/SelectValue;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSetOp (Lorg/partiql/ast/v1/SetOp;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitSort (Lorg/partiql/ast/v1/Sort;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitStatement (Lorg/partiql/ast/v1/Statement;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitTableRef (Lorg/partiql/ast/v1/FromTableRef;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/DataType : org/partiql/ast/v1/Enum { + public static final field BAG I + public static final field BIGINT I + public static final field BINARY_LARGE_OBJECT I + public static final field BIT I + public static final field BIT_VARYING I + public static final field BLOB I + public static final field BOOL I + public static final field BOOLEAN I + public static final field CHAR I + public static final field CHARACTER I + public static final field CHARACTER_LARGE_OBJECT I + public static final field CHARACTER_VARYING I + public static final field CHAR_LARGE_OBJECT I + public static final field CHAR_VARYING I + public static final field CLOB I + public static final field DATE I + public static final field DEC I + public static final field DECIMAL I + public static final field DOUBLE_PRECISION I + public static final field FLOAT I + public static final field INT I + public static final field INT2 I + public static final field INT4 I + public static final field INT8 I + public static final field INTEGER I + public static final field INTEGER2 I + public static final field INTEGER4 I + public static final field INTEGER8 I + public static final field INTERVAL I + public static final field LIST I + public static final field MISSING I + public static final field NULL I + public static final field NUMERIC I + public static final field REAL I + public static final field SEXP I + public static final field SMALLINT I + public static final field STRING I + public static final field STRUCT I + public static final field SYMBOL I + public static final field TIME I + public static final field TIMESTAMP I + public static final field TIMESTAMP_WITH_TIME_ZONE I + public static final field TIME_WITH_TIME_ZONE I + public static final field TINYINT I + public static final field TUPLE I + public static final field UNKNOWN I + public static final field USER_DEFINED I + public static final field VARCHAR I + public static fun BAG ()Lorg/partiql/ast/v1/DataType; + public static fun BIGINT ()Lorg/partiql/ast/v1/DataType; + public static fun BINARY_LARGE_OBJECT ()Lorg/partiql/ast/v1/DataType; + public static fun BINARY_LARGE_OBJECT (I)Lorg/partiql/ast/v1/DataType; + public static fun BIT ()Lorg/partiql/ast/v1/DataType; + public static fun BIT (I)Lorg/partiql/ast/v1/DataType; + public static fun BIT_VARYING ()Lorg/partiql/ast/v1/DataType; + public static fun BIT_VARYING (I)Lorg/partiql/ast/v1/DataType; + public static fun BLOB ()Lorg/partiql/ast/v1/DataType; + public static fun BLOB (I)Lorg/partiql/ast/v1/DataType; + public static fun BOOL ()Lorg/partiql/ast/v1/DataType; + public static fun BOOLEAN ()Lorg/partiql/ast/v1/DataType; + public static fun CHAR ()Lorg/partiql/ast/v1/DataType; + public static fun CHAR (I)Lorg/partiql/ast/v1/DataType; + public static fun CHARACTER ()Lorg/partiql/ast/v1/DataType; + public static fun CHARACTER (I)Lorg/partiql/ast/v1/DataType; + public static fun CHARACTER_LARGE_OBJECT ()Lorg/partiql/ast/v1/DataType; + public static fun CHARACTER_LARGE_OBJECT (I)Lorg/partiql/ast/v1/DataType; + public static fun CHARACTER_VARYING ()Lorg/partiql/ast/v1/DataType; + public static fun CHARACTER_VARYING (I)Lorg/partiql/ast/v1/DataType; + public static fun CHAR_LARGE_OBJECT ()Lorg/partiql/ast/v1/DataType; + public static fun CHAR_LARGE_OBJECT (I)Lorg/partiql/ast/v1/DataType; + public static fun CHAR_VARYING ()Lorg/partiql/ast/v1/DataType; + public static fun CHAR_VARYING (I)Lorg/partiql/ast/v1/DataType; + public static fun CLOB ()Lorg/partiql/ast/v1/DataType; + public static fun CLOB (I)Lorg/partiql/ast/v1/DataType; + public static fun DATE ()Lorg/partiql/ast/v1/DataType; + public static fun DEC ()Lorg/partiql/ast/v1/DataType; + public static fun DECIMAL ()Lorg/partiql/ast/v1/DataType; + public static fun DECIMAL (I)Lorg/partiql/ast/v1/DataType; + public static fun DECIMAL (II)Lorg/partiql/ast/v1/DataType; + public static fun DOUBLE_PRECISION ()Lorg/partiql/ast/v1/DataType; + public static fun FLOAT ()Lorg/partiql/ast/v1/DataType; + public static fun FLOAT (I)Lorg/partiql/ast/v1/DataType; + public static fun INT ()Lorg/partiql/ast/v1/DataType; + public static fun INT2 ()Lorg/partiql/ast/v1/DataType; + public static fun INT4 ()Lorg/partiql/ast/v1/DataType; + public static fun INT8 ()Lorg/partiql/ast/v1/DataType; + public static fun INTEGER ()Lorg/partiql/ast/v1/DataType; + public static fun INTEGER2 ()Lorg/partiql/ast/v1/DataType; + public static fun INTEGER4 ()Lorg/partiql/ast/v1/DataType; + public static fun INTEGER8 ()Lorg/partiql/ast/v1/DataType; + public static fun INTERVAL ()Lorg/partiql/ast/v1/DataType; + public static fun LIST ()Lorg/partiql/ast/v1/DataType; + public static fun MISSING ()Lorg/partiql/ast/v1/DataType; + public static fun NULL ()Lorg/partiql/ast/v1/DataType; + public static fun NUMERIC ()Lorg/partiql/ast/v1/DataType; + public static fun NUMERIC (I)Lorg/partiql/ast/v1/DataType; + public static fun NUMERIC (II)Lorg/partiql/ast/v1/DataType; + public static fun REAL ()Lorg/partiql/ast/v1/DataType; + public static fun SEXP ()Lorg/partiql/ast/v1/DataType; + public static fun SMALLINT ()Lorg/partiql/ast/v1/DataType; + public static fun STRING ()Lorg/partiql/ast/v1/DataType; + public static fun STRING (I)Lorg/partiql/ast/v1/DataType; + public static fun STRUCT ()Lorg/partiql/ast/v1/DataType; + public static fun SYMBOL ()Lorg/partiql/ast/v1/DataType; + public static fun TIME ()Lorg/partiql/ast/v1/DataType; + public static fun TIME (I)Lorg/partiql/ast/v1/DataType; + public static fun TIMESTAMP ()Lorg/partiql/ast/v1/DataType; + public static fun TIMESTAMP (I)Lorg/partiql/ast/v1/DataType; + public static fun TIMESTAMP_WITH_TIME_ZONE ()Lorg/partiql/ast/v1/DataType; + public static fun TIMESTAMP_WITH_TIME_ZONE (I)Lorg/partiql/ast/v1/DataType; + public static fun TIME_WITH_TIME_ZONE ()Lorg/partiql/ast/v1/DataType; + public static fun TIME_WITH_TIME_ZONE (I)Lorg/partiql/ast/v1/DataType; + public static fun TINYINT ()Lorg/partiql/ast/v1/DataType; + public static fun TUPLE ()Lorg/partiql/ast/v1/DataType; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/DataType; + public static fun USER_DEFINED (Lorg/partiql/ast/v1/IdentifierChain;)Lorg/partiql/ast/v1/DataType; + public static fun VARCHAR ()Lorg/partiql/ast/v1/DataType; + public static fun VARCHAR (I)Lorg/partiql/ast/v1/DataType; + public fun code ()I + public fun getLength ()Ljava/lang/Integer; + public fun getName ()Lorg/partiql/ast/v1/IdentifierChain; + public fun getPrecision ()Ljava/lang/Integer; + public fun getScale ()Ljava/lang/Integer; +} + +public class org/partiql/ast/v1/DatetimeField : org/partiql/ast/v1/Enum { + public static final field DAY I + public static final field HOUR I + public static final field MINUTE I + public static final field MONTH I + public static final field SECOND I + public static final field TIMEZONE_HOUR I + public static final field TIMEZONE_MINUTE I + public static final field UNKNOWN I + public static final field YEAR I + public static fun DAY ()Lorg/partiql/ast/v1/DatetimeField; + public static fun HOUR ()Lorg/partiql/ast/v1/DatetimeField; + public static fun MINUTE ()Lorg/partiql/ast/v1/DatetimeField; + public static fun MONTH ()Lorg/partiql/ast/v1/DatetimeField; + public static fun SECOND ()Lorg/partiql/ast/v1/DatetimeField; + public static fun TIMEZONE_HOUR ()Lorg/partiql/ast/v1/DatetimeField; + public static fun TIMEZONE_MINUTE ()Lorg/partiql/ast/v1/DatetimeField; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/DatetimeField; + public static fun YEAR ()Lorg/partiql/ast/v1/DatetimeField; + public fun code ()I +} + +public abstract interface class org/partiql/ast/v1/Enum { + public abstract fun code ()I +} + +public class org/partiql/ast/v1/Exclude : org/partiql/ast/v1/AstNode { + public field excludePaths Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/ExcludePath : org/partiql/ast/v1/AstNode { + public field excludeSteps Ljava/util/List; + public field root Lorg/partiql/ast/v1/expr/ExprVarRef; + public fun (Lorg/partiql/ast/v1/expr/ExprVarRef;Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/ExcludeStep : org/partiql/ast/v1/AstNode { + public fun ()V +} + +public class org/partiql/ast/v1/ExcludeStep$CollIndex : org/partiql/ast/v1/ExcludeStep { + public field index I + public fun (I)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/ExcludeStep$CollWildcard : org/partiql/ast/v1/ExcludeStep { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/ExcludeStep$StructField : org/partiql/ast/v1/ExcludeStep { + public field symbol Lorg/partiql/ast/v1/Identifier; + public fun (Lorg/partiql/ast/v1/Identifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/ExcludeStep$StructWildcard : org/partiql/ast/v1/ExcludeStep { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/Explain : org/partiql/ast/v1/Statement { + public field options Ljava/util/Map; + public field statement Lorg/partiql/ast/v1/Statement; + public fun (Ljava/util/Map;Lorg/partiql/ast/v1/Statement;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/From : org/partiql/ast/v1/AstNode { + public field tableRefs Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/FromExpr : org/partiql/ast/v1/FromTableRef { + public field asAlias Lorg/partiql/ast/v1/Identifier; + public field atAlias Lorg/partiql/ast/v1/Identifier; + public field expr Lorg/partiql/ast/v1/expr/Expr; + public field fromType Lorg/partiql/ast/v1/FromType; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/FromType;Lorg/partiql/ast/v1/Identifier;Lorg/partiql/ast/v1/Identifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/FromJoin : org/partiql/ast/v1/FromTableRef { + public field condition Lorg/partiql/ast/v1/expr/Expr; + public field joinType Lorg/partiql/ast/v1/JoinType; + public field lhs Lorg/partiql/ast/v1/From; + public field rhs Lorg/partiql/ast/v1/From; + public fun (Lorg/partiql/ast/v1/From;Lorg/partiql/ast/v1/From;Lorg/partiql/ast/v1/JoinType;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/FromTableRef : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/FromType : org/partiql/ast/v1/Enum { + public static final field SCAN I + public static final field UNKNOWN I + public static final field UNPIVOT I + public static fun SCAN ()Lorg/partiql/ast/v1/FromType; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/FromType; + public static fun UNPIVOT ()Lorg/partiql/ast/v1/FromType; + public fun code ()I +} + +public class org/partiql/ast/v1/GroupBy : org/partiql/ast/v1/AstNode { + public field asAlias Lorg/partiql/ast/v1/Identifier; + public field keys Ljava/util/List; + public field strategy Lorg/partiql/ast/v1/GroupByStrategy; + public fun (Lorg/partiql/ast/v1/GroupByStrategy;Ljava/util/List;Lorg/partiql/ast/v1/Identifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/GroupBy$Key : org/partiql/ast/v1/AstNode { + public field asAlias Lorg/partiql/ast/v1/Identifier; + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/Identifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/GroupByStrategy : org/partiql/ast/v1/Enum { + public static final field FULL I + public static final field PARTIAL I + public static final field UNKNOWN I + public static fun FULL ()Lorg/partiql/ast/v1/GroupByStrategy; + public static fun PARTIAL ()Lorg/partiql/ast/v1/GroupByStrategy; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/GroupByStrategy; + public fun code ()I +} + +public class org/partiql/ast/v1/Identifier : org/partiql/ast/v1/AstNode { + public field isDelimited Z + public field symbol Ljava/lang/String; + public fun (Ljava/lang/String;Z)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/IdentifierChain : org/partiql/ast/v1/AstNode { + public field next Lorg/partiql/ast/v1/IdentifierChain; + public field root Lorg/partiql/ast/v1/Identifier; + public fun (Lorg/partiql/ast/v1/Identifier;Lorg/partiql/ast/v1/IdentifierChain;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/JoinType : org/partiql/ast/v1/Enum { + public static final field CROSS I + public static final field FULL I + public static final field FULL_OUTER I + public static final field INNER I + public static final field LEFT I + public static final field LEFT_OUTER I + public static final field RIGHT I + public static final field RIGHT_OUTER I + public static final field UNKNOWN I + public static fun CROSS ()Lorg/partiql/ast/v1/JoinType; + public static fun FULL ()Lorg/partiql/ast/v1/JoinType; + public static fun FULL_OUTER ()Lorg/partiql/ast/v1/JoinType; + public static fun INNER ()Lorg/partiql/ast/v1/JoinType; + public static fun LEFT ()Lorg/partiql/ast/v1/JoinType; + public static fun LEFT_OUTER ()Lorg/partiql/ast/v1/JoinType; + public static fun RIGHT ()Lorg/partiql/ast/v1/JoinType; + public static fun RIGHT_OUTER ()Lorg/partiql/ast/v1/JoinType; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/JoinType; + public fun code ()I +} + +public class org/partiql/ast/v1/Let : org/partiql/ast/v1/AstNode { + public field bindings Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/Let$Binding : org/partiql/ast/v1/AstNode { + public field asAlias Lorg/partiql/ast/v1/Identifier; + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/Identifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/Nulls : org/partiql/ast/v1/Enum { + public static final field FIRST I + public static final field LAST I + public static final field UNKNOWN I + public static fun FIRST ()Lorg/partiql/ast/v1/Nulls; + public static fun LAST ()Lorg/partiql/ast/v1/Nulls; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/Nulls; + public fun code ()I +} + +public class org/partiql/ast/v1/Order : org/partiql/ast/v1/Enum { + public static final field ASC I + public static final field DESC I + public static final field UNKNOWN I + public static fun ASC ()Lorg/partiql/ast/v1/Order; + public static fun DESC ()Lorg/partiql/ast/v1/Order; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/Order; + public fun code ()I +} + +public class org/partiql/ast/v1/OrderBy : org/partiql/ast/v1/AstNode { + public field sorts Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/Query : org/partiql/ast/v1/Statement { + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/QueryBody : org/partiql/ast/v1/AstNode { + public fun ()V +} + +public class org/partiql/ast/v1/QueryBody$SFW : org/partiql/ast/v1/QueryBody { + public field exclude Lorg/partiql/ast/v1/Exclude; + public field from Lorg/partiql/ast/v1/From; + public field groupBy Lorg/partiql/ast/v1/GroupBy; + public field having Lorg/partiql/ast/v1/expr/Expr; + public field let Lorg/partiql/ast/v1/Let; + public field select Lorg/partiql/ast/v1/Select; + public field where Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/Select;Lorg/partiql/ast/v1/Exclude;Lorg/partiql/ast/v1/From;Lorg/partiql/ast/v1/Let;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/GroupBy;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/QueryBody$SetOp : org/partiql/ast/v1/QueryBody { + public field isOuter Z + public field lhs Lorg/partiql/ast/v1/expr/Expr; + public field rhs Lorg/partiql/ast/v1/expr/Expr; + public field type Lorg/partiql/ast/v1/SetOp; + public fun (Lorg/partiql/ast/v1/SetOp;ZLorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/Select : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public abstract class org/partiql/ast/v1/SelectItem : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/SelectItem$Expr : org/partiql/ast/v1/SelectItem { + public field asAlias Lorg/partiql/ast/v1/Identifier; + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/Identifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SelectItem$Star : org/partiql/ast/v1/SelectItem { + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SelectList : org/partiql/ast/v1/Select { + public field items Ljava/util/List; + public field setq Lorg/partiql/ast/v1/SetQuantifier; + public fun (Ljava/util/List;Lorg/partiql/ast/v1/SetQuantifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SelectPivot : org/partiql/ast/v1/Select { + public field key Lorg/partiql/ast/v1/expr/Expr; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SelectStar : org/partiql/ast/v1/Select { + public field setq Lorg/partiql/ast/v1/SetQuantifier; + public fun (Lorg/partiql/ast/v1/SetQuantifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SelectValue : org/partiql/ast/v1/Select { + public field constructor Lorg/partiql/ast/v1/expr/Expr; + public field setq Lorg/partiql/ast/v1/SetQuantifier; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/SetQuantifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SetOp : org/partiql/ast/v1/AstNode { + public field setOpType Lorg/partiql/ast/v1/SetOpType; + public field setq Lorg/partiql/ast/v1/SetQuantifier; + public fun (Lorg/partiql/ast/v1/SetOpType;Lorg/partiql/ast/v1/SetQuantifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/SetOpType : org/partiql/ast/v1/Enum { + public static fun EXCEPT ()Lorg/partiql/ast/v1/SetOpType; + public static fun INTERSECT ()Lorg/partiql/ast/v1/SetOpType; + public static fun UNION ()Lorg/partiql/ast/v1/SetOpType; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/SetOpType; + public fun code ()I +} + +public class org/partiql/ast/v1/SetQuantifier : org/partiql/ast/v1/Enum { + public static final field ALL I + public static final field DISTINCT I + public static final field UNKNOWN I + public static fun ALL ()Lorg/partiql/ast/v1/SetQuantifier; + public static fun DISTINCT ()Lorg/partiql/ast/v1/SetQuantifier; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/SetQuantifier; + public fun code ()I +} + +public class org/partiql/ast/v1/Sort : org/partiql/ast/v1/AstNode { + public field expr Lorg/partiql/ast/v1/expr/Expr; + public field nulls Lorg/partiql/ast/v1/Nulls; + public field order Lorg/partiql/ast/v1/Order; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/Order;Lorg/partiql/ast/v1/Nulls;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/Statement : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public abstract class org/partiql/ast/v1/expr/Expr : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/expr/ExprAnd : org/partiql/ast/v1/expr/Expr { + public field lhs Lorg/partiql/ast/v1/expr/Expr; + public field rhs Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprArray : org/partiql/ast/v1/expr/Expr { + public field values Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprBag : org/partiql/ast/v1/expr/Expr { + public field values Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprBetween : org/partiql/ast/v1/expr/Expr { + public field from Lorg/partiql/ast/v1/expr/Expr; + public field not Z + public field to Lorg/partiql/ast/v1/expr/Expr; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Z)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprCall : org/partiql/ast/v1/expr/Expr { + public field args Ljava/util/List; + public field function Lorg/partiql/ast/v1/IdentifierChain; + public field setq Lorg/partiql/ast/v1/SetQuantifier; + public fun (Lorg/partiql/ast/v1/IdentifierChain;Ljava/util/List;Lorg/partiql/ast/v1/SetQuantifier;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprCase : org/partiql/ast/v1/expr/Expr { + public field branches Ljava/util/List; + public field defaultExpr Lorg/partiql/ast/v1/expr/Expr; + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Ljava/util/List;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprCase$Branch : org/partiql/ast/v1/AstNode { + public field condition Lorg/partiql/ast/v1/expr/Expr; + public field expr Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprCast : org/partiql/ast/v1/expr/Expr { + public field asType Lorg/partiql/ast/v1/DataType; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/DataType;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprCoalesce : org/partiql/ast/v1/expr/Expr { + public field args Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprExtract : org/partiql/ast/v1/expr/Expr { + public field field Lorg/partiql/ast/v1/DatetimeField; + public field source Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/DatetimeField;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprInCollection : org/partiql/ast/v1/expr/Expr { + public field lhs Lorg/partiql/ast/v1/expr/Expr; + public field not Z + public field rhs Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Z)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprIsType : org/partiql/ast/v1/expr/Expr { + public field not Z + public field type Lorg/partiql/ast/v1/DataType; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/DataType;Z)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprLike : org/partiql/ast/v1/expr/Expr { + public field escape Lorg/partiql/ast/v1/expr/Expr; + public field not Z + public field pattern Lorg/partiql/ast/v1/expr/Expr; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Z)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprLit : org/partiql/ast/v1/expr/Expr { + public field value Lorg/partiql/value/PartiQLValue; + public fun (Lorg/partiql/value/PartiQLValue;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprMatch : org/partiql/ast/v1/expr/Expr { + public field expr Lorg/partiql/ast/v1/expr/Expr; + public field pattern Lorg/partiql/ast/v1/graph/GraphMatch; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/graph/GraphMatch;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprNot : org/partiql/ast/v1/expr/Expr { + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprNullIf : org/partiql/ast/v1/expr/Expr { + public field v1 Lorg/partiql/ast/v1/expr/Expr; + public field v2 Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprOperator : org/partiql/ast/v1/expr/Expr { + public field lhs Lorg/partiql/ast/v1/expr/Expr; + public field rhs Lorg/partiql/ast/v1/expr/Expr; + public field symbol Ljava/lang/String; + public fun (Ljava/lang/String;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprOr : org/partiql/ast/v1/expr/Expr { + public field lhs Lorg/partiql/ast/v1/expr/Expr; + public field rhs Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprOverlay : org/partiql/ast/v1/expr/Expr { + public field forLength Lorg/partiql/ast/v1/expr/Expr; + public field from Lorg/partiql/ast/v1/expr/Expr; + public field placing Lorg/partiql/ast/v1/expr/Expr; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprParameter : org/partiql/ast/v1/expr/Expr { + public field index I + public fun (I)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprPath : org/partiql/ast/v1/expr/Expr { + public field next Lorg/partiql/ast/v1/expr/PathStep; + public field root Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/PathStep;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprPosition : org/partiql/ast/v1/expr/Expr { + public field lhs Lorg/partiql/ast/v1/expr/Expr; + public field rhs Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprQuerySet : org/partiql/ast/v1/expr/Expr { + public field body Lorg/partiql/ast/v1/QueryBody; + public field limit Lorg/partiql/ast/v1/expr/Expr; + public field offset Lorg/partiql/ast/v1/expr/Expr; + public field orderBy Lorg/partiql/ast/v1/OrderBy; + public fun (Lorg/partiql/ast/v1/QueryBody;Lorg/partiql/ast/v1/OrderBy;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprSessionAttribute : org/partiql/ast/v1/expr/Expr { + public field sessionAttribute Lorg/partiql/ast/v1/expr/SessionAttribute; + public fun (Lorg/partiql/ast/v1/expr/SessionAttribute;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprStruct : org/partiql/ast/v1/expr/Expr { + public field fields Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprStruct$Field : org/partiql/ast/v1/AstNode { + public field name Lorg/partiql/ast/v1/expr/Expr; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprSubstring : org/partiql/ast/v1/expr/Expr { + public field length Lorg/partiql/ast/v1/expr/Expr; + public field start Lorg/partiql/ast/v1/expr/Expr; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprTrim : org/partiql/ast/v1/expr/Expr { + public field chars Lorg/partiql/ast/v1/expr/Expr; + public field trimSpec Lorg/partiql/ast/v1/expr/TrimSpec; + public field value Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/TrimSpec;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprValues : org/partiql/ast/v1/expr/Expr { + public field rows Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprValues$Row : org/partiql/ast/v1/AstNode { + public field values Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprVarRef : org/partiql/ast/v1/expr/Expr { + public field identifierChain Lorg/partiql/ast/v1/IdentifierChain; + public field scope Lorg/partiql/ast/v1/expr/Scope; + public fun (Lorg/partiql/ast/v1/IdentifierChain;Lorg/partiql/ast/v1/expr/Scope;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprVariant : org/partiql/ast/v1/expr/Expr { + public field encoding Ljava/lang/String; + public field value Ljava/lang/String; + public fun (Ljava/lang/String;Ljava/lang/String;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public synthetic fun children ()Ljava/util/Collection; + public fun children ()Ljava/util/List; +} + +public class org/partiql/ast/v1/expr/ExprWindow : org/partiql/ast/v1/expr/Expr { + public field defaultValue Lorg/partiql/ast/v1/expr/Expr; + public field expression Lorg/partiql/ast/v1/expr/Expr; + public field offset Lorg/partiql/ast/v1/expr/Expr; + public field over Lorg/partiql/ast/v1/expr/ExprWindow$Over; + public field windowFunction Lorg/partiql/ast/v1/expr/WindowFunction; + public fun (Lorg/partiql/ast/v1/expr/WindowFunction;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/ExprWindow$Over;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/ExprWindow$Over : org/partiql/ast/v1/AstNode { + public field partitions Ljava/util/List; + public field sorts Ljava/util/List; + public fun (Ljava/util/List;Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/expr/PathStep : org/partiql/ast/v1/AstNode { + public field next Lorg/partiql/ast/v1/expr/PathStep; + public fun ()V +} + +public class org/partiql/ast/v1/expr/PathStep$AllElements : org/partiql/ast/v1/expr/PathStep { + public fun (Lorg/partiql/ast/v1/expr/PathStep;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/PathStep$AllFields : org/partiql/ast/v1/expr/PathStep { + public fun (Lorg/partiql/ast/v1/expr/PathStep;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/PathStep$Element : org/partiql/ast/v1/expr/PathStep { + public field element Lorg/partiql/ast/v1/expr/Expr; + public fun (Lorg/partiql/ast/v1/expr/Expr;Lorg/partiql/ast/v1/expr/PathStep;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/PathStep$Field : org/partiql/ast/v1/expr/PathStep { + public field field Lorg/partiql/ast/v1/Identifier; + public fun (Lorg/partiql/ast/v1/Identifier;Lorg/partiql/ast/v1/expr/PathStep;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/expr/Scope : org/partiql/ast/v1/Enum { + public static final field DEFAULT I + public static final field LOCAL I + public static final field UNKNOWN I + public static fun DEFAULT ()Lorg/partiql/ast/v1/expr/Scope; + public static fun LOCAL ()Lorg/partiql/ast/v1/expr/Scope; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/expr/Scope; + public fun code ()I +} + +public class org/partiql/ast/v1/expr/SessionAttribute : org/partiql/ast/v1/Enum { + public static final field CURRENT_DATE I + public static final field CURRENT_USER I + public static final field UNKNOWN I + public fun (I)V + public static fun CURRENT_DATE ()Lorg/partiql/ast/v1/expr/SessionAttribute; + public static fun CURRENT_USER ()Lorg/partiql/ast/v1/expr/SessionAttribute; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/expr/SessionAttribute; + public fun code ()I +} + +public class org/partiql/ast/v1/expr/TrimSpec : org/partiql/ast/v1/Enum { + public static final field BOTH I + public static final field LEADING I + public static final field TRAILING I + public static final field UNKNOWN I + public static fun BOTH ()Lorg/partiql/ast/v1/expr/TrimSpec; + public static fun LEADING ()Lorg/partiql/ast/v1/expr/TrimSpec; + public static fun TRAILING ()Lorg/partiql/ast/v1/expr/TrimSpec; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/expr/TrimSpec; + public fun code ()I +} + +public class org/partiql/ast/v1/expr/WindowFunction : org/partiql/ast/v1/Enum { + public static final field LAG I + public static final field LEAD I + public static final field UNKNOWN I + public fun (I)V + public static fun LAG ()Lorg/partiql/ast/v1/expr/WindowFunction; + public static fun LEAD ()Lorg/partiql/ast/v1/expr/WindowFunction; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/expr/WindowFunction; + public fun code ()I +} + +public class org/partiql/ast/v1/graph/GraphDirection : org/partiql/ast/v1/Enum { + public static final field LEFT I + public static final field LEFT_OR_RIGHT I + public static final field LEFT_OR_UNDIRECTED I + public static final field LEFT_UNDIRECTED_OR_RIGHT I + public static final field RIGHT I + public static final field UNDIRECTED I + public static final field UNDIRECTED_OR_RIGHT I + public static final field UNKNOWN I + public static fun LEFT ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun LEFT_OR_RIGHT ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun LEFT_OR_UNDIRECTED ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun LEFT_UNDIRECTED_OR_RIGHT ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun RIGHT ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun UNDIRECTED ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun UNDIRECTED_OR_RIGHT ()Lorg/partiql/ast/v1/graph/GraphDirection; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/graph/GraphDirection; + public fun code ()I +} + +public abstract class org/partiql/ast/v1/graph/GraphLabel : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/graph/GraphLabel$Conj : org/partiql/ast/v1/graph/GraphLabel { + public field args Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphLabel$Disj : org/partiql/ast/v1/graph/GraphLabel { + public field args Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphLabel$Name : org/partiql/ast/v1/graph/GraphLabel { + public field name Ljava/lang/String; + public fun (Ljava/lang/String;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphLabel$Negation : org/partiql/ast/v1/graph/GraphLabel { + public field arg Lorg/partiql/ast/v1/graph/GraphLabel; + public fun (Lorg/partiql/ast/v1/graph/GraphLabel;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphLabel$Wildcard : org/partiql/ast/v1/graph/GraphLabel { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphMatch : org/partiql/ast/v1/AstNode { + public field patterns Ljava/util/List; + public field selector Lorg/partiql/ast/v1/graph/GraphSelector; + public fun (Ljava/util/List;Lorg/partiql/ast/v1/graph/GraphSelector;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public abstract class org/partiql/ast/v1/graph/GraphPart : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/graph/GraphPart$Edge : org/partiql/ast/v1/graph/GraphPart { + public field direction Lorg/partiql/ast/v1/graph/GraphDirection; + public field label Lorg/partiql/ast/v1/graph/GraphLabel; + public field prefilter Lorg/partiql/ast/v1/expr/Expr; + public field quantifier Lorg/partiql/ast/v1/graph/GraphQuantifier; + public field variable Ljava/lang/String; + public fun (Lorg/partiql/ast/v1/graph/GraphDirection;Lorg/partiql/ast/v1/graph/GraphQuantifier;Lorg/partiql/ast/v1/expr/Expr;Ljava/lang/String;Lorg/partiql/ast/v1/graph/GraphLabel;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphPart$Node : org/partiql/ast/v1/graph/GraphPart { + public field label Lorg/partiql/ast/v1/graph/GraphLabel; + public field prefilter Lorg/partiql/ast/v1/expr/Expr; + public field variable Ljava/lang/String; + public fun (Lorg/partiql/ast/v1/expr/Expr;Ljava/lang/String;Lorg/partiql/ast/v1/graph/GraphLabel;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphPart$Pattern : org/partiql/ast/v1/graph/GraphPart { + public field pattern Lorg/partiql/ast/v1/graph/GraphPattern; + public fun (Lorg/partiql/ast/v1/graph/GraphPattern;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphPattern : org/partiql/ast/v1/AstNode { + public field parts Ljava/util/List; + public field prefilter Lorg/partiql/ast/v1/expr/Expr; + public field quantifier Lorg/partiql/ast/v1/graph/GraphQuantifier; + public field restrictor Lorg/partiql/ast/v1/graph/GraphRestrictor; + public field variable Ljava/lang/String; + public fun (Lorg/partiql/ast/v1/graph/GraphRestrictor;Lorg/partiql/ast/v1/expr/Expr;Ljava/lang/String;Lorg/partiql/ast/v1/graph/GraphQuantifier;Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphQuantifier : org/partiql/ast/v1/AstNode { + public field lower Ljava/lang/Long; + public field upper Ljava/lang/Long; + public fun (Ljava/lang/Long;Ljava/lang/Long;)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphRestrictor : org/partiql/ast/v1/Enum { + public static final field ACYCLIC I + public static final field SIMPLE I + public static final field TRAIL I + public static final field UNKNOWN I + public static fun ACYCLIC ()Lorg/partiql/ast/v1/graph/GraphRestrictor; + public static fun SIMPLE ()Lorg/partiql/ast/v1/graph/GraphRestrictor; + public static fun TRAIL ()Lorg/partiql/ast/v1/graph/GraphRestrictor; + public static fun UNKNOWN ()Lorg/partiql/ast/v1/graph/GraphRestrictor; + public fun code ()I +} + +public abstract class org/partiql/ast/v1/graph/GraphSelector : org/partiql/ast/v1/AstNode { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public class org/partiql/ast/v1/graph/GraphSelector$AllShortest : org/partiql/ast/v1/graph/GraphSelector { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphSelector$Any : org/partiql/ast/v1/graph/GraphSelector { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphSelector$AnyK : org/partiql/ast/v1/graph/GraphSelector { + public field k J + public fun (J)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphSelector$AnyShortest : org/partiql/ast/v1/graph/GraphSelector { + public fun ()V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphSelector$ShortestK : org/partiql/ast/v1/graph/GraphSelector { + public field k J + public fun (J)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + +public class org/partiql/ast/v1/graph/GraphSelector$ShortestKGroup : org/partiql/ast/v1/graph/GraphSelector { + public field k J + public fun (J)V + public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public fun children ()Ljava/util/Collection; +} + public abstract class org/partiql/ast/visitor/AstBaseVisitor : org/partiql/ast/visitor/AstVisitor { public fun ()V public abstract fun defaultReturn (Lorg/partiql/ast/AstNode;Ljava/lang/Object;)Ljava/lang/Object; diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/AstNode.java b/partiql-ast/src/main/java/org/partiql/ast/v1/AstNode.java new file mode 100644 index 000000000..c192ae9e0 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/AstNode.java @@ -0,0 +1,20 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.Random; + +/** + * TODO docs, equals, hashcode + * TODO support source location -- https://github.com/partiql/partiql-lang-kotlin/issues/1608 + */ +public abstract class AstNode { + @NotNull + public String tag = "Ast-" + String.format("%06x", new Random().nextInt()); + + @NotNull + public abstract Collection children(); + + public abstract R accept(@NotNull AstVisitor visitor, C ctx); +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/AstVisitor.java b/partiql-ast/src/main/java/org/partiql/ast/v1/AstVisitor.java new file mode 100644 index 000000000..5848612d6 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/AstVisitor.java @@ -0,0 +1,238 @@ +package org.partiql.ast.v1; + +import org.partiql.ast.v1.expr.Expr; +import org.partiql.ast.v1.expr.ExprAnd; +import org.partiql.ast.v1.expr.ExprArray; +import org.partiql.ast.v1.expr.ExprBag; +import org.partiql.ast.v1.expr.ExprBetween; +import org.partiql.ast.v1.expr.ExprCall; +import org.partiql.ast.v1.expr.ExprCase; +import org.partiql.ast.v1.expr.ExprCast; +import org.partiql.ast.v1.expr.ExprCoalesce; +import org.partiql.ast.v1.expr.ExprExtract; +import org.partiql.ast.v1.expr.ExprInCollection; +import org.partiql.ast.v1.expr.ExprIsType; +import org.partiql.ast.v1.expr.ExprLike; +import org.partiql.ast.v1.expr.ExprLit; +import org.partiql.ast.v1.expr.ExprMatch; +import org.partiql.ast.v1.expr.ExprNot; +import org.partiql.ast.v1.expr.ExprNullIf; +import org.partiql.ast.v1.expr.ExprOperator; +import org.partiql.ast.v1.expr.ExprOr; +import org.partiql.ast.v1.expr.ExprOverlay; +import org.partiql.ast.v1.expr.ExprParameter; +import org.partiql.ast.v1.expr.ExprPath; +import org.partiql.ast.v1.expr.PathStep; +import org.partiql.ast.v1.expr.ExprPosition; +import org.partiql.ast.v1.expr.ExprQuerySet; +import org.partiql.ast.v1.expr.ExprSessionAttribute; +import org.partiql.ast.v1.expr.ExprStruct; +import org.partiql.ast.v1.expr.ExprSubstring; +import org.partiql.ast.v1.expr.ExprTrim; +import org.partiql.ast.v1.expr.ExprValues; +import org.partiql.ast.v1.expr.ExprVarRef; +import org.partiql.ast.v1.expr.ExprVariant; +import org.partiql.ast.v1.expr.ExprWindow; +import org.partiql.ast.v1.graph.GraphLabel; +import org.partiql.ast.v1.graph.GraphMatch; +import org.partiql.ast.v1.graph.GraphPart; +import org.partiql.ast.v1.graph.GraphPattern; +import org.partiql.ast.v1.graph.GraphQuantifier; +import org.partiql.ast.v1.graph.GraphSelector; + +public interface AstVisitor { + R visit(AstNode node, C ctx); + + R visitStatement(Statement node, C ctx); + + R visitQuery(Query node, C ctx); + + R visitExplain(Explain node, C ctx); + + R visitIdentifier(Identifier node, C ctx); + + R visitIdentifierChain(IdentifierChain node, C ctx); + + R visitExpr(Expr node, C ctx); + + R visitExprLit(ExprLit node, C ctx); + + R visitExprVariant(ExprVariant node, C ctx); + + R visitExprVarRef(ExprVarRef node, C ctx); + + R visitExprSessionAttribute(ExprSessionAttribute node, C ctx); + + R visitExprPath(ExprPath node, C ctx); + + R visitPathStep(PathStep node, C ctx); + + R visitPathStepField(PathStep.Field node, C ctx); + + R visitPathStepElement(PathStep.Element node, C ctx); + + R visitPathStepAllElements(PathStep.AllElements node, C ctx); + + R visitPathStepAllFields(PathStep.AllFields node, C ctx); + + R visitExprCall(ExprCall node, C ctx); + + R visitExprParameter(ExprParameter node, C ctx); + + R visitExprOperator(ExprOperator node, C ctx); + + R visitExprNot(ExprNot node, C ctx); + + R visitExprAnd(ExprAnd node, C ctx); + + R visitExprOr(ExprOr node, C ctx); + + R visitExprValues(ExprValues node, C ctx); + + R visitExprValuesRow(ExprValues.Row node, C ctx); + + R visitExprArray(ExprArray node, C ctx); + + R visitExprBag(ExprBag node, C ctx); + + R visitExprStruct(ExprStruct node, C ctx); + + R visitExprStructField(ExprStruct.Field node, C ctx); + + R visitExprLike(ExprLike node, C ctx); + + R visitExprBetween(ExprBetween node, C ctx); + + R visitExprInCollection(ExprInCollection node, C ctx); + + R visitExprIsType(ExprIsType node, C ctx); + + R visitExprCase(ExprCase node, C ctx); + + R visitExprCaseBranch(ExprCase.Branch node, C ctx); + + R visitExprCoalesce(ExprCoalesce node, C ctx); + + R visitExprNullIf(ExprNullIf node, C ctx); + + R visitExprSubstring(ExprSubstring node, C ctx); + + R visitExprPosition(ExprPosition node, C ctx); + + R visitExprTrim(ExprTrim node, C ctx); + + R visitExprOverlay(ExprOverlay node, C ctx); + + R visitExprExtract(ExprExtract node, C ctx); + + R visitExprCast(ExprCast node, C ctx); + + R visitExprQuerySet(ExprQuerySet node, C ctx); + + R visitExprMatch(ExprMatch node, C ctx); + + R visitExprWindow(ExprWindow node, C ctx); + + R visitExprWindowOver(ExprWindow.Over node, C ctx); + + R visitQueryBody(QueryBody node, C ctx); + + R visitQueryBodySFW(QueryBody.SFW node, C ctx); + + R visitQueryBodySetOp(QueryBody.SetOp node, C ctx); + + R visitSelect(Select node, C ctx); + + R visitSelectStar(SelectStar node, C ctx); + + R visitSelectList(SelectList node, C ctx); + + R visitSelectItem(SelectItem node, C ctx); + + R visitSelectItemAll(SelectItem.Star node, C ctx); + + R visitSelectItemExpr(SelectItem.Expr node, C ctx); + + R visitSelectPivot(SelectPivot node, C ctx); + + R visitSelectValue(SelectValue node, C ctx); + + R visitExclude(Exclude node, C ctx); + + R visitExcludePath(ExcludePath node, C ctx); + + R visitExcludeStep(ExcludeStep node, C ctx); + + R visitExcludeStepStructField(ExcludeStep.StructField node, C ctx); + + R visitExcludeStepCollIndex(ExcludeStep.CollIndex node, C ctx); + + R visitExcludeStepStructWildcard(ExcludeStep.StructWildcard node, C ctx); + + R visitExcludeStepCollWildcard(ExcludeStep.CollWildcard node, C ctx); + + R visitFrom(From node, C ctx); + + R visitTableRef(FromTableRef node, C ctx); + + R visitFromExpr(FromExpr node, C ctx); + + R visitFromJoin(FromJoin node, C ctx); + + R visitLet(Let node, C ctx); + + R visitLetBinding(Let.Binding node, C ctx); + + R visitGroupBy(GroupBy node, C ctx); + + R visitGroupByKey(GroupBy.Key node, C ctx); + + R visitOrderBy(OrderBy node, C ctx); + + R visitSort(Sort node, C ctx); + + R visitSetOp(SetOp node, C ctx); + + R visitGraphMatch(GraphMatch node, C ctx); + + R visitGraphMatchPattern(GraphPattern node, C ctx); + + R visitGraphPart(GraphPart node, C ctx); + + R visitGraphPartNode(GraphPart.Node node, C ctx); + + R visitGraphPartEdge(GraphPart.Edge node, C ctx); + + R visitGraphPartPattern(GraphPart.Pattern node, C ctx); + + R visitGraphQuantifier(GraphQuantifier node, C ctx); + + R visitGraphSelector(GraphSelector node, C ctx); + + R visitGraphSelectorAnyShortest(GraphSelector.AnyShortest node, C ctx); + + R visitGraphSelectorAllShortest(GraphSelector.AllShortest node, C ctx); + + R visitGraphSelectorAny(GraphSelector.Any node, C ctx); + + R visitGraphSelectorAnyK(GraphSelector.AnyK node, C ctx); + + R visitGraphSelectorShortestK(GraphSelector.ShortestK node, C ctx); + + R visitGraphSelectorShortestKGroup( + GraphSelector.ShortestKGroup node, + C ctx + ); + + R visitGraphLabel(GraphLabel node, C ctx); + + R visitGraphLabelName(GraphLabel.Name node, C ctx); + + R visitGraphLabelWildcard(GraphLabel.Wildcard node, C ctx); + + R visitGraphLabelNegation(GraphLabel.Negation node, C ctx); + + R visitGraphLabelConj(GraphLabel.Conj node, C ctx); + + R visitGraphLabelDisj(GraphLabel.Disj node, C ctx); +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/DataType.java b/partiql-ast/src/main/java/org/partiql/ast/v1/DataType.java new file mode 100644 index 000000000..bd2eb922c --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/DataType.java @@ -0,0 +1,414 @@ +package org.partiql.ast.v1; + +public class DataType implements Enum { + public static final int UNKNOWN = 0; + // + public static final int NULL = 1; + public static final int MISSING = 2; + // + public static final int CHARACTER = 3; + public static final int CHAR = 4; + public static final int CHARACTER_VARYING = 5; + public static final int CHAR_VARYING = 6; // TODO not defined in parser yet + public static final int VARCHAR = 7; + public static final int CHARACTER_LARGE_OBJECT = 8; // TODO not defined in parser yet + public static final int CHAR_LARGE_OBJECT = 9; // TODO not defined in parser yet + public static final int CLOB = 10; + public static final int STRING = 11; + public static final int SYMBOL = 12; + // + public static final int BLOB = 13; + public static final int BINARY_LARGE_OBJECT = 14; // TODO not defined in parser yet + // + public static final int BIT = 15; // TODO not defined in parser yet + public static final int BIT_VARYING = 16; // TODO not defined in parser yet + // - + public static final int NUMERIC = 17; + public static final int DECIMAL = 18; + public static final int DEC = 19; + public static final int BIGINT = 20; + public static final int INT8 = 21; + public static final int INTEGER8 = 22; + public static final int INT4 = 23; + public static final int INTEGER4 = 24; + public static final int INTEGER = 25; + public static final int INT = 26; + public static final int INT2 = 27; + public static final int INTEGER2 = 28; + public static final int SMALLINT = 29; + public static final int TINYINT = 30; // TODO not defined in parser yet + // - + public static final int FLOAT = 31; + public static final int REAL = 32; + public static final int DOUBLE_PRECISION = 33; + // + public static final int BOOLEAN = 34; + public static final int BOOL = 35; + // + public static final int DATE = 36; + public static final int TIME = 37; + public static final int TIME_WITH_TIME_ZONE = 38; + public static final int TIMESTAMP = 39; + public static final int TIMESTAMP_WITH_TIME_ZONE = 40; + // + public static final int INTERVAL = 41; // TODO not defined in parser yet + // + public static final int STRUCT = 42; + public static final int TUPLE = 43; + // + public static final int LIST = 44; + public static final int BAG = 45; + public static final int SEXP = 46; + // + public static final int USER_DEFINED = 47; + + public static DataType UNKNOWN() { + return new DataType(UNKNOWN); + } + + public static DataType NULL() { + return new DataType(NULL); + } + + public static DataType MISSING() { + return new DataType(MISSING); + } + + public static DataType BOOL() { + return new DataType(BOOL); + } + + public static DataType BOOLEAN() { + return new DataType(BOOLEAN); + } + + public static DataType TINYINT() { + return new DataType(TINYINT); + } + + public static DataType SMALLINT() { + return new DataType(SMALLINT); + } + + public static DataType INTEGER2() { + return new DataType(INTEGER2); + } + + public static DataType INT2() { + return new DataType(INT2); + } + + public static DataType INTEGER() { + return new DataType(INTEGER); + } + + public static DataType INT() { + return new DataType(INT); + } + + public static DataType INTEGER4() { + return new DataType(INTEGER4); + } + + public static DataType INT4() { + return new DataType(INT4); + } + + public static DataType INTEGER8() { + return new DataType(INTEGER8); + } + + public static DataType INT8() { + return new DataType(INT8); + } + + public static DataType BIGINT() { + return new DataType(BIGINT); + } + + public static DataType REAL() { + return new DataType(REAL); + } + + public static DataType DOUBLE_PRECISION() { + return new DataType(DOUBLE_PRECISION); + } + + public static DataType FLOAT() { + return new DataType(FLOAT); + } + + public static DataType FLOAT(int precision) { + return new DataType(FLOAT, precision, null, null); + } + + public static DataType DECIMAL() { + return new DataType(DECIMAL); + } + + public static DataType DECIMAL(int precision) { + return new DataType(DECIMAL, precision, null, null); + } + + public static DataType DECIMAL(int precision, int scale) { + return new DataType(DECIMAL, precision, scale, null); + } + + public static DataType DEC() { + return new DataType(DEC); + } + + public static DataType NUMERIC() { + return new DataType(NUMERIC); + } + + public static DataType NUMERIC(int precision) { + return new DataType(NUMERIC, precision, null, null); + } + + public static DataType NUMERIC(int precision, int scale) { + return new DataType(NUMERIC, precision, scale, null); + } + + public static DataType BIT() { + return new DataType(BIT); + } + + public static DataType BIT(int length) { + return new DataType(BIT, null, null, length); + } + + public static DataType BIT_VARYING() { + return new DataType(BIT_VARYING); + } + + public static DataType BIT_VARYING(int length) { + return new DataType(BIT_VARYING, null, null, length); + } + + public static DataType CHAR() { + return new DataType(CHAR); + } + + public static DataType CHAR(int length) { + return new DataType(CHAR, null, null, length); + } + + public static DataType CHARACTER() { + return new DataType(CHARACTER); + } + + public static DataType CHARACTER(int length) { + return new DataType(CHARACTER, null, null, length); + } + + public static DataType VARCHAR() { + return new DataType(VARCHAR); + } + + public static DataType VARCHAR(int length) { + return new DataType(VARCHAR, null, null, length); + } + + public static DataType CHARACTER_LARGE_OBJECT() { + return new DataType(CHARACTER_LARGE_OBJECT); + } + + public static DataType CHARACTER_LARGE_OBJECT(int length) { + return new DataType(CHARACTER_LARGE_OBJECT, null, null, length); + } + + public static DataType CHAR_LARGE_OBJECT() { + return new DataType(CHAR_LARGE_OBJECT); + } + + public static DataType CHAR_LARGE_OBJECT(int length) { + return new DataType(CHAR_LARGE_OBJECT, null, null, length); + } + + public static DataType CHARACTER_VARYING() { + return new DataType(CHARACTER_VARYING); + } + + public static DataType CHAR_VARYING() { + return new DataType(CHAR_VARYING); + } + + public static DataType CHAR_VARYING(int length) { + return new DataType(CHAR_VARYING, null, null, length); + } + + public static DataType CHARACTER_VARYING(int length) { + return new DataType(CHARACTER_VARYING, null, null, length); + } + + public static DataType STRING() { + return new DataType(STRING); + } + + public static DataType STRING(int length) { + return new DataType(STRING, null, null, length); + } + + public static DataType SYMBOL() { + return new DataType(SYMBOL); + } + + public static DataType BLOB() { + return new DataType(BLOB); + } + + public static DataType BLOB(int length) { + return new DataType(BLOB, null, null, length); + } + + public static DataType BINARY_LARGE_OBJECT() { + return new DataType(BINARY_LARGE_OBJECT); + } + + public static DataType BINARY_LARGE_OBJECT(int length) { + return new DataType(BINARY_LARGE_OBJECT, null, null, length); + } + + public static DataType CLOB() { + return new DataType(CLOB); + } + + public static DataType CLOB(int length) { + return new DataType(CLOB, null, null, length); + } + + public static DataType DATE() { + return new DataType(DATE); + } + + public static DataType STRUCT() { + return new DataType(STRUCT); + } + + public static DataType TUPLE() { + return new DataType(TUPLE); + } + + public static DataType LIST() { + return new DataType(LIST); + } + + public static DataType SEXP() { + return new DataType(SEXP); + } + + public static DataType BAG() { + return new DataType(BAG); + } + + public static DataType TIME() { + return new DataType(TIME); + } + + public static DataType TIME(int precision) { + return new DataType(TIME, precision, null, null); + } + + public static DataType TIMESTAMP() { + return new DataType(TIMESTAMP); + } + + public static DataType TIMESTAMP(int precision) { + return new DataType(TIMESTAMP, precision, null, null); + } + + public static DataType TIME_WITH_TIME_ZONE() { + return new DataType(TIME_WITH_TIME_ZONE); + } + + public static DataType TIME_WITH_TIME_ZONE(int precision) { + return new DataType(TIME_WITH_TIME_ZONE, precision, null, null); + } + + public static DataType TIMESTAMP_WITH_TIME_ZONE() { + return new DataType(TIMESTAMP_WITH_TIME_ZONE); + } + + public static DataType TIMESTAMP_WITH_TIME_ZONE(int precision) { + return new DataType(TIMESTAMP_WITH_TIME_ZONE, precision, null, null); + } + + public static DataType INTERVAL() { + return new DataType(INTERVAL); + } + + public static DataType USER_DEFINED(IdentifierChain name) { + return new DataType(USER_DEFINED, name); + } + + private final int code; + private final Integer precision; + private final Integer scale; + private final Integer length; + private final IdentifierChain name; + + // Private constructor for no parameter DataTypes + private DataType(int code) { + this.code = code; + this.precision = null; + this.scale = null; + this.length = null; + this.name = null; + } + + // Private constructor for DataTypes with Integer parameters; set `name` to null + private DataType(int code, Integer precision, Integer scale, Integer length) { + this.code = code; + this.precision = precision; + this.scale = scale; + this.length = length; + this.name = null; + } + + // Private constructor for user-defined type w/ an `IdentifierChain` `name`; other parameters set to null + private DataType(int code, IdentifierChain name) { + this.code = code; + this.name = name; + this.precision = null; + this.scale = null; + this.length = null; + } + + @Override + public int code() { + return code; + } + + /** + * TODO docs + * @return + */ + public Integer getPrecision() { + return precision; + } + + /** + * TODO docs + * @return + */ + public Integer getScale() { + return scale; + } + + /** + * TODO docs + * @return + */ + public Integer getLength() { + return length; + } + + /** + * TODO docs + * @return + */ + public IdentifierChain getName() { + return name; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/DatetimeField.java b/partiql-ast/src/main/java/org/partiql/ast/v1/DatetimeField.java new file mode 100644 index 000000000..13327f768 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/DatetimeField.java @@ -0,0 +1,63 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class DatetimeField implements Enum { + public static final int UNKNOWN = 0; + public static final int YEAR = 1; + public static final int MONTH = 2; + public static final int DAY = 3; + public static final int HOUR = 4; + public static final int MINUTE = 5; + public static final int SECOND = 6; + public static final int TIMEZONE_HOUR = 7; + public static final int TIMEZONE_MINUTE = 8; + + public static DatetimeField UNKNOWN() { + return new DatetimeField(UNKNOWN); + } + + public static DatetimeField YEAR() { + return new DatetimeField(YEAR); + } + + public static DatetimeField MONTH() { + return new DatetimeField(MONTH); + } + + public static DatetimeField DAY() { + return new DatetimeField(DAY); + } + + public static DatetimeField HOUR() { + return new DatetimeField(HOUR); + } + + public static DatetimeField MINUTE() { + return new DatetimeField(MINUTE); + } + + public static DatetimeField SECOND() { + return new DatetimeField(SECOND); + } + + public static DatetimeField TIMEZONE_HOUR() { + return new DatetimeField(TIMEZONE_HOUR); + } + + public static DatetimeField TIMEZONE_MINUTE() { + return new DatetimeField(TIMEZONE_MINUTE); + } + + private final int code; + + private DatetimeField(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Enum.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Enum.java new file mode 100644 index 000000000..e4551f21f --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Enum.java @@ -0,0 +1,8 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public interface Enum { + int code(); +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Exclude.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Exclude.java new file mode 100644 index 000000000..f95a33b79 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Exclude.java @@ -0,0 +1,30 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class Exclude extends AstNode { + @NotNull + public List excludePaths; + + public Exclude(@NotNull List excludePaths) { + this.excludePaths = excludePaths; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(excludePaths); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExclude(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/ExcludePath.java b/partiql-ast/src/main/java/org/partiql/ast/v1/ExcludePath.java new file mode 100644 index 000000000..e468f4719 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/ExcludePath.java @@ -0,0 +1,38 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.expr.ExprVarRef; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExcludePath extends AstNode { + @NotNull + public ExprVarRef root; + + @NotNull + public List excludeSteps; + + public ExcludePath(@NotNull ExprVarRef root, @NotNull List excludeSteps) { + this.root = root; + this.excludeSteps = excludeSteps; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(root); + kids.addAll(excludeSteps); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExcludePath(this, ctx); +} +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/ExcludeStep.java b/partiql-ast/src/main/java/org/partiql/ast/v1/ExcludeStep.java new file mode 100644 index 000000000..42a42b1ef --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/ExcludeStep.java @@ -0,0 +1,91 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public abstract class ExcludeStep extends AstNode { + /** + * TODO docs, equals, hashcode + */ + public static class StructField extends ExcludeStep { + @NotNull + public Identifier symbol; + + public StructField(@NotNull Identifier symbol) { + this.symbol = symbol; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(symbol); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExcludeStepStructField(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class CollIndex extends ExcludeStep { + public int index; + + public CollIndex(int index) { + this.index = index; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExcludeStepCollIndex(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class StructWildcard extends ExcludeStep { + @NotNull + @Override + public Collection children() { + return new ArrayList<>(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExcludeStepStructWildcard(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class CollWildcard extends ExcludeStep { + @NotNull + @Override + public Collection children() { + return new ArrayList<>(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExcludeStepCollWildcard(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Explain.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Explain.java new file mode 100644 index 000000000..a89a1c40d --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Explain.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.partiql.value.PartiQLValue; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * TODO docs, equals, hashcode + */ +public class Explain extends Statement { + // TODO get rid of PartiQLValue once https://github.com/partiql/partiql-lang-kotlin/issues/1589 is resolved + @NotNull + public Map options; + + @NotNull + public Statement statement; + + public Explain(@NotNull Map options, @NotNull Statement statement) { + this.options = options; + this.statement = statement; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(statement); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExplain(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/From.java b/partiql-ast/src/main/java/org/partiql/ast/v1/From.java new file mode 100644 index 000000000..1b36b5e52 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/From.java @@ -0,0 +1,30 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class From extends AstNode { + @NotNull + public List tableRefs; + + public From(@NotNull List tableRefs) { + this.tableRefs = tableRefs; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(tableRefs); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitFrom(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/FromExpr.java b/partiql-ast/src/main/java/org/partiql/ast/v1/FromExpr.java new file mode 100644 index 000000000..c213cfdb8 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/FromExpr.java @@ -0,0 +1,49 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class FromExpr extends FromTableRef { + @NotNull + public Expr expr; + + @NotNull + public FromType fromType; + + @Nullable + public Identifier asAlias; + + @Nullable + public Identifier atAlias; + + public FromExpr(@NotNull Expr expr, @NotNull FromType fromType, @Nullable Identifier asAlias, + @Nullable Identifier atAlias) { + this.expr = expr; + this.fromType = fromType; + this.asAlias = asAlias; + this.atAlias = atAlias; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + if (asAlias != null) kids.add(asAlias); + if (atAlias != null) kids.add(atAlias); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitFromExpr(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/FromJoin.java b/partiql-ast/src/main/java/org/partiql/ast/v1/FromJoin.java new file mode 100644 index 000000000..22c97c811 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/FromJoin.java @@ -0,0 +1,50 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class FromJoin extends FromTableRef { + @NotNull + public From lhs; + + @NotNull + public From rhs; + + @Nullable + public JoinType joinType; + + @Nullable + public Expr condition; + + public FromJoin(@NotNull From lhs, @NotNull From rhs, @Nullable JoinType joinType, @Nullable Expr condition) { + this.lhs = lhs; + this.rhs = rhs; + this.joinType = joinType; + this.condition = condition; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(lhs); + kids.add(rhs); + if (condition != null) { + kids.add(condition); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitFromJoin(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/FromTableRef.java b/partiql-ast/src/main/java/org/partiql/ast/v1/FromTableRef.java new file mode 100644 index 000000000..fb5088350 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/FromTableRef.java @@ -0,0 +1,19 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +/** + * TODO docs, equals, hashcode + */ +public abstract class FromTableRef extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof FromExpr) { + return visitor.visitFromExpr((FromExpr) this, ctx); + } else if (this instanceof FromJoin) { + return visitor.visitFromJoin((FromJoin) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/FromType.java b/partiql-ast/src/main/java/org/partiql/ast/v1/FromType.java new file mode 100644 index 000000000..3303f20b6 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/FromType.java @@ -0,0 +1,33 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class FromType implements Enum { + public static final int UNKNOWN = 0; + public static final int SCAN = 1; + public static final int UNPIVOT = 2; + + public static FromType UNKNOWN() { + return new FromType(UNKNOWN); + } + + public static FromType SCAN() { + return new FromType(SCAN); + } + + public static FromType UNPIVOT() { + return new FromType(UNPIVOT); + } + + private final int code; + + private FromType(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/GroupBy.java b/partiql-ast/src/main/java/org/partiql/ast/v1/GroupBy.java new file mode 100644 index 000000000..e3ea0e12c --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/GroupBy.java @@ -0,0 +1,76 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class GroupBy extends AstNode { + @NotNull + public GroupByStrategy strategy; + + @NotNull + public List keys; + + @Nullable + public Identifier asAlias; + + public GroupBy(@NotNull GroupByStrategy strategy, @NotNull List keys, @Nullable Identifier asAlias) { + this.strategy = strategy; + this.keys = keys; + this.asAlias = asAlias; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(keys); + if (asAlias != null) { + kids.add(asAlias); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGroupBy(this, ctx); + } + + /** + * TODO docs, equals, hashcode + */ + public static class Key extends AstNode { + @NotNull + public Expr expr; + + @Nullable + public Identifier asAlias; + + public Key(@NotNull Expr expr, @Nullable Identifier asAlias) { + this.expr = expr; + this.asAlias = asAlias; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + if (asAlias != null) { + kids.add(asAlias); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGroupByKey(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/GroupByStrategy.java b/partiql-ast/src/main/java/org/partiql/ast/v1/GroupByStrategy.java new file mode 100644 index 000000000..d1ee546a1 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/GroupByStrategy.java @@ -0,0 +1,33 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class GroupByStrategy implements Enum { + public static final int UNKNOWN = 0; + public static final int FULL = 1; + public static final int PARTIAL = 2; + + public static GroupByStrategy UNKNOWN() { + return new GroupByStrategy(UNKNOWN); + } + + public static GroupByStrategy FULL() { + return new GroupByStrategy(FULL); + } + + public static GroupByStrategy PARTIAL() { + return new GroupByStrategy(PARTIAL); + } + + private final int code; + + private GroupByStrategy(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Identifier.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Identifier.java new file mode 100644 index 000000000..896d74f54 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Identifier.java @@ -0,0 +1,32 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * TODO docs, equals, hashcode + */ +public class Identifier extends AstNode { + @NotNull + public String symbol; + + public boolean isDelimited; + + public Identifier(@NotNull String symbol, boolean isDelimited) { + this.symbol = symbol; + this.isDelimited = isDelimited; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitIdentifier(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/IdentifierChain.java b/partiql-ast/src/main/java/org/partiql/ast/v1/IdentifierChain.java new file mode 100644 index 000000000..81f78e3f6 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/IdentifierChain.java @@ -0,0 +1,40 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class IdentifierChain extends AstNode { + @NotNull + public Identifier root; + + @Nullable + public IdentifierChain next; + + public IdentifierChain(@NotNull Identifier root, @Nullable IdentifierChain next) { + this.root = root; + this.next = next; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(root); + if (next != null) { + kids.add(next); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitIdentifierChain(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/JoinType.java b/partiql-ast/src/main/java/org/partiql/ast/v1/JoinType.java new file mode 100644 index 000000000..fe89a3970 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/JoinType.java @@ -0,0 +1,63 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class JoinType implements Enum { + public static final int UNKNOWN = 0; + public static final int INNER = 1; + public static final int LEFT = 2; + public static final int LEFT_OUTER = 3; + public static final int RIGHT = 4; + public static final int RIGHT_OUTER = 5; + public static final int FULL = 6; + public static final int FULL_OUTER = 7; + public static final int CROSS = 8; + + public static JoinType UNKNOWN() { + return new JoinType(UNKNOWN); + } + + public static JoinType INNER() { + return new JoinType(INNER); + } + + public static JoinType LEFT() { + return new JoinType(LEFT); + } + + public static JoinType LEFT_OUTER() { + return new JoinType(LEFT_OUTER); + } + + public static JoinType RIGHT() { + return new JoinType(RIGHT); + } + + public static JoinType RIGHT_OUTER() { + return new JoinType(RIGHT_OUTER); + } + + public static JoinType FULL() { + return new JoinType(FULL); + } + + public static JoinType FULL_OUTER() { + return new JoinType(FULL_OUTER); + } + + public static JoinType CROSS() { + return new JoinType(CROSS); + } + + private final int code; + + private JoinType(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Let.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Let.java new file mode 100644 index 000000000..b9d040c47 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Let.java @@ -0,0 +1,61 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class Let extends AstNode { + @NotNull + public List bindings; + + public Let(@NotNull List bindings) { + this.bindings = bindings; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(bindings); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitLet(this, ctx); + } + + /** + * TODO docs, equals, hashcode + */ + public static class Binding extends AstNode { + @NotNull + public Expr expr; + + @NotNull + public Identifier asAlias; + + public Binding(@NotNull Expr expr, @NotNull Identifier asAlias) { + this.expr = expr; + this.asAlias = asAlias; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + kids.add(asAlias); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitLetBinding(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Nulls.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Nulls.java new file mode 100644 index 000000000..718cb0d7d --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Nulls.java @@ -0,0 +1,33 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class Nulls implements Enum { + public static final int UNKNOWN = 0; + public static final int FIRST = 1; + public static final int LAST = 2; + + public static Nulls UNKNOWN() { + return new Nulls(UNKNOWN); + } + + public static Nulls FIRST() { + return new Nulls(FIRST); + } + + public static Nulls LAST() { + return new Nulls(LAST); + } + + private final int code; + + private Nulls(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Order.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Order.java new file mode 100644 index 000000000..1c60b46f0 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Order.java @@ -0,0 +1,30 @@ +package org.partiql.ast.v1; + +public class Order implements Enum { + public static final int UNKNOWN = 0; + public static final int ASC = 1; + public static final int DESC = 2; + + public static Order UNKNOWN() { + return new Order(UNKNOWN); + } + + public static Order ASC() { + return new Order(ASC); + } + + public static Order DESC() { + return new Order(DESC); + } + + private final int code; + + private Order(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/OrderBy.java b/partiql-ast/src/main/java/org/partiql/ast/v1/OrderBy.java new file mode 100644 index 000000000..2008867d4 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/OrderBy.java @@ -0,0 +1,30 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class OrderBy extends AstNode { + @NotNull + public List sorts; + + public OrderBy(@NotNull List sorts) { + this.sorts = sorts; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(sorts); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitOrderBy(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Query.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Query.java new file mode 100644 index 000000000..e5838dfa7 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Query.java @@ -0,0 +1,33 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class Query extends Statement { + @NotNull + public Expr expr; + + public Query(@NotNull Expr expr) { + this.expr = expr; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitQuery(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/QueryBody.java b/partiql-ast/src/main/java/org/partiql/ast/v1/QueryBody.java new file mode 100644 index 000000000..0f4b42814 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/QueryBody.java @@ -0,0 +1,99 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public abstract class QueryBody extends AstNode { + public static class SFW extends QueryBody { + @NotNull + public Select select; + + @Nullable + public Exclude exclude; + + @NotNull + public From from; + + @Nullable + public Let let; + + @Nullable + public Expr where; + + @Nullable + public GroupBy groupBy; + + @Nullable + public Expr having; + + public SFW(@NotNull Select select, @Nullable Exclude exclude, @NotNull From from, + @Nullable Let let, @Nullable Expr where, @Nullable GroupBy groupBy, @Nullable Expr having) { + this.select = select; + this.exclude = exclude; + this.from = from; + this.let = let; + this.where = where; + this.groupBy = groupBy; + this.having = having; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(select); + if (exclude != null) kids.add(exclude); + kids.add(from); + if (let != null) kids.add(let); + if (where != null) kids.add(where); + if (groupBy != null) kids.add(groupBy); + if (having != null) kids.add(having); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitQueryBodySFW(this, ctx); + } + } + + public static class SetOp extends QueryBody { + @NotNull + public org.partiql.ast.v1.SetOp type; + + public boolean isOuter; + + @NotNull + public Expr lhs; + + @NotNull + public Expr rhs; + + public SetOp(@NotNull org.partiql.ast.v1.SetOp type, boolean isOuter, @NotNull Expr lhs, @NotNull Expr rhs) { + this.type = type; + this.isOuter = isOuter; + this.lhs = lhs; + this.rhs = rhs; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(type); + kids.add(lhs); + kids.add(rhs); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitQueryBodySetOp(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Select.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Select.java new file mode 100644 index 000000000..275fbcf33 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Select.java @@ -0,0 +1,23 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +/** + * TODO docs, equals, hashcode + */ +public abstract class Select extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof SelectStar) { + return visitor.visitSelectStar((SelectStar) this, ctx); + } else if (this instanceof SelectList) { + return visitor.visitSelectList((SelectList) this, ctx); + } else if (this instanceof SelectPivot) { + return visitor.visitSelectPivot((SelectPivot) this, ctx); + } else if (this instanceof SelectValue) { + return visitor.visitSelectValue((SelectValue) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SelectItem.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectItem.java new file mode 100644 index 000000000..c5f6422a7 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectItem.java @@ -0,0 +1,81 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public abstract class SelectItem extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof Star) { + return visitor.visitSelectItemAll((Star) this, ctx); + } else if (this instanceof Expr) { + return visitor.visitSelectItemExpr((Expr) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Star extends SelectItem { + @NotNull + public org.partiql.ast.v1.expr.Expr expr; + + public Star(@NotNull org.partiql.ast.v1.expr.Expr expr) { + this.expr = expr; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSelectItemAll(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Expr extends SelectItem { + @NotNull + public org.partiql.ast.v1.expr.Expr expr; + + @Nullable + public Identifier asAlias; + + public Expr(@NotNull org.partiql.ast.v1.expr.Expr expr, @Nullable Identifier asAlias) { + this.expr = expr; + this.asAlias = asAlias; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + if (asAlias != null) { + kids.add(asAlias); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSelectItemExpr(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SelectList.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectList.java new file mode 100644 index 000000000..e4ec73fc8 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectList.java @@ -0,0 +1,35 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class SelectList extends Select { + @NotNull + public List items; + + @Nullable + public SetQuantifier setq; + + public SelectList(@NotNull List items, @Nullable SetQuantifier setq) { + this.items = items; + this.setq = setq; + } + + @NotNull + @Override + public Collection children() { + return new ArrayList<>(items); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSelectList(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SelectPivot.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectPivot.java new file mode 100644 index 000000000..a6b59693f --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectPivot.java @@ -0,0 +1,38 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class SelectPivot extends Select { + @NotNull + public Expr key; + + @NotNull + public Expr value; + + public SelectPivot(@NotNull Expr key, @NotNull Expr value) { + this.key = key; + this.value = value; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(key); + kids.add(value); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSelectPivot(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SelectStar.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectStar.java new file mode 100644 index 000000000..310ccaad5 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectStar.java @@ -0,0 +1,30 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public class SelectStar extends Select { + @Nullable + public SetQuantifier setq; + + public SelectStar(@Nullable SetQuantifier setq) { + this.setq = setq; + } + + @NotNull + @Override + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSelectStar(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SelectValue.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectValue.java new file mode 100644 index 000000000..185af14df --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SelectValue.java @@ -0,0 +1,38 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class SelectValue extends Select { + @NotNull + public Expr constructor; + + @Nullable + public SetQuantifier setq; + + public SelectValue(@NotNull Expr constructor, @Nullable SetQuantifier setq) { + this.constructor = constructor; + this.setq = setq; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(constructor); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSelectValue(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SetOp.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SetOp.java new file mode 100644 index 000000000..13a77764d --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SetOp.java @@ -0,0 +1,34 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public class SetOp extends AstNode { + @NotNull + public SetOpType setOpType; + + @Nullable + public SetQuantifier setq; + + public SetOp(@NotNull SetOpType setOpType, @Nullable SetQuantifier setq) { + this.setOpType = setOpType; + this.setq = setq; + } + + @NotNull + @Override + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSetOp(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SetOpType.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SetOpType.java new file mode 100644 index 000000000..b7253118b --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SetOpType.java @@ -0,0 +1,38 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class SetOpType implements Enum { + private static final int UNKNOWN = 0; + private static final int UNION = 1; + private static final int INTERSECT = 2; + private static final int EXCEPT = 3; + + public static SetOpType UNKNOWN() { + return new SetOpType(UNKNOWN); + } + + public static SetOpType UNION() { + return new SetOpType(UNION); + } + + public static SetOpType INTERSECT() { + return new SetOpType(INTERSECT); + } + + public static SetOpType EXCEPT() { + return new SetOpType(EXCEPT); + } + + private final int code; + + private SetOpType(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/SetQuantifier.java b/partiql-ast/src/main/java/org/partiql/ast/v1/SetQuantifier.java new file mode 100644 index 000000000..344bc6a85 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/SetQuantifier.java @@ -0,0 +1,33 @@ +package org.partiql.ast.v1; + +/** + * TODO docs, equals, hashcode + */ +public class SetQuantifier implements Enum { + public static final int UNKNOWN = 0; + public static final int ALL = 1; + public static final int DISTINCT = 2; + + public static SetQuantifier UNKNOWN() { + return new SetQuantifier(UNKNOWN); + } + + public static SetQuantifier ALL() { + return new SetQuantifier(ALL); + } + + public static SetQuantifier DISTINCT() { + return new SetQuantifier(DISTINCT); + } + + private final int code; + + private SetQuantifier(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} \ No newline at end of file diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Sort.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Sort.java new file mode 100644 index 000000000..a1009d152 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Sort.java @@ -0,0 +1,42 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class Sort extends AstNode { + @NotNull + public Expr expr; + + @Nullable + public Order order; + + @Nullable + public Nulls nulls; + + public Sort(@NotNull Expr expr, @Nullable Order order, @Nullable Nulls nulls) { + this.expr = expr; + this.order = order; + this.nulls = nulls; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitSort(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/Statement.java b/partiql-ast/src/main/java/org/partiql/ast/v1/Statement.java new file mode 100644 index 000000000..94ba678f9 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/Statement.java @@ -0,0 +1,19 @@ +package org.partiql.ast.v1; + +import org.jetbrains.annotations.NotNull; + +/** + * TODO docs, equals, hashcode + */ +public abstract class Statement extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof Query) { + return visitor.visitQuery((Query) this, ctx); + } else if (this instanceof Explain) { + return visitor.visitExplain((Explain) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/Expr.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/Expr.java new file mode 100644 index 000000000..92305a86b --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/Expr.java @@ -0,0 +1,79 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +/** + * TODO docs, equals, hashcode + */ +public abstract class Expr extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof ExprLit) { + return visitor.visitExprLit((ExprLit) this, ctx); + } else if (this instanceof ExprVariant) { + return visitor.visitExprVariant((ExprVariant) this, ctx); + } else if (this instanceof ExprVarRef) { + return visitor.visitExprVarRef((ExprVarRef) this, ctx); + } else if (this instanceof ExprSessionAttribute) { + return visitor.visitExprSessionAttribute((ExprSessionAttribute) this, ctx); + } else if (this instanceof ExprPath) { + return visitor.visitExprPath((ExprPath) this, ctx); + } else if (this instanceof ExprCall) { + return visitor.visitExprCall((ExprCall) this, ctx); + } else if (this instanceof ExprParameter) { + return visitor.visitExprParameter((ExprParameter) this, ctx); + } else if (this instanceof ExprOperator) { + return visitor.visitExprOperator((ExprOperator) this, ctx); + } else if (this instanceof ExprNot) { + return visitor.visitExprNot((ExprNot) this, ctx); + } else if (this instanceof ExprAnd) { + return visitor.visitExprAnd((ExprAnd) this, ctx); + } else if (this instanceof ExprOr) { + return visitor.visitExprOr((ExprOr) this, ctx); + } else if (this instanceof ExprValues) { + return visitor.visitExprValues((ExprValues) this, ctx); + } else if (this instanceof ExprArray) { + return visitor.visitExprArray((ExprArray) this, ctx); + } else if (this instanceof ExprBag) { + return visitor.visitExprBag((ExprBag) this, ctx); + } else if (this instanceof ExprStruct) { + return visitor.visitExprStruct((ExprStruct) this, ctx); + } else if (this instanceof ExprLike) { + return visitor.visitExprLike((ExprLike) this, ctx); + } else if (this instanceof ExprBetween) { + return visitor.visitExprBetween((ExprBetween) this, ctx); + } else if (this instanceof ExprInCollection) { + return visitor.visitExprInCollection((ExprInCollection) this, ctx); + } else if (this instanceof ExprIsType) { + return visitor.visitExprIsType((ExprIsType) this, ctx); + } else if (this instanceof ExprCase) { + return visitor.visitExprCase((ExprCase) this, ctx); + } else if (this instanceof ExprCoalesce) { + return visitor.visitExprCoalesce((ExprCoalesce) this, ctx); + } else if (this instanceof ExprNullIf) { + return visitor.visitExprNullIf((ExprNullIf) this, ctx); + } else if (this instanceof ExprSubstring) { + return visitor.visitExprSubstring((ExprSubstring) this, ctx); + } else if (this instanceof ExprPosition) { + return visitor.visitExprPosition((ExprPosition) this, ctx); + } else if (this instanceof ExprTrim) { + return visitor.visitExprTrim((ExprTrim) this, ctx); + } else if (this instanceof ExprOverlay) { + return visitor.visitExprOverlay((ExprOverlay) this, ctx); + } else if (this instanceof ExprExtract) { + return visitor.visitExprExtract((ExprExtract) this, ctx); + } else if (this instanceof ExprCast) { + return visitor.visitExprCast((ExprCast) this, ctx); + } else if (this instanceof ExprQuerySet) { + return visitor.visitExprQuerySet((ExprQuerySet) this, ctx); + } else if (this instanceof ExprMatch) { + return visitor.visitExprMatch((ExprMatch) this, ctx); + } else if (this instanceof ExprWindow) { + return visitor.visitExprWindow((ExprWindow) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprAnd.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprAnd.java new file mode 100644 index 000000000..1a5201431 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprAnd.java @@ -0,0 +1,38 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprAnd extends Expr { + @NotNull + public Expr lhs; + @NotNull + public Expr rhs; + + public ExprAnd(@NotNull Expr lhs, @NotNull Expr rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(lhs); + kids.add(rhs); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprAnd(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprArray.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprArray.java new file mode 100644 index 000000000..ecc1d8442 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprArray.java @@ -0,0 +1,32 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprArray extends Expr { + @NotNull + public List values; + + public ExprArray(@NotNull List values) { + this.values = values; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(values); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprArray(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprBag.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprBag.java new file mode 100644 index 000000000..cb3a50aba --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprBag.java @@ -0,0 +1,32 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprBag extends Expr { + @NotNull + public List values; + + public ExprBag(@NotNull List values) { + this.values = values; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(values); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprBag(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprBetween.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprBetween.java new file mode 100644 index 000000000..78d3b1e4a --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprBetween.java @@ -0,0 +1,47 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprBetween extends Expr { + @NotNull + public Expr value; + + @NotNull + public Expr from; + + @NotNull + public Expr to; + + public boolean not; + + public ExprBetween(@NotNull Expr value, @NotNull Expr from, @NotNull Expr to, boolean not) { + this.value = value; + this.from = from; + this.to = to; + this.not = not; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + kids.add(from); + kids.add(to); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprBetween(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCall.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCall.java new file mode 100644 index 000000000..8ff18819c --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCall.java @@ -0,0 +1,46 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.IdentifierChain; +import org.partiql.ast.v1.SetQuantifier; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprCall extends Expr { + @NotNull + public IdentifierChain function; + + @NotNull + public List args; + + @Nullable + public SetQuantifier setq; + + public ExprCall(@NotNull IdentifierChain function, @NotNull List args, @Nullable SetQuantifier setq) { + this.function = function; + this.args = args; + this.setq = setq; + } + + @NotNull + @Override + public Collection children() { + List kids = new ArrayList<>(); + kids.add(function); + kids.addAll(args); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprCall(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCase.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCase.java new file mode 100644 index 000000000..e2da2ef75 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCase.java @@ -0,0 +1,79 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprCase extends Expr { + @Nullable + public Expr expr; + + @NotNull + public List branches; + + @Nullable + public Expr defaultExpr; + + public ExprCase(@Nullable Expr expr, @NotNull List branches, @Nullable Expr defaultExpr) { + this.expr = expr; + this.branches = branches; + this.defaultExpr = defaultExpr; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (expr != null) { + kids.add(expr); + } + kids.addAll(branches); + if (defaultExpr != null) { + kids.add(defaultExpr); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprCase(this, ctx); + } + + /** + * TODO docs, equals, hashcode + */ + public static class Branch extends AstNode { + @NotNull + public Expr condition; + + @NotNull + public Expr expr; + + public Branch(@NotNull Expr condition, @NotNull Expr expr) { + this.condition = condition; + this.expr = expr; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(condition); + kids.add(expr); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprCaseBranch(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCast.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCast.java new file mode 100644 index 000000000..6dd3d5d29 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCast.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.DataType; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprCast extends Expr { + @NotNull + public Expr value; + + @NotNull + public DataType asType; + + public ExprCast(@NotNull Expr value, @NotNull DataType asType) { + this.value = value; + this.asType = asType; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprCast(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCoalesce.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCoalesce.java new file mode 100644 index 000000000..1020e850d --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprCoalesce.java @@ -0,0 +1,32 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprCoalesce extends Expr { + @NotNull + public List args; + + public ExprCoalesce(@NotNull List args) { + this.args = args; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(args); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprCoalesce(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprExtract.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprExtract.java new file mode 100644 index 000000000..580d3d88c --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprExtract.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.DatetimeField; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprExtract extends Expr { + @NotNull + public DatetimeField field; + + @NotNull + public Expr source; + + public ExprExtract(@NotNull DatetimeField field, @NotNull Expr source) { + this.field = field; + this.source = source; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(source); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprExtract(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprInCollection.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprInCollection.java new file mode 100644 index 000000000..dc23fdde9 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprInCollection.java @@ -0,0 +1,42 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprInCollection extends Expr { + @NotNull + public Expr lhs; + + @NotNull + public Expr rhs; + + public boolean not; + + public ExprInCollection(@NotNull Expr lhs, @NotNull Expr rhs, boolean not) { + this.lhs = lhs; + this.rhs = rhs; + this.not = not; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(lhs); + kids.add(rhs); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprInCollection(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprIsType.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprIsType.java new file mode 100644 index 000000000..a8f20ba88 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprIsType.java @@ -0,0 +1,42 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.DataType; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprIsType extends Expr { + @NotNull + public Expr value; + + @NotNull + public DataType type; + + public boolean not; + + public ExprIsType(@NotNull Expr value, @NotNull DataType type, boolean not) { + this.value = value; + this.type = type; + this.not = not; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprIsType(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprLike.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprLike.java new file mode 100644 index 000000000..9c2b571b3 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprLike.java @@ -0,0 +1,50 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprLike extends Expr { + @NotNull + public Expr value; + + @NotNull + public Expr pattern; + + @Nullable + public Expr escape; + + public boolean not; + + public ExprLike(@NotNull Expr value, @NotNull Expr pattern, @Nullable Expr escape, boolean not) { + this.value = value; + this.pattern = pattern; + this.escape = escape; + this.not = not; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + kids.add(pattern); + if (escape != null) { + kids.add(escape); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprLike(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprLit.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprLit.java new file mode 100644 index 000000000..77d70cf04 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprLit.java @@ -0,0 +1,32 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.value.PartiQLValue; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public class ExprLit extends Expr { + @NotNull + public PartiQLValue value; // This representation be changed in https://github.com/partiql/partiql-lang-kotlin/issues/1589 + + public ExprLit(@NotNull PartiQLValue value) { + this.value = value; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprLit(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprMatch.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprMatch.java new file mode 100644 index 000000000..2c3e3f72b --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprMatch.java @@ -0,0 +1,40 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.graph.GraphMatch; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprMatch extends Expr { + @NotNull + public Expr expr; + + @NotNull + public GraphMatch pattern; + + public ExprMatch(@NotNull Expr expr, @NotNull GraphMatch pattern) { + this.expr = expr; + this.pattern = pattern; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expr); + kids.add(pattern); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprMatch(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprNot.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprNot.java new file mode 100644 index 000000000..4837b7e55 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprNot.java @@ -0,0 +1,34 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprNot extends Expr { + @NotNull + public Expr value; + + public ExprNot(@NotNull Expr value) { + this.value = value; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprNot(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprNullIf.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprNullIf.java new file mode 100644 index 000000000..95991700b --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprNullIf.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprNullIf extends Expr { + @NotNull + public Expr v1; + + @NotNull + public Expr v2; + + public ExprNullIf(@NotNull Expr v1, @NotNull Expr v2) { + this.v1 = v1; + this.v2 = v2; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(v1); + kids.add(v2); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprNullIf(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOperator.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOperator.java new file mode 100644 index 000000000..76d440b41 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOperator.java @@ -0,0 +1,46 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprOperator extends Expr { + @NotNull + public String symbol; + + @Nullable + public Expr lhs; + + @NotNull + public Expr rhs; + + public ExprOperator(@NotNull String symbol, @Nullable Expr lhs, @NotNull Expr rhs) { + this.symbol = symbol; + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (lhs != null) { + kids.add(lhs); + } + kids.add(rhs); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprOperator(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOr.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOr.java new file mode 100644 index 000000000..3684e11ec --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOr.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprOr extends Expr { + @NotNull + public Expr lhs; + + @NotNull + public Expr rhs; + + public ExprOr(@NotNull Expr lhs, @NotNull Expr rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(lhs); + kids.add(rhs); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprOr(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOverlay.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOverlay.java new file mode 100644 index 000000000..a13e24aa4 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprOverlay.java @@ -0,0 +1,52 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprOverlay extends Expr { + @NotNull + public Expr value; + + @NotNull + public Expr placing; + + @NotNull + public Expr from; + + @Nullable + public Expr forLength; + + public ExprOverlay(@NotNull Expr value, @NotNull Expr placing, @NotNull Expr from, @Nullable Expr forLength) { + this.value = value; + this.placing = placing; + this.from = from; + this.forLength = forLength; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + kids.add(placing); + kids.add(from); + if (forLength != null) { + kids.add(forLength); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprOverlay(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprParameter.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprParameter.java new file mode 100644 index 000000000..d47aee502 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprParameter.java @@ -0,0 +1,30 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public class ExprParameter extends Expr { + public int index; + + public ExprParameter(int index) { + this.index = index; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprParameter(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprPath.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprPath.java new file mode 100644 index 000000000..ec521c010 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprPath.java @@ -0,0 +1,42 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprPath extends Expr { + @NotNull + public Expr root; + + @Nullable + public PathStep next; + + public ExprPath(@NotNull Expr root, @Nullable PathStep next) { + this.root = root; + this.next = next; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(root); + if (next != null) { + kids.add(next); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprPath(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprPosition.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprPosition.java new file mode 100644 index 000000000..abadcefb0 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprPosition.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprPosition extends Expr { + @NotNull + public Expr lhs; + + @NotNull + public Expr rhs; + + public ExprPosition(@NotNull Expr lhs, @NotNull Expr rhs) { + this.lhs = lhs; + this.rhs = rhs; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(lhs); + kids.add(rhs); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprPosition(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprQuerySet.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprQuerySet.java new file mode 100644 index 000000000..5442eddd2 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprQuerySet.java @@ -0,0 +1,58 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.OrderBy; +import org.partiql.ast.v1.QueryBody; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprQuerySet extends Expr { + @NotNull + public QueryBody body; + + @Nullable + public OrderBy orderBy; + + @Nullable + public Expr limit; + + @Nullable + public Expr offset; + + public ExprQuerySet(@NotNull QueryBody body, @Nullable OrderBy orderBy, @Nullable Expr limit, @Nullable Expr offset) { + this.body = body; + this.orderBy = orderBy; + this.limit = limit; + this.offset = offset; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(body); + if (orderBy != null) { + kids.add(orderBy); + } + if (limit != null) { + kids.add(limit); + } + if (offset != null) { + kids.add(offset); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprQuerySet(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprSessionAttribute.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprSessionAttribute.java new file mode 100644 index 000000000..518793e77 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprSessionAttribute.java @@ -0,0 +1,31 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public class ExprSessionAttribute extends Expr { + @NotNull + public SessionAttribute sessionAttribute; + + public ExprSessionAttribute(@NotNull SessionAttribute sessionAttribute) { + this.sessionAttribute = sessionAttribute; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprSessionAttribute(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprStruct.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprStruct.java new file mode 100644 index 000000000..e54bed48a --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprStruct.java @@ -0,0 +1,62 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprStruct extends Expr { + @NotNull + public List fields; + + public ExprStruct(@NotNull List fields) { + this.fields = fields; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(fields); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprStruct(this, ctx); + } + + /** + * TODO docs, equals, hashcode + */ + public static class Field extends AstNode { + @NotNull + public Expr name; + + @NotNull + public Expr value; + + public Field(@NotNull Expr name, @NotNull Expr value) { + this.name = name; + this.value = value; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(name); + kids.add(value); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprStructField(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprSubstring.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprSubstring.java new file mode 100644 index 000000000..aa1a08ed2 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprSubstring.java @@ -0,0 +1,49 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprSubstring extends Expr { + @NotNull + public Expr value; + + @Nullable + public Expr start; + + @Nullable + public Expr length; + + public ExprSubstring(@NotNull Expr value, @Nullable Expr start, @Nullable Expr length) { + this.value = value; + this.start = start; + this.length = length; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + if (start != null) { + kids.add(start); + } + if (length != null) { + kids.add(length); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprSubstring(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprTrim.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprTrim.java new file mode 100644 index 000000000..6551f6817 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprTrim.java @@ -0,0 +1,46 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprTrim extends Expr { + @NotNull + public Expr value; + + @Nullable + public Expr chars; + + @Nullable + public TrimSpec trimSpec; + + public ExprTrim(@NotNull Expr value, @Nullable Expr chars, @Nullable TrimSpec trimSpec) { + this.value = value; + this.chars = chars; + this.trimSpec = trimSpec; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(value); + if (chars != null) { + kids.add(chars); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprTrim(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprValues.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprValues.java new file mode 100644 index 000000000..e9fe0cae0 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprValues.java @@ -0,0 +1,55 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprValues extends Expr { + @NotNull + public List rows; + + public ExprValues(@NotNull List rows) { + this.rows = rows; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(rows); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprValues(this, ctx); + } + + /** + * TODO docs, equals, hashcode + */ + public static class Row extends AstNode { + @NotNull + public List values; + + public Row(@NotNull List values) { + this.values = values; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(values); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprValuesRow(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprVarRef.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprVarRef.java new file mode 100644 index 000000000..b0db6cd19 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprVarRef.java @@ -0,0 +1,39 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.IdentifierChain; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprVarRef extends Expr { + @NotNull + public IdentifierChain identifierChain; + + @NotNull + public Scope scope; + + public ExprVarRef(@NotNull IdentifierChain identifierChain, @NotNull Scope scope) { + this.identifierChain = identifierChain; + this.scope = scope; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(identifierChain); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprVarRef(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprVariant.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprVariant.java new file mode 100644 index 000000000..da56da692 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprVariant.java @@ -0,0 +1,32 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.Collections; +import java.util.List; + +public class ExprVariant extends Expr { + @NotNull + public String value; + @NotNull + public String encoding; + + public ExprVariant(@NotNull String value, @NotNull String encoding) { + this.value = value; + this.encoding = encoding; + } + + @NotNull + @Override + public List children() { + return Collections.emptyList(); + } + + @NotNull + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprVariant(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprWindow.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprWindow.java new file mode 100644 index 000000000..6832d6c76 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/ExprWindow.java @@ -0,0 +1,93 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.Sort; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class ExprWindow extends Expr { + @NotNull + public WindowFunction windowFunction; + + @NotNull + public Expr expression; + + @Nullable + public Expr offset; + + @Nullable + public Expr defaultValue; + + @NotNull + public Over over; + + public ExprWindow(@NotNull WindowFunction windowFunction, @NotNull Expr expression, @Nullable Expr offset, @Nullable Expr defaultValue, @NotNull Over over) { + this.windowFunction = windowFunction; + this.expression = expression; + this.offset = offset; + this.defaultValue = defaultValue; + this.over = over; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(expression); + if (offset != null) { + kids.add(offset); + } + if (defaultValue != null) { + kids.add(defaultValue); + } + kids.add(over); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprWindow(this, ctx); + } + + /** + * TODO docs, equals, hashcode + */ + public static class Over extends AstNode { + @Nullable + public List partitions; + + @Nullable + public List sorts; + + public Over(@Nullable List partitions, @Nullable List sorts) { + this.partitions = partitions; + this.sorts = sorts; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (partitions != null) { + kids.addAll(partitions); + } + if (sorts != null) { + kids.addAll(sorts); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitExprWindowOver(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/PathStep.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/PathStep.java new file mode 100644 index 000000000..175f6c23c --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/PathStep.java @@ -0,0 +1,124 @@ +package org.partiql.ast.v1.expr; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.Identifier; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public abstract class PathStep extends AstNode { + @Nullable + public PathStep next; + + /** + * TODO docs, equals, hashcode + */ + public static class Field extends PathStep { + @NotNull + public Identifier field; + + public Field(@NotNull Identifier field, @Nullable PathStep next) { + this.field = field; + this.next = next; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (next != null) { + kids.add(next); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitPathStepField(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Element extends PathStep { + @NotNull + public Expr element; + + public Element(@NotNull Expr element, @Nullable PathStep next) { + this.element = element; + this.next = next; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(element); + if (next != null) { + kids.add(next); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitPathStepElement(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class AllElements extends PathStep { + public AllElements(@Nullable PathStep next) { + this.next = next; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (next != null) { + kids.add(next); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitPathStepAllElements(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class AllFields extends PathStep { + public AllFields(@Nullable PathStep next) { + this.next = next; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (next != null) { + kids.add(next); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitPathStepAllFields(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/Scope.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/Scope.java new file mode 100644 index 000000000..4cd1909c0 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/Scope.java @@ -0,0 +1,35 @@ +package org.partiql.ast.v1.expr; + +import org.partiql.ast.v1.Enum; + +/** + * TODO docs, equals, hashcode + */ +public class Scope implements Enum { + public static final int UNKNOWN = 0; + public static final int DEFAULT = 1; + public static final int LOCAL = 2; + + public static Scope UNKNOWN() { + return new Scope(UNKNOWN); + } + + public static Scope DEFAULT() { + return new Scope(DEFAULT); + } + + public static Scope LOCAL() { + return new Scope(LOCAL); + } + + private final int code; + + private Scope(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/SessionAttribute.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/SessionAttribute.java new file mode 100644 index 000000000..6a96e8c64 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/SessionAttribute.java @@ -0,0 +1,35 @@ +package org.partiql.ast.v1.expr; + +import org.partiql.ast.v1.Enum; + +/** + * TODO docs, equals, hashcode + */ +public class SessionAttribute implements Enum { + public static final int UNKNOWN = 0; + public static final int CURRENT_USER = 1; + public static final int CURRENT_DATE = 2; + + public static SessionAttribute UNKNOWN() { + return new SessionAttribute(UNKNOWN); + } + + public static SessionAttribute CURRENT_USER() { + return new SessionAttribute(CURRENT_USER); + } + + public static SessionAttribute CURRENT_DATE() { + return new SessionAttribute(CURRENT_DATE); + } + + private final int code; + + public SessionAttribute(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/TrimSpec.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/TrimSpec.java new file mode 100644 index 000000000..2f023383d --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/TrimSpec.java @@ -0,0 +1,37 @@ +package org.partiql.ast.v1.expr; + +import org.partiql.ast.v1.Enum; + +public class TrimSpec implements Enum { + public static final int UNKNOWN = 0; + public static final int LEADING = 1; + public static final int TRAILING = 2; + public static final int BOTH = 3; + + public static TrimSpec UNKNOWN() { + return new TrimSpec(UNKNOWN); + } + + public static TrimSpec LEADING() { + return new TrimSpec(LEADING); + } + + public static TrimSpec TRAILING() { + return new TrimSpec(TRAILING); + } + + public static TrimSpec BOTH() { + return new TrimSpec(BOTH); + } + + private final int code; + + private TrimSpec(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/expr/WindowFunction.java b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/WindowFunction.java new file mode 100644 index 000000000..98d3a8414 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/expr/WindowFunction.java @@ -0,0 +1,35 @@ +package org.partiql.ast.v1.expr; + +import org.partiql.ast.v1.Enum; + +/** + * TODO docs, equals, hashcode + */ +public class WindowFunction implements Enum { + public static final int UNKNOWN = 0; + public static final int LAG = 0; + public static final int LEAD = 0; + + public static WindowFunction UNKNOWN() { + return new WindowFunction(UNKNOWN); + } + + public static WindowFunction LAG() { + return new WindowFunction(LAG); + } + + public static WindowFunction LEAD() { + return new WindowFunction(LEAD); + } + + private final int code; + + public WindowFunction(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphDirection.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphDirection.java new file mode 100644 index 000000000..2194e4585 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphDirection.java @@ -0,0 +1,60 @@ +package org.partiql.ast.v1.graph; + +import org.partiql.ast.v1.Enum; + +/** + * TODO docs, equals, hashcode + */ +public class GraphDirection implements Enum { + public static final int UNKNOWN = 0; + public static final int LEFT = 1; + public static final int UNDIRECTED = 2; + public static final int RIGHT = 3; + public static final int LEFT_OR_UNDIRECTED = 4; + public static final int UNDIRECTED_OR_RIGHT = 5; + public static final int LEFT_OR_RIGHT = 6; + public static final int LEFT_UNDIRECTED_OR_RIGHT = 7; + + public static GraphDirection UNKNOWN() { + return new GraphDirection(UNKNOWN); + } + + public static GraphDirection LEFT() { + return new GraphDirection(LEFT); + } + + public static GraphDirection UNDIRECTED() { + return new GraphDirection(UNDIRECTED); + } + + public static GraphDirection RIGHT() { + return new GraphDirection(RIGHT); + } + + public static GraphDirection LEFT_OR_UNDIRECTED() { + return new GraphDirection(LEFT_OR_UNDIRECTED); + } + + public static GraphDirection UNDIRECTED_OR_RIGHT() { + return new GraphDirection(UNDIRECTED_OR_RIGHT); + } + + public static GraphDirection LEFT_OR_RIGHT() { + return new GraphDirection(LEFT_OR_RIGHT); + } + + public static GraphDirection LEFT_UNDIRECTED_OR_RIGHT() { + return new GraphDirection(LEFT_UNDIRECTED_OR_RIGHT); + } + + private final int code; + + private GraphDirection(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphLabel.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphLabel.java new file mode 100644 index 000000000..415c4be7f --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphLabel.java @@ -0,0 +1,141 @@ +package org.partiql.ast.v1.graph; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public abstract class GraphLabel extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof Name) { + return visitor.visitGraphLabelName((Name) this, ctx); + } else if (this instanceof Wildcard) { + return visitor.visitGraphLabelWildcard((Wildcard) this, ctx); + } else if (this instanceof Negation) { + return visitor.visitGraphLabelNegation((Negation) this, ctx); + } else if (this instanceof Conj) { + return visitor.visitGraphLabelConj((Conj) this, ctx); + } else if (this instanceof Disj) { + return visitor.visitGraphLabelDisj((Disj) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Name extends GraphLabel { + @NotNull + public String name; + + public Name(@NotNull String name) { + this.name = name; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphLabelName(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Wildcard extends GraphLabel { + @Override + @NotNull + public Collection children() { + return new ArrayList<>(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphLabelWildcard(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Negation extends GraphLabel { + @NotNull + public GraphLabel arg; + + public Negation(@NotNull GraphLabel arg) { + this.arg = arg; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(arg); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphLabelNegation(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Conj extends GraphLabel { + @NotNull + public List args; + + public Conj(@NotNull List args) { + this.args = args; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(args); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphLabelConj(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Disj extends GraphLabel { + @NotNull + public List args; + + public Disj(@NotNull List args) { + this.args = args; + } + + @Override + @NotNull + public Collection children() { + return new ArrayList<>(args); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphLabelDisj(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphMatch.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphMatch.java new file mode 100644 index 000000000..437b828db --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphMatch.java @@ -0,0 +1,41 @@ +package org.partiql.ast.v1.graph; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class GraphMatch extends AstNode { + @NotNull + public List patterns; + + @Nullable + public GraphSelector selector; + + public GraphMatch(@NotNull List patterns, @Nullable GraphSelector selector) { + this.patterns = patterns; + this.selector = selector; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(patterns); + if (selector != null) { + kids.add(selector); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphMatch(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphPart.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphPart.java new file mode 100644 index 000000000..19d6fa404 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphPart.java @@ -0,0 +1,142 @@ +package org.partiql.ast.v1.graph; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public abstract class GraphPart extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof Node) { + return visitor.visitGraphPartNode((Node) this, ctx); + } else if (this instanceof Edge) { + return visitor.visitGraphPartEdge((Edge) this, ctx); + } else if (this instanceof Pattern) { + return visitor.visitGraphPartPattern((Pattern) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Node extends GraphPart { + @Nullable + public Expr prefilter; + + @Nullable + public String variable; + + @Nullable + public GraphLabel label; + + public Node(@Nullable Expr prefilter, @Nullable String variable, @Nullable GraphLabel label) { + this.prefilter = prefilter; + this.variable = variable; + this.label = label; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (prefilter != null) { + kids.add(prefilter); + } + if (label != null) { + kids.add(label); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphPartNode(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Edge extends GraphPart { + @NotNull + public GraphDirection direction; + + @Nullable + public GraphQuantifier quantifier; + + @Nullable + public Expr prefilter; + + @Nullable + public String variable; + + @Nullable + public GraphLabel label; + + public Edge(@NotNull GraphDirection direction, @Nullable GraphQuantifier quantifier, + @Nullable Expr prefilter, @Nullable String variable, @Nullable GraphLabel label) { + this.direction = direction; + this.quantifier = quantifier; + this.prefilter = prefilter; + this.variable = variable; + this.label = label; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (quantifier != null) { + kids.add(quantifier); + } + if (prefilter != null) { + kids.add(prefilter); + } + if (label != null) { + kids.add(label); + } + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphPartEdge(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Pattern extends GraphPart { + @NotNull + public GraphPattern pattern; + + public Pattern(@NotNull GraphPattern pattern) { + this.pattern = pattern; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + kids.add(pattern); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphPartPattern(this, ctx); + } + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphPattern.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphPattern.java new file mode 100644 index 000000000..047efc896 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphPattern.java @@ -0,0 +1,60 @@ +package org.partiql.ast.v1.graph; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; +import org.partiql.ast.v1.expr.Expr; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * TODO docs, equals, hashcode + */ +public class GraphPattern extends AstNode { + @Nullable + public GraphRestrictor restrictor; + + @Nullable + public Expr prefilter; + + @Nullable + public String variable; + + @Nullable + public GraphQuantifier quantifier; + + @NotNull + public List parts; + + public GraphPattern(@Nullable GraphRestrictor restrictor, @Nullable Expr prefilter, + @Nullable String variable, @Nullable GraphQuantifier quantifier, + @NotNull List parts) { + this.restrictor = restrictor; + this.prefilter = prefilter; + this.variable = variable; + this.quantifier = quantifier; + this.parts = parts; + } + + @Override + @NotNull + public Collection children() { + List kids = new ArrayList<>(); + if (prefilter != null) { + kids.add(prefilter); + } + if (quantifier != null) { + kids.add(quantifier); + } + kids.addAll(parts); + return kids; + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphMatchPattern(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphQuantifier.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphQuantifier.java new file mode 100644 index 000000000..6c02363f1 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphQuantifier.java @@ -0,0 +1,36 @@ +package org.partiql.ast.v1.graph; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public class GraphQuantifier extends AstNode { + @NotNull + public Long lower; + + @Nullable + public Long upper; + + public GraphQuantifier(@NotNull Long lower, @Nullable Long upper) { + this.lower = lower; + this.upper = upper; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphQuantifier(this, ctx); + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphRestrictor.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphRestrictor.java new file mode 100644 index 000000000..71017576b --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphRestrictor.java @@ -0,0 +1,40 @@ +package org.partiql.ast.v1.graph; + +import org.partiql.ast.v1.Enum; + +/** + * TODO docs, equals, hashcode + */ +public class GraphRestrictor implements Enum { + public static final int UNKNOWN = 0; + public static final int TRAIL = 1; + public static final int ACYCLIC = 2; + public static final int SIMPLE = 3; + + public static GraphRestrictor UNKNOWN() { + return new GraphRestrictor(UNKNOWN); + } + + public static GraphRestrictor TRAIL() { + return new GraphRestrictor(TRAIL); + } + + public static GraphRestrictor ACYCLIC() { + return new GraphRestrictor(ACYCLIC); + } + + public static GraphRestrictor SIMPLE() { + return new GraphRestrictor(SIMPLE); + } + + private final int code; + + private GraphRestrictor(int code) { + this.code = code; + } + + @Override + public int code() { + return code; + } +} diff --git a/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphSelector.java b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphSelector.java new file mode 100644 index 000000000..149186477 --- /dev/null +++ b/partiql-ast/src/main/java/org/partiql/ast/v1/graph/GraphSelector.java @@ -0,0 +1,146 @@ +package org.partiql.ast.v1.graph; + +import org.jetbrains.annotations.NotNull; +import org.partiql.ast.v1.AstNode; +import org.partiql.ast.v1.AstVisitor; + +import java.util.Collection; +import java.util.Collections; + +/** + * TODO docs, equals, hashcode + */ +public abstract class GraphSelector extends AstNode { + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + if (this instanceof AnyShortest) { + return visitor.visitGraphSelectorAnyShortest((AnyShortest) this, ctx); + } else if (this instanceof AllShortest) { + return visitor.visitGraphSelectorAllShortest((AllShortest) this, ctx); + } else if (this instanceof Any) { + return visitor.visitGraphSelectorAny((Any) this, ctx); + } else if (this instanceof AnyK) { + return visitor.visitGraphSelectorAnyK((AnyK) this, ctx); + } else if (this instanceof ShortestK) { + return visitor.visitGraphSelectorShortestK((ShortestK) this, ctx); + } else if (this instanceof ShortestKGroup) { + return visitor.visitGraphSelectorShortestKGroup((ShortestKGroup) this, ctx); + } else { + throw new IllegalStateException("Unexpected value: " + this); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class AnyShortest extends GraphSelector { + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphSelectorAnyShortest(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class AllShortest extends GraphSelector { + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphSelectorAllShortest(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class Any extends GraphSelector { + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphSelectorAny(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class AnyK extends GraphSelector { + public long k; + + public AnyK(long k) { + this.k = k; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphSelectorAnyK(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class ShortestK extends GraphSelector { + public long k; + + public ShortestK(long k) { + this.k = k; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphSelectorShortestK(this, ctx); + } + } + + /** + * TODO docs, equals, hashcode + */ + public static class ShortestKGroup extends GraphSelector { + public long k; + + public ShortestKGroup(long k) { + this.k = k; + } + + @Override + @NotNull + public Collection children() { + return Collections.emptyList(); + } + + @Override + public R accept(@NotNull AstVisitor visitor, C ctx) { + return visitor.visitGraphSelectorShortestKGroup(this, ctx); + } + } +}