Skip to content

Commit

Permalink
Working build; need to check conformance diff
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Oct 29, 2024
1 parent dfc1db7 commit 189db52
Show file tree
Hide file tree
Showing 16 changed files with 232 additions and 253 deletions.
20 changes: 12 additions & 8 deletions partiql-ast/api/partiql-ast.api
Original file line number Diff line number Diff line change
Expand Up @@ -5957,7 +5957,10 @@ public class org/partiql/ast/v1/ExcludeStep$CollIndex : org/partiql/ast/v1/Exclu
public fun <init> (I)V
public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/v1/ExcludeStep$CollIndex$Builder;
protected fun canEqual (Ljava/lang/Object;)Z
public fun children ()Ljava/util/Collection;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
}

public class org/partiql/ast/v1/ExcludeStep$CollIndex$Builder {
Expand All @@ -5969,7 +5972,10 @@ public class org/partiql/ast/v1/ExcludeStep$CollIndex$Builder {
public class org/partiql/ast/v1/ExcludeStep$CollWildcard : org/partiql/ast/v1/ExcludeStep {
public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/v1/ExcludeStep$CollWildcard$Builder;
protected fun canEqual (Ljava/lang/Object;)Z
public fun children ()Ljava/util/Collection;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
}

public class org/partiql/ast/v1/ExcludeStep$CollWildcard$Builder {
Expand All @@ -5982,7 +5988,10 @@ public class org/partiql/ast/v1/ExcludeStep$StructField : org/partiql/ast/v1/Exc
public fun <init> (Lorg/partiql/ast/v1/Identifier;)V
public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/v1/ExcludeStep$StructField$Builder;
protected fun canEqual (Ljava/lang/Object;)Z
public fun children ()Ljava/util/Collection;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
}

public class org/partiql/ast/v1/ExcludeStep$StructField$Builder {
Expand All @@ -5994,7 +6003,10 @@ public class org/partiql/ast/v1/ExcludeStep$StructField$Builder {
public class org/partiql/ast/v1/ExcludeStep$StructWildcard : org/partiql/ast/v1/ExcludeStep {
public fun accept (Lorg/partiql/ast/v1/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/v1/ExcludeStep$StructWildcard$Builder;
protected fun canEqual (Ljava/lang/Object;)Z
public fun children ()Ljava/util/Collection;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
}

public class org/partiql/ast/v1/ExcludeStep$StructWildcard$Builder {
Expand Down Expand Up @@ -6086,7 +6098,6 @@ public class org/partiql/ast/v1/FromJoin$Builder {

public abstract class org/partiql/ast/v1/FromTableRef : org/partiql/ast/v1/AstNode {
public fun <init> ()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/AstEnum {
Expand Down Expand Up @@ -6393,12 +6404,10 @@ public class org/partiql/ast/v1/QueryBody$SetOp$Builder {

public abstract class org/partiql/ast/v1/Select : org/partiql/ast/v1/AstNode {
public fun <init> ()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 <init> ()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 {
Expand Down Expand Up @@ -6591,12 +6600,10 @@ public class org/partiql/ast/v1/Sort$Builder {

public abstract class org/partiql/ast/v1/Statement : org/partiql/ast/v1/AstNode {
public fun <init> ()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 <init> ()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 {
Expand Down Expand Up @@ -7430,7 +7437,6 @@ public class org/partiql/ast/v1/graph/GraphDirection : org/partiql/ast/v1/AstEnu

public abstract class org/partiql/ast/v1/graph/GraphLabel : org/partiql/ast/v1/AstNode {
public fun <init> ()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 {
Expand Down Expand Up @@ -7541,7 +7547,6 @@ public class org/partiql/ast/v1/graph/GraphMatch$Builder {

public abstract class org/partiql/ast/v1/graph/GraphPart : org/partiql/ast/v1/AstNode {
public fun <init> ()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 {
Expand Down Expand Up @@ -7673,7 +7678,6 @@ public class org/partiql/ast/v1/graph/GraphRestrictor : org/partiql/ast/v1/AstEn

public abstract class org/partiql/ast/v1/graph/GraphSelector : org/partiql/ast/v1/AstNode {
public fun <init> ()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 {
Expand Down
176 changes: 164 additions & 12 deletions partiql-ast/src/main/java/org/partiql/ast/v1/AstVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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;
Expand All @@ -33,6 +32,7 @@
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.expr.PathStep;
import org.partiql.ast.v1.graph.GraphLabel;
import org.partiql.ast.v1.graph.GraphMatch;
import org.partiql.ast.v1.graph.GraphPart;
Expand All @@ -55,7 +55,13 @@ default R visit(AstNode node, C ctx) {
}

default R visitStatement(Statement node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof Query) {
return visitQuery((Query) node, ctx);
} else if (node instanceof Explain) {
return visitExplain((Explain) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitQuery(Query node, C ctx) {
Expand All @@ -75,7 +81,71 @@ default R visitIdentifierChain(IdentifierChain node, C ctx) {
}

default R visitExpr(Expr node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof ExprLit) {
return visitExprLit((ExprLit) node, ctx);
} else if (node instanceof ExprVariant) {
return visitExprVariant((ExprVariant) node, ctx);
} else if (node instanceof ExprVarRef) {
return visitExprVarRef((ExprVarRef) node, ctx);
} else if (node instanceof ExprSessionAttribute) {
return visitExprSessionAttribute((ExprSessionAttribute) node, ctx);
} else if (node instanceof ExprPath) {
return visitExprPath((ExprPath) node, ctx);
} else if (node instanceof ExprCall) {
return visitExprCall((ExprCall) node, ctx);
} else if (node instanceof ExprParameter) {
return visitExprParameter((ExprParameter) node, ctx);
} else if (node instanceof ExprOperator) {
return visitExprOperator((ExprOperator) node, ctx);
} else if (node instanceof ExprNot) {
return visitExprNot((ExprNot) node, ctx);
} else if (node instanceof ExprAnd) {
return visitExprAnd((ExprAnd) node, ctx);
} else if (node instanceof ExprOr) {
return visitExprOr((ExprOr) node, ctx);
} else if (node instanceof ExprValues) {
return visitExprValues((ExprValues) node, ctx);
} else if (node instanceof ExprArray) {
return visitExprArray((ExprArray) node, ctx);
} else if (node instanceof ExprBag) {
return visitExprBag((ExprBag) node, ctx);
} else if (node instanceof ExprStruct) {
return visitExprStruct((ExprStruct) node, ctx);
} else if (node instanceof ExprLike) {
return visitExprLike((ExprLike) node, ctx);
} else if (node instanceof ExprBetween) {
return visitExprBetween((ExprBetween) node, ctx);
} else if (node instanceof ExprInCollection) {
return visitExprInCollection((ExprInCollection) node, ctx);
} else if (node instanceof ExprIsType) {
return visitExprIsType((ExprIsType) node, ctx);
} else if (node instanceof ExprCase) {
return visitExprCase((ExprCase) node, ctx);
} else if (node instanceof ExprCoalesce) {
return visitExprCoalesce((ExprCoalesce) node, ctx);
} else if (node instanceof ExprNullIf) {
return visitExprNullIf((ExprNullIf) node, ctx);
} else if (node instanceof ExprSubstring) {
return visitExprSubstring((ExprSubstring) node, ctx);
} else if (node instanceof ExprPosition) {
return visitExprPosition((ExprPosition) node, ctx);
} else if (node instanceof ExprTrim) {
return visitExprTrim((ExprTrim) node, ctx);
} else if (node instanceof ExprOverlay) {
return visitExprOverlay((ExprOverlay) node, ctx);
} else if (node instanceof ExprExtract) {
return visitExprExtract((ExprExtract) node, ctx);
} else if (node instanceof ExprCast) {
return visitExprCast((ExprCast) node, ctx);
} else if (node instanceof ExprQuerySet) {
return visitExprQuerySet((ExprQuerySet) node, ctx);
} else if (node instanceof ExprMatch) {
return visitExprMatch((ExprMatch) node, ctx);
} else if (node instanceof ExprWindow) {
return visitExprWindow((ExprWindow) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitExprLit(ExprLit node, C ctx) {
Expand All @@ -99,7 +169,17 @@ default R visitExprPath(ExprPath node, C ctx) {
}

default R visitPathStep(PathStep node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof PathStep.Field) {
return visitPathStepField((PathStep.Field) node, ctx);
} else if (node instanceof PathStep.Element) {
return visitPathStepElement((PathStep.Element) node, ctx);
} else if (node instanceof PathStep.AllElements) {
return visitPathStepAllElements((PathStep.AllElements) node, ctx);
} else if (node instanceof PathStep.AllFields) {
return visitPathStepAllFields((PathStep.AllFields) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitPathStepField(PathStep.Field node, C ctx) {
Expand Down Expand Up @@ -239,7 +319,13 @@ default R visitExprWindowOver(ExprWindow.Over node, C ctx) {
}

default R visitQueryBody(QueryBody node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof QueryBody.SFW) {
return visitQueryBodySFW((QueryBody.SFW) node, ctx);
} else if (node instanceof QueryBody.SetOp) {
return visitQueryBodySetOp((QueryBody.SetOp) node, ctx);
} else {
throw new IllegalStateException("Unknown QueryBody type: " + node.getClass().getName());
}
}

default R visitQueryBodySFW(QueryBody.SFW node, C ctx) {
Expand All @@ -251,7 +337,17 @@ default R visitQueryBodySetOp(QueryBody.SetOp node, C ctx) {
}

default R visitSelect(Select node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof SelectStar) {
return visitSelectStar((SelectStar) node, ctx);
} else if (node instanceof SelectList) {
return visitSelectList((SelectList) node, ctx);
} else if (node instanceof SelectPivot) {
return visitSelectPivot((SelectPivot) node, ctx);
} else if (node instanceof SelectValue) {
return visitSelectValue((SelectValue) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitSelectStar(SelectStar node, C ctx) {
Expand All @@ -263,7 +359,13 @@ default R visitSelectList(SelectList node, C ctx) {
}

default R visitSelectItem(SelectItem node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof SelectItem.Star) {
return visitSelectItemStar((SelectItem.Star) node, ctx);
} else if (node instanceof SelectItem.Expr) {
return visitSelectItemExpr((SelectItem.Expr) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitSelectItemStar(SelectItem.Star node, C ctx) {
Expand Down Expand Up @@ -291,7 +393,17 @@ default R visitExcludePath(ExcludePath node, C ctx) {
}

default R visitExcludeStep(ExcludeStep node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof ExcludeStep.StructField) {
return visitExcludeStepStructField((ExcludeStep.StructField) node, ctx);
} else if (node instanceof ExcludeStep.CollIndex) {
return visitExcludeStepCollIndex((ExcludeStep.CollIndex) node, ctx);
} else if (node instanceof ExcludeStep.StructWildcard) {
return visitExcludeStepStructWildcard((ExcludeStep.StructWildcard) node, ctx);
} else if (node instanceof ExcludeStep.CollWildcard) {
return visitExcludeStepCollWildcard((ExcludeStep.CollWildcard) node, ctx);
} else {
throw new IllegalStateException("Unknown ExcludeStep type: " + node.getClass().getName());
}
}

default R visitExcludeStepStructField(ExcludeStep.StructField node, C ctx) {
Expand All @@ -315,7 +427,13 @@ default R visitFrom(From node, C ctx) {
}

default R visitTableRef(FromTableRef node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof FromExpr) {
return visitFromExpr((FromExpr) node, ctx);
} else if (node instanceof FromJoin) {
return visitFromJoin((FromJoin) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitFromExpr(FromExpr node, C ctx) {
Expand Down Expand Up @@ -363,7 +481,15 @@ default R visitGraphMatchPattern(GraphPattern node, C ctx) {
}

default R visitGraphPart(GraphPart node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof GraphPart.Node) {
return visitGraphPartNode((GraphPart.Node) node, ctx);
} else if (node instanceof GraphPart.Edge) {
return visitGraphPartEdge((GraphPart.Edge) node, ctx);
} else if (node instanceof GraphPart.Pattern) {
return visitGraphPartPattern((GraphPart.Pattern) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitGraphPartNode(GraphPart.Node node, C ctx) {
Expand All @@ -383,7 +509,21 @@ default R visitGraphQuantifier(GraphQuantifier node, C ctx) {
}

default R visitGraphSelector(GraphSelector node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof GraphSelector.AnyShortest) {
return visitGraphSelectorAnyShortest((GraphSelector.AnyShortest) node, ctx);
} else if (node instanceof GraphSelector.AllShortest) {
return visitGraphSelectorAllShortest((GraphSelector.AllShortest) node, ctx);
} else if (node instanceof GraphSelector.Any) {
return visitGraphSelectorAny((GraphSelector.Any) node, ctx);
} else if (node instanceof GraphSelector.AnyK) {
return visitGraphSelectorAnyK((GraphSelector.AnyK) node, ctx);
} else if (node instanceof GraphSelector.ShortestK) {
return visitGraphSelectorShortestK((GraphSelector.ShortestK) node, ctx);
} else if (node instanceof GraphSelector.ShortestKGroup) {
return visitGraphSelectorShortestKGroup((GraphSelector.ShortestKGroup) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitGraphSelectorAnyShortest(GraphSelector.AnyShortest node, C ctx) {
Expand Down Expand Up @@ -411,7 +551,19 @@ default R visitGraphSelectorShortestKGroup(GraphSelector.ShortestKGroup node, C
}

default R visitGraphLabel(GraphLabel node, C ctx) {
return defaultVisit(node, ctx);
if (node instanceof GraphLabel.Name) {
return visitGraphLabelName((GraphLabel.Name) node, ctx);
} else if (node instanceof GraphLabel.Wildcard) {
return visitGraphLabelWildcard((GraphLabel.Wildcard) node, ctx);
} else if (node instanceof GraphLabel.Negation) {
return visitGraphLabelNegation((GraphLabel.Negation) node, ctx);
} else if (node instanceof GraphLabel.Conj) {
return visitGraphLabelConj((GraphLabel.Conj) node, ctx);
} else if (node instanceof GraphLabel.Disj) {
return visitGraphLabelDisj((GraphLabel.Disj) node, ctx);
} else {
throw new IllegalStateException("Unexpected value: " + node);
}
}

default R visitGraphLabelName(GraphLabel.Name node, C ctx) {
Expand Down
Loading

0 comments on commit 189db52

Please sign in to comment.