Skip to content

Commit

Permalink
[v1] Remove top-level DDL node (#1693)
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 authored Dec 27, 2024
1 parent 73e25c5 commit 7ca16a7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 31 deletions.
15 changes: 5 additions & 10 deletions partiql-ast/api/partiql-ast.api
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ public abstract class org/partiql/ast/AstRewriter : org/partiql/ast/AstVisitor {
public fun visitConflictTargetConstraint (Lorg/partiql/ast/dml/ConflictTarget$Constraint;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitConflictTargetIndex (Lorg/partiql/ast/dml/ConflictTarget$Index;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitConflictTargetIndex (Lorg/partiql/ast/dml/ConflictTarget$Index;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitDdl (Lorg/partiql/ast/ddl/Ddl;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDdl (Lorg/partiql/ast/ddl/Ddl;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitCreateTable (Lorg/partiql/ast/ddl/CreateTable;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitCreateTable (Lorg/partiql/ast/ddl/CreateTable;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitDelete (Lorg/partiql/ast/dml/Delete;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDelete (Lorg/partiql/ast/dml/Delete;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitDoReplaceActionExcluded (Lorg/partiql/ast/dml/DoReplaceAction$Excluded;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -461,7 +461,6 @@ public abstract class org/partiql/ast/AstVisitor {
public fun visitConflictTargetIndex (Lorg/partiql/ast/dml/ConflictTarget$Index;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitCreateTable (Lorg/partiql/ast/ddl/CreateTable;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDataType (Lorg/partiql/ast/DataType;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDdl (Lorg/partiql/ast/ddl/Ddl;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDelete (Lorg/partiql/ast/dml/Delete;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDoReplaceAction (Lorg/partiql/ast/dml/DoReplaceAction;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDoReplaceActionExcluded (Lorg/partiql/ast/dml/DoReplaceAction$Excluded;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -1514,7 +1513,7 @@ public class org/partiql/ast/ddl/ColumnDefinition$Builder {
public fun toString ()Ljava/lang/String;
}

public final class org/partiql/ast/ddl/CreateTable : org/partiql/ast/ddl/Ddl {
public final class org/partiql/ast/ddl/CreateTable : org/partiql/ast/Statement {
public fun <init> (Lorg/partiql/ast/IdentifierChain;Ljava/util/List;Ljava/util/List;Lorg/partiql/ast/ddl/PartitionBy;Ljava/util/List;)V
public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static fun builder ()Lorg/partiql/ast/ddl/CreateTable$Builder;
Expand All @@ -1538,10 +1537,6 @@ public class org/partiql/ast/ddl/CreateTable$Builder {
public fun toString ()Ljava/lang/String;
}

public abstract class org/partiql/ast/ddl/Ddl : org/partiql/ast/Statement {
public fun <init> ()V
}

public final class org/partiql/ast/ddl/KeyValue : org/partiql/ast/AstNode {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -3176,10 +3171,10 @@ public abstract class org/partiql/ast/sql/SqlDialect : org/partiql/ast/AstVisito
public fun defaultReturn (Lorg/partiql/ast/AstNode;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public static final fun getSTANDARD ()Lorg/partiql/ast/sql/SqlDialect;
public final fun transform (Lorg/partiql/ast/AstNode;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitCreateTable (Lorg/partiql/ast/ddl/CreateTable;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitCreateTable (Lorg/partiql/ast/ddl/CreateTable;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitDataType (Lorg/partiql/ast/DataType;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDataType (Lorg/partiql/ast/DataType;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitDdl (Lorg/partiql/ast/ddl/Ddl;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDdl (Lorg/partiql/ast/ddl/Ddl;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitDelete (Lorg/partiql/ast/dml/Delete;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitDelete (Lorg/partiql/ast/dml/Delete;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitExclude (Lorg/partiql/ast/Exclude;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down
5 changes: 0 additions & 5 deletions partiql-ast/src/main/java/org/partiql/ast/AstVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.partiql.ast.ddl.AttributeConstraint;
import org.partiql.ast.ddl.ColumnDefinition;
import org.partiql.ast.ddl.CreateTable;
import org.partiql.ast.ddl.Ddl;
import org.partiql.ast.ddl.KeyValue;
import org.partiql.ast.ddl.PartitionBy;
import org.partiql.ast.ddl.TableConstraint;
Expand Down Expand Up @@ -88,10 +87,6 @@ public R visitStatement(Statement node, C ctx) {
//
// DDL
//
public R visitDdl(Ddl node, C ctx) {
return defaultVisit(node, ctx);
}

public R visitCreateTable(CreateTable node, C ctx) {
return defaultVisit(node, ctx);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.partiql.ast.AstNode;
import org.partiql.ast.AstVisitor;
import org.partiql.ast.IdentifierChain;
import org.partiql.ast.Statement;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -17,7 +18,7 @@
*/
@Builder(builderClassName = "Builder")
@EqualsAndHashCode(callSuper = false)
public final class CreateTable extends Ddl {
public final class CreateTable extends Statement {

@NotNull
@Getter
Expand Down
9 changes: 0 additions & 9 deletions partiql-ast/src/main/java/org/partiql/ast/ddl/Ddl.java

This file was deleted.

6 changes: 3 additions & 3 deletions partiql-ast/src/main/java/org/partiql/ast/sql/SqlDialect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import org.partiql.ast.SetOp
import org.partiql.ast.SetOpType
import org.partiql.ast.SetQuantifier
import org.partiql.ast.Sort
import org.partiql.ast.ddl.Ddl
import org.partiql.ast.ddl.CreateTable
import org.partiql.ast.dml.Delete
import org.partiql.ast.dml.Insert
import org.partiql.ast.dml.Replace
Expand Down Expand Up @@ -822,8 +822,8 @@ public abstract class SqlDialect : AstVisitor<SqlBlock, SqlBlock>() {
}

// TODO: DDL
override fun visitDdl(node: Ddl, ctx: SqlBlock): SqlBlock {
throw UnsupportedOperationException("DDL has not been supported yet in SqlDialect")
override fun visitCreateTable(node: CreateTable, ctx: SqlBlock): SqlBlock {
throw UnsupportedOperationException("CREATE TABLE has not been supported yet in SqlDialect")
}

override fun visitInsert(node: Insert?, ctx: SqlBlock?): SqlBlock {
Expand Down
6 changes: 3 additions & 3 deletions partiql-ast/src/main/kotlin/org/partiql/ast/AstRewriter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.partiql.ast.Ast.explain
import org.partiql.ast.Ast.exprQuerySet
import org.partiql.ast.Ast.identifier
import org.partiql.ast.Ast.query
import org.partiql.ast.ddl.Ddl
import org.partiql.ast.ddl.CreateTable
import org.partiql.ast.dml.ConflictAction
import org.partiql.ast.dml.ConflictTarget
import org.partiql.ast.dml.Delete
Expand Down Expand Up @@ -802,8 +802,8 @@ public abstract class AstRewriter<C> : AstVisitor<AstNode, C>() {
}

// TODO: DDL
override fun visitDdl(node: Ddl, ctx: C): AstNode {
throw UnsupportedOperationException("DDL has not been supported yet in AstRewriter")
override fun visitCreateTable(node: CreateTable?, ctx: C): AstNode {
throw UnsupportedOperationException("CREATE TABLE has not been supported yet in AstRewriter")
}

override fun visitInsert(node: Insert, ctx: C): AstNode {
Expand Down

0 comments on commit 7ca16a7

Please sign in to comment.