diff --git a/partiql-ast/api/partiql-ast.api b/partiql-ast/api/partiql-ast.api index 8f4b9a31c5..0c2783a126 100644 --- a/partiql-ast/api/partiql-ast.api +++ b/partiql-ast/api/partiql-ast.api @@ -5,7 +5,7 @@ public final class org/partiql/ast/Ast { public static final fun constraintDefinitionNullable ()Lorg/partiql/ast/Constraint$Definition$Nullable; public static final fun constraintDefinitionUnique (Ljava/util/List;Z)Lorg/partiql/ast/Constraint$Definition$Unique; public static final fun ddlOpCreateIndex (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/Identifier;Ljava/util/List;)Lorg/partiql/ast/DdlOp$CreateIndex; - public static final fun ddlOpCreateTable (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;)Lorg/partiql/ast/DdlOp$CreateTable; + public static final fun ddlOpCreateTable (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;)Lorg/partiql/ast/DdlOp$CreateTable; public static final fun ddlOpDropIndex (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/DdlOp$DropIndex; public static final fun ddlOpDropTable (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/DdlOp$DropTable; public static final fun exclude (Ljava/util/List;)Lorg/partiql/ast/Exclude; @@ -89,6 +89,7 @@ public final class org/partiql/ast/Ast { public static final fun onConflictTargetConstraint (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/OnConflict$Target$Constraint; public static final fun onConflictTargetSymbols (Ljava/util/List;)Lorg/partiql/ast/OnConflict$Target$Symbols; public static final fun orderBy (Ljava/util/List;)Lorg/partiql/ast/OrderBy; + public static final fun partitionByAttrList (Ljava/util/List;)Lorg/partiql/ast/PartitionBy$AttrList; public static final fun path (Lorg/partiql/ast/Identifier$Symbol;Ljava/util/List;)Lorg/partiql/ast/Path; public static final fun pathStepIndex (I)Lorg/partiql/ast/Path$Step$Index; public static final fun pathStepSymbol (Lorg/partiql/ast/Identifier$Symbol;)Lorg/partiql/ast/Path$Step$Symbol; @@ -125,7 +126,8 @@ public final class org/partiql/ast/Ast { public static final fun statementExplainTargetDomain (Lorg/partiql/ast/Statement;Ljava/lang/String;Ljava/lang/String;)Lorg/partiql/ast/Statement$Explain$Target$Domain; public static final fun statementQuery (Lorg/partiql/ast/Expr;)Lorg/partiql/ast/Statement$Query; public static final fun tableDefinition (Ljava/util/List;Ljava/util/List;)Lorg/partiql/ast/TableDefinition; - public static final fun tableDefinitionAttribute (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)Lorg/partiql/ast/TableDefinition$Attribute; + public static final fun tableDefinitionAttribute (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;)Lorg/partiql/ast/TableDefinition$Attribute; + public static final fun tableProperty (Ljava/lang/String;Lorg/partiql/value/PartiQLValue;)Lorg/partiql/ast/TableProperty; public static final fun typeAny ()Lorg/partiql/ast/Type$Any; public static final fun typeArray (Lorg/partiql/ast/Type;)Lorg/partiql/ast/Type$Array; public static final fun typeBag ()Lorg/partiql/ast/Type$Bag; @@ -156,7 +158,7 @@ public final class org/partiql/ast/Ast { public static final fun typeSmallint ()Lorg/partiql/ast/Type$Smallint; public static final fun typeString (Ljava/lang/Integer;)Lorg/partiql/ast/Type$String; public static final fun typeStruct (Ljava/util/List;)Lorg/partiql/ast/Type$Struct; - public static final fun typeStructField (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)Lorg/partiql/ast/Type$Struct$Field; + public static final fun typeStructField (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;)Lorg/partiql/ast/Type$Struct$Field; public static final fun typeSymbol ()Lorg/partiql/ast/Type$Symbol; public static final fun typeTime (Ljava/lang/Integer;)Lorg/partiql/ast/Type$Time; public static final fun typeTimeWithTz (Ljava/lang/Integer;)Lorg/partiql/ast/Type$TimeWithTz; @@ -325,13 +327,17 @@ public final class org/partiql/ast/DdlOp$CreateTable : org/partiql/ast/DdlOp { public static final field Companion Lorg/partiql/ast/DdlOp$CreateTable$Companion; public final field definition Lorg/partiql/ast/TableDefinition; public final field name Lorg/partiql/ast/Identifier; - public fun (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;)V + public final field partitionBy Lorg/partiql/ast/PartitionBy; + public final field tableProperties Ljava/util/List; + public fun (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;)V public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; public static final fun builder ()Lorg/partiql/ast/builder/DdlOpCreateTableBuilder; public final fun component1 ()Lorg/partiql/ast/Identifier; public final fun component2 ()Lorg/partiql/ast/TableDefinition; - public final fun copy (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;)Lorg/partiql/ast/DdlOp$CreateTable; - public static synthetic fun copy$default (Lorg/partiql/ast/DdlOp$CreateTable;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;ILjava/lang/Object;)Lorg/partiql/ast/DdlOp$CreateTable; + public final fun component3 ()Lorg/partiql/ast/PartitionBy; + public final fun component4 ()Ljava/util/List; + public final fun copy (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;)Lorg/partiql/ast/DdlOp$CreateTable; + public static synthetic fun copy$default (Lorg/partiql/ast/DdlOp$CreateTable;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/ast/DdlOp$CreateTable; public fun equals (Ljava/lang/Object;)Z public fun getChildren ()Ljava/util/List; public fun hashCode ()I @@ -2279,6 +2285,29 @@ public final class org/partiql/ast/OrderBy$Companion { public final fun builder ()Lorg/partiql/ast/builder/OrderByBuilder; } +public abstract class org/partiql/ast/PartitionBy : org/partiql/ast/AstNode { + public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; +} + +public final class org/partiql/ast/PartitionBy$AttrList : org/partiql/ast/PartitionBy { + public static final field Companion Lorg/partiql/ast/PartitionBy$AttrList$Companion; + public final field list Ljava/util/List; + public fun (Ljava/util/List;)V + public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static final fun builder ()Lorg/partiql/ast/builder/PartitionByAttrListBuilder; + public final fun component1 ()Ljava/util/List; + public final fun copy (Ljava/util/List;)Lorg/partiql/ast/PartitionBy$AttrList; + public static synthetic fun copy$default (Lorg/partiql/ast/PartitionBy$AttrList;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/ast/PartitionBy$AttrList; + public fun equals (Ljava/lang/Object;)Z + public fun getChildren ()Ljava/util/List; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/PartitionBy$AttrList$Companion { + public final fun builder ()Lorg/partiql/ast/builder/PartitionByAttrListBuilder; +} + public final class org/partiql/ast/Path : org/partiql/ast/AstNode { public static final field Companion Lorg/partiql/ast/Path$Companion; public final field root Lorg/partiql/ast/Identifier$Symbol; @@ -3120,17 +3149,21 @@ public final class org/partiql/ast/TableDefinition : org/partiql/ast/AstNode { public final class org/partiql/ast/TableDefinition$Attribute : org/partiql/ast/AstNode { public static final field Companion Lorg/partiql/ast/TableDefinition$Attribute$Companion; + public final field comment Ljava/lang/String; public final field constraints Ljava/util/List; + public final field isOptional Z public final field name Lorg/partiql/ast/Identifier$Symbol; public final field type Lorg/partiql/ast/Type; - public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)V + public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;)V public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; public static final fun builder ()Lorg/partiql/ast/builder/TableDefinitionAttributeBuilder; public final fun component1 ()Lorg/partiql/ast/Identifier$Symbol; public final fun component2 ()Lorg/partiql/ast/Type; public final fun component3 ()Ljava/util/List; - public final fun copy (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)Lorg/partiql/ast/TableDefinition$Attribute; - public static synthetic fun copy$default (Lorg/partiql/ast/TableDefinition$Attribute;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/ast/TableDefinition$Attribute; + public final fun component4 ()Z + public final fun component5 ()Ljava/lang/String; + public final fun copy (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;)Lorg/partiql/ast/TableDefinition$Attribute; + public static synthetic fun copy$default (Lorg/partiql/ast/TableDefinition$Attribute;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;ILjava/lang/Object;)Lorg/partiql/ast/TableDefinition$Attribute; public fun equals (Ljava/lang/Object;)Z public fun getChildren ()Ljava/util/List; public fun hashCode ()I @@ -3145,6 +3178,27 @@ public final class org/partiql/ast/TableDefinition$Companion { public final fun builder ()Lorg/partiql/ast/builder/TableDefinitionBuilder; } +public final class org/partiql/ast/TableProperty : org/partiql/ast/AstNode { + public static final field Companion Lorg/partiql/ast/TableProperty$Companion; + public final field name Ljava/lang/String; + public final field value Lorg/partiql/value/PartiQLValue; + public fun (Ljava/lang/String;Lorg/partiql/value/PartiQLValue;)V + public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; + public static final fun builder ()Lorg/partiql/ast/builder/TablePropertyBuilder; + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Lorg/partiql/value/PartiQLValue; + public final fun copy (Ljava/lang/String;Lorg/partiql/value/PartiQLValue;)Lorg/partiql/ast/TableProperty; + public static synthetic fun copy$default (Lorg/partiql/ast/TableProperty;Ljava/lang/String;Lorg/partiql/value/PartiQLValue;ILjava/lang/Object;)Lorg/partiql/ast/TableProperty; + public fun equals (Ljava/lang/Object;)Z + public fun getChildren ()Ljava/util/List; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/partiql/ast/TableProperty$Companion { + public final fun builder ()Lorg/partiql/ast/builder/TablePropertyBuilder; +} + public abstract class org/partiql/ast/Type : org/partiql/ast/AstNode { public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; } @@ -3759,17 +3813,21 @@ public final class org/partiql/ast/Type$Struct$Companion { public final class org/partiql/ast/Type$Struct$Field : org/partiql/ast/AstNode { public static final field Companion Lorg/partiql/ast/Type$Struct$Field$Companion; + public final field comment Ljava/lang/String; public final field constraints Ljava/util/List; + public final field isOptional Z public final field name Lorg/partiql/ast/Identifier$Symbol; public final field type Lorg/partiql/ast/Type; - public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)V + public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;)V public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; public static final fun builder ()Lorg/partiql/ast/builder/TypeStructFieldBuilder; public final fun component1 ()Lorg/partiql/ast/Identifier$Symbol; public final fun component2 ()Lorg/partiql/ast/Type; public final fun component3 ()Ljava/util/List; - public final fun copy (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)Lorg/partiql/ast/Type$Struct$Field; - public static synthetic fun copy$default (Lorg/partiql/ast/Type$Struct$Field;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/ast/Type$Struct$Field; + public final fun component4 ()Z + public final fun component5 ()Ljava/lang/String; + public final fun copy (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;)Lorg/partiql/ast/Type$Struct$Field; + public static synthetic fun copy$default (Lorg/partiql/ast/Type$Struct$Field;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ZLjava/lang/String;ILjava/lang/Object;)Lorg/partiql/ast/Type$Struct$Field; public fun equals (Ljava/lang/Object;)Z public fun getChildren ()Ljava/util/List; public fun hashCode ()I @@ -3952,8 +4010,8 @@ public final class org/partiql/ast/builder/AstBuilder { public static synthetic fun constraintDefinitionUnique$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/util/List;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Constraint$Definition$Unique; public final fun ddlOpCreateIndex (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/Identifier;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/DdlOp$CreateIndex; public static synthetic fun ddlOpCreateIndex$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/Identifier;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/DdlOp$CreateIndex; - public final fun ddlOpCreateTable (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/DdlOp$CreateTable; - public static synthetic fun ddlOpCreateTable$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/DdlOp$CreateTable; + public final fun ddlOpCreateTable (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/DdlOp$CreateTable; + public static synthetic fun ddlOpCreateTable$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/DdlOp$CreateTable; public final fun ddlOpDropIndex (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/Identifier;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/DdlOp$DropIndex; public static synthetic fun ddlOpDropIndex$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Lorg/partiql/ast/Identifier;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/DdlOp$DropIndex; public final fun ddlOpDropTable (Lorg/partiql/ast/Identifier;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/DdlOp$DropTable; @@ -4120,6 +4178,8 @@ public final class org/partiql/ast/builder/AstBuilder { public static synthetic fun onConflictTargetSymbols$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/OnConflict$Target$Symbols; public final fun orderBy (Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/OrderBy; public static synthetic fun orderBy$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/OrderBy; + public final fun partitionByAttrList (Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/PartitionBy$AttrList; + public static synthetic fun partitionByAttrList$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/PartitionBy$AttrList; public final fun path (Lorg/partiql/ast/Identifier$Symbol;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Path; public static synthetic fun path$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier$Symbol;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Path; public final fun pathStepIndex (Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Path$Step$Index; @@ -4192,8 +4252,10 @@ public final class org/partiql/ast/builder/AstBuilder { public static synthetic fun statementQuery$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Expr;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Statement$Query; public final fun tableDefinition (Ljava/util/List;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/TableDefinition; public static synthetic fun tableDefinition$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/util/List;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/TableDefinition; - public final fun tableDefinitionAttribute (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/TableDefinition$Attribute; - public static synthetic fun tableDefinitionAttribute$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/TableDefinition$Attribute; + public final fun tableDefinitionAttribute (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/TableDefinition$Attribute; + public static synthetic fun tableDefinitionAttribute$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/TableDefinition$Attribute; + public final fun tableProperty (Ljava/lang/String;Lorg/partiql/value/PartiQLValue;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/TableProperty; + public static synthetic fun tableProperty$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/lang/String;Lorg/partiql/value/PartiQLValue;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/TableProperty; public final fun typeAny (Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Any; public static synthetic fun typeAny$default (Lorg/partiql/ast/builder/AstBuilder;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Type$Any; public final fun typeArray (Lorg/partiql/ast/Type;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Array; @@ -4254,8 +4316,8 @@ public final class org/partiql/ast/builder/AstBuilder { public static synthetic fun typeString$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Type$String; public final fun typeStruct (Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Struct; public static synthetic fun typeStruct$default (Lorg/partiql/ast/builder/AstBuilder;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Type$Struct; - public final fun typeStructField (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Struct$Field; - public static synthetic fun typeStructField$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Type$Struct$Field; + public final fun typeStructField (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Struct$Field; + public static synthetic fun typeStructField$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Type$Struct$Field; public final fun typeSymbol (Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Symbol; public static synthetic fun typeSymbol$default (Lorg/partiql/ast/builder/AstBuilder;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Type$Symbol; public final fun typeTime (Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Type$Time; @@ -4342,15 +4404,21 @@ public final class org/partiql/ast/builder/DdlOpCreateIndexBuilder { public final class org/partiql/ast/builder/DdlOpCreateTableBuilder { public fun ()V - public fun (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;)V - public synthetic fun (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;)V + public synthetic fun (Lorg/partiql/ast/Identifier;Lorg/partiql/ast/TableDefinition;Lorg/partiql/ast/PartitionBy;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun build ()Lorg/partiql/ast/DdlOp$CreateTable; public final fun definition (Lorg/partiql/ast/TableDefinition;)Lorg/partiql/ast/builder/DdlOpCreateTableBuilder; public final fun getDefinition ()Lorg/partiql/ast/TableDefinition; public final fun getName ()Lorg/partiql/ast/Identifier; + public final fun getPartitionBy ()Lorg/partiql/ast/PartitionBy; + public final fun getTableProperties ()Ljava/util/List; public final fun name (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/builder/DdlOpCreateTableBuilder; + public final fun partitionBy (Lorg/partiql/ast/PartitionBy;)Lorg/partiql/ast/builder/DdlOpCreateTableBuilder; public final fun setDefinition (Lorg/partiql/ast/TableDefinition;)V public final fun setName (Lorg/partiql/ast/Identifier;)V + public final fun setPartitionBy (Lorg/partiql/ast/PartitionBy;)V + public final fun setTableProperties (Ljava/util/List;)V + public final fun tableProperties (Ljava/util/List;)Lorg/partiql/ast/builder/DdlOpCreateTableBuilder; } public final class org/partiql/ast/builder/DdlOpDropIndexBuilder { @@ -5408,6 +5476,16 @@ public final class org/partiql/ast/builder/OrderByBuilder { public final fun sorts (Ljava/util/List;)Lorg/partiql/ast/builder/OrderByBuilder; } +public final class org/partiql/ast/builder/PartitionByAttrListBuilder { + public fun ()V + public fun (Ljava/util/List;)V + public synthetic fun (Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun build ()Lorg/partiql/ast/PartitionBy$AttrList; + public final fun getList ()Ljava/util/List; + public final fun list (Ljava/util/List;)Lorg/partiql/ast/builder/PartitionByAttrListBuilder; + public final fun setList (Ljava/util/List;)V +} + public final class org/partiql/ast/builder/PathBuilder { public fun ()V public fun (Lorg/partiql/ast/Identifier$Symbol;Ljava/util/List;)V @@ -5867,16 +5945,22 @@ public final class org/partiql/ast/builder/StatementQueryBuilder { public final class org/partiql/ast/builder/TableDefinitionAttributeBuilder { public fun ()V - public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)V - public synthetic fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;)V + public synthetic fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun build ()Lorg/partiql/ast/TableDefinition$Attribute; + public final fun comment (Ljava/lang/String;)Lorg/partiql/ast/builder/TableDefinitionAttributeBuilder; public final fun constraints (Ljava/util/List;)Lorg/partiql/ast/builder/TableDefinitionAttributeBuilder; + public final fun getComment ()Ljava/lang/String; public final fun getConstraints ()Ljava/util/List; public final fun getName ()Lorg/partiql/ast/Identifier$Symbol; public final fun getType ()Lorg/partiql/ast/Type; + public final fun isOptional ()Ljava/lang/Boolean; + public final fun isOptional (Ljava/lang/Boolean;)Lorg/partiql/ast/builder/TableDefinitionAttributeBuilder; public final fun name (Lorg/partiql/ast/Identifier$Symbol;)Lorg/partiql/ast/builder/TableDefinitionAttributeBuilder; + public final fun setComment (Ljava/lang/String;)V public final fun setConstraints (Ljava/util/List;)V public final fun setName (Lorg/partiql/ast/Identifier$Symbol;)V + public final fun setOptional (Ljava/lang/Boolean;)V public final fun setType (Lorg/partiql/ast/Type;)V public final fun type (Lorg/partiql/ast/Type;)Lorg/partiql/ast/builder/TableDefinitionAttributeBuilder; } @@ -5894,6 +5978,19 @@ public final class org/partiql/ast/builder/TableDefinitionBuilder { public final fun setConstraints (Ljava/util/List;)V } +public final class org/partiql/ast/builder/TablePropertyBuilder { + public fun ()V + public fun (Ljava/lang/String;Lorg/partiql/value/PartiQLValue;)V + public synthetic fun (Ljava/lang/String;Lorg/partiql/value/PartiQLValue;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun build ()Lorg/partiql/ast/TableProperty; + public final fun getName ()Ljava/lang/String; + public final fun getValue ()Lorg/partiql/value/PartiQLValue; + public final fun name (Ljava/lang/String;)Lorg/partiql/ast/builder/TablePropertyBuilder; + public final fun setName (Ljava/lang/String;)V + public final fun setValue (Lorg/partiql/value/PartiQLValue;)V + public final fun value (Lorg/partiql/value/PartiQLValue;)Lorg/partiql/ast/builder/TablePropertyBuilder; +} + public final class org/partiql/ast/builder/TypeAnyBuilder { public fun ()V public final fun build ()Lorg/partiql/ast/Type$Any; @@ -6117,16 +6214,22 @@ public final class org/partiql/ast/builder/TypeStructBuilder { public final class org/partiql/ast/builder/TypeStructFieldBuilder { public fun ()V - public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;)V - public synthetic fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;)V + public synthetic fun (Lorg/partiql/ast/Identifier$Symbol;Lorg/partiql/ast/Type;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun build ()Lorg/partiql/ast/Type$Struct$Field; + public final fun comment (Ljava/lang/String;)Lorg/partiql/ast/builder/TypeStructFieldBuilder; public final fun constraints (Ljava/util/List;)Lorg/partiql/ast/builder/TypeStructFieldBuilder; + public final fun getComment ()Ljava/lang/String; public final fun getConstraints ()Ljava/util/List; public final fun getName ()Lorg/partiql/ast/Identifier$Symbol; public final fun getType ()Lorg/partiql/ast/Type; + public final fun isOptional ()Ljava/lang/Boolean; + public final fun isOptional (Ljava/lang/Boolean;)Lorg/partiql/ast/builder/TypeStructFieldBuilder; public final fun name (Lorg/partiql/ast/Identifier$Symbol;)Lorg/partiql/ast/builder/TypeStructFieldBuilder; + public final fun setComment (Ljava/lang/String;)V public final fun setConstraints (Ljava/util/List;)V public final fun setName (Lorg/partiql/ast/Identifier$Symbol;)V + public final fun setOptional (Ljava/lang/Boolean;)V public final fun setType (Lorg/partiql/ast/Type;)V public final fun type (Lorg/partiql/ast/Type;)Lorg/partiql/ast/builder/TypeStructFieldBuilder; } @@ -6728,6 +6831,8 @@ public abstract class org/partiql/ast/util/AstRewriter : org/partiql/ast/visitor public fun visitOnConflictTargetSymbols (Lorg/partiql/ast/OnConflict$Target$Symbols;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; public synthetic fun visitOrderBy (Lorg/partiql/ast/OrderBy;Ljava/lang/Object;)Ljava/lang/Object; public fun visitOrderBy (Lorg/partiql/ast/OrderBy;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; + public synthetic fun visitPartitionByAttrList (Lorg/partiql/ast/PartitionBy$AttrList;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitPartitionByAttrList (Lorg/partiql/ast/PartitionBy$AttrList;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; public synthetic fun visitPath (Lorg/partiql/ast/Path;Ljava/lang/Object;)Ljava/lang/Object; public fun visitPath (Lorg/partiql/ast/Path;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; public synthetic fun visitPathStepIndex (Lorg/partiql/ast/Path$Step$Index;Ljava/lang/Object;)Ljava/lang/Object; @@ -6802,6 +6907,8 @@ public abstract class org/partiql/ast/util/AstRewriter : org/partiql/ast/visitor public fun visitTableDefinition (Lorg/partiql/ast/TableDefinition;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; public synthetic fun visitTableDefinitionAttribute (Lorg/partiql/ast/TableDefinition$Attribute;Ljava/lang/Object;)Ljava/lang/Object; public fun visitTableDefinitionAttribute (Lorg/partiql/ast/TableDefinition$Attribute;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; + public synthetic fun visitTableProperty (Lorg/partiql/ast/TableProperty;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitTableProperty (Lorg/partiql/ast/TableProperty;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; public synthetic fun visitTypeAny (Lorg/partiql/ast/Type$Any;Ljava/lang/Object;)Ljava/lang/Object; public fun visitTypeAny (Lorg/partiql/ast/Type$Any;Ljava/lang/Object;)Lorg/partiql/ast/AstNode; public synthetic fun visitTypeArray (Lorg/partiql/ast/Type$Array;Ljava/lang/Object;)Ljava/lang/Object; @@ -6989,6 +7096,8 @@ public abstract class org/partiql/ast/visitor/AstBaseVisitor : org/partiql/ast/v public fun visitOnConflictTargetConstraint (Lorg/partiql/ast/OnConflict$Target$Constraint;Ljava/lang/Object;)Ljava/lang/Object; public fun visitOnConflictTargetSymbols (Lorg/partiql/ast/OnConflict$Target$Symbols;Ljava/lang/Object;)Ljava/lang/Object; public fun visitOrderBy (Lorg/partiql/ast/OrderBy;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitPartitionBy (Lorg/partiql/ast/PartitionBy;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitPartitionByAttrList (Lorg/partiql/ast/PartitionBy$AttrList;Ljava/lang/Object;)Ljava/lang/Object; public fun visitPath (Lorg/partiql/ast/Path;Ljava/lang/Object;)Ljava/lang/Object; public fun visitPathStep (Lorg/partiql/ast/Path$Step;Ljava/lang/Object;)Ljava/lang/Object; public fun visitPathStepIndex (Lorg/partiql/ast/Path$Step$Index;Ljava/lang/Object;)Ljava/lang/Object; @@ -7034,6 +7143,7 @@ public abstract class org/partiql/ast/visitor/AstBaseVisitor : org/partiql/ast/v public fun visitStatementQuery (Lorg/partiql/ast/Statement$Query;Ljava/lang/Object;)Ljava/lang/Object; public fun visitTableDefinition (Lorg/partiql/ast/TableDefinition;Ljava/lang/Object;)Ljava/lang/Object; public fun visitTableDefinitionAttribute (Lorg/partiql/ast/TableDefinition$Attribute;Ljava/lang/Object;)Ljava/lang/Object; + public fun visitTableProperty (Lorg/partiql/ast/TableProperty;Ljava/lang/Object;)Ljava/lang/Object; public fun visitType (Lorg/partiql/ast/Type;Ljava/lang/Object;)Ljava/lang/Object; public fun visitTypeAny (Lorg/partiql/ast/Type$Any;Ljava/lang/Object;)Ljava/lang/Object; public fun visitTypeArray (Lorg/partiql/ast/Type$Array;Ljava/lang/Object;)Ljava/lang/Object; @@ -7180,6 +7290,8 @@ public abstract interface class org/partiql/ast/visitor/AstVisitor { public abstract fun visitOnConflictTargetConstraint (Lorg/partiql/ast/OnConflict$Target$Constraint;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitOnConflictTargetSymbols (Lorg/partiql/ast/OnConflict$Target$Symbols;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitOrderBy (Lorg/partiql/ast/OrderBy;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPartitionBy (Lorg/partiql/ast/PartitionBy;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitPartitionByAttrList (Lorg/partiql/ast/PartitionBy$AttrList;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitPath (Lorg/partiql/ast/Path;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitPathStep (Lorg/partiql/ast/Path$Step;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitPathStepIndex (Lorg/partiql/ast/Path$Step$Index;Ljava/lang/Object;)Ljava/lang/Object; @@ -7225,6 +7337,7 @@ public abstract interface class org/partiql/ast/visitor/AstVisitor { public abstract fun visitStatementQuery (Lorg/partiql/ast/Statement$Query;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitTableDefinition (Lorg/partiql/ast/TableDefinition;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitTableDefinitionAttribute (Lorg/partiql/ast/TableDefinition$Attribute;Ljava/lang/Object;)Ljava/lang/Object; + public abstract fun visitTableProperty (Lorg/partiql/ast/TableProperty;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitType (Lorg/partiql/ast/Type;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitTypeAny (Lorg/partiql/ast/Type$Any;Ljava/lang/Object;)Ljava/lang/Object; public abstract fun visitTypeArray (Lorg/partiql/ast/Type$Array;Ljava/lang/Object;)Ljava/lang/Object; diff --git a/partiql-ast/src/main/kotlin/org/partiql/ast/helpers/ToLegacyAst.kt b/partiql-ast/src/main/kotlin/org/partiql/ast/helpers/ToLegacyAst.kt index 5f89431721..d2a07a7982 100644 --- a/partiql-ast/src/main/kotlin/org/partiql/ast/helpers/ToLegacyAst.kt +++ b/partiql-ast/src/main/kotlin/org/partiql/ast/helpers/ToLegacyAst.kt @@ -136,6 +136,12 @@ private class AstTranslator(val metas: Map) : AstBaseVisi } val tableName = node.name.symbol val def = node.definition?.let { visitTableDefinition(it, ctx) } + if (node.partitionBy != null) { + error("The legacy AST does not support Partition BY in create Table") + } + if (node.tableProperties.isNotEmpty()) { + error("The legacy AST does not support TBLProperties in create Table") + } ddl(createTable(tableName, def), metas) } @@ -187,6 +193,12 @@ private class AstTranslator(val metas: Map) : AstBaseVisi val name = node.name.symbol val type = visitType(node.type, ctx) val constraints = node.constraints.translate(ctx) + if (node.isOptional) { + error("The legacy AST does not support optional field declaration") + } + if (node.comment != null) { + error("The legacy AST does not support comment clause") + } columnDeclaration(name, type, constraints, metas) } diff --git a/partiql-ast/src/main/resources/partiql_ast.ion b/partiql-ast/src/main/resources/partiql_ast.ion index cc137e3e13..5c6aea16b6 100644 --- a/partiql-ast/src/main/resources/partiql_ast.ion +++ b/partiql-ast/src/main/resources/partiql_ast.ion @@ -133,6 +133,12 @@ ddl_op::[ create_table::{ name: identifier, definition: optional::table_definition, + // This is an expression for backward compatibility + // For now, we support `PARTITION BY ( (, )* ))` + // But in the future, we might support additional partition expressions: + // such as `PARTITION BY RANGE(..)` + partition_by: optional::partition_by, + table_properties: list::[table_property], }, // CREATE INDEX [] ON ( [, ]...) @@ -233,6 +239,8 @@ type::[ // for struct subfield. But modeling this to be a list of constraints // to prevent future breaking changes. constraints: list::[constraint], + is_optional: bool, + comment: optional::string, } ], }, // STRUCT @@ -829,6 +837,9 @@ table_definition::{ name: '.identifier.symbol', type: '.type', constraints: list::[constraint], + // TODO: Consider to model this as a constraint? + is_optional: bool, + comment: optional::string, } ], } @@ -847,6 +858,18 @@ constraint::{ ], } +partition_by::[ + attr_list :: { + list: list::['.identifier.symbol'] + }, + // We can add other commonly support Partition Expression like `range` later +] + +table_property::{ + name: string, + value: '.value', +} + // SQL-99 Table 11 datetime_field::[ YEAR, // 0001-9999 diff --git a/partiql-ast/src/test/kotlin/org/partiql/ast/helpers/ToLegacyAstTest.kt b/partiql-ast/src/test/kotlin/org/partiql/ast/helpers/ToLegacyAstTest.kt index 1fced537c7..11d1f97c70 100644 --- a/partiql-ast/src/test/kotlin/org/partiql/ast/helpers/ToLegacyAstTest.kt +++ b/partiql-ast/src/test/kotlin/org/partiql/ast/helpers/ToLegacyAstTest.kt @@ -423,7 +423,9 @@ class ToLegacyAstTest { fields += org.partiql.ast.typeStructField( org.partiql.ast.identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), typeInt2(), - emptyList() + emptyList(), + false, + null ) } }, diff --git a/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt b/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt index 4b702a028d..9a21e6d890 100644 --- a/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt +++ b/partiql-lang/src/main/kotlin/org/partiql/lang/syntax/impl/PartiQLPigVisitor.kt @@ -246,6 +246,7 @@ internal class PartiQLPigVisitor( throw ParserException("PIG Parser does not support qualified name as table name", ErrorCode.PARSE_UNEXPECTED_TOKEN) } val def = ctx.tableDef()?.let { visitTableDef(it) } + ctx.tableExtension().map { visit(it) } createTable_(name, def, ctx.CREATE().getSourceMetaContainer()) } @@ -264,6 +265,12 @@ internal class PartiQLPigVisitor( val name = visitSymbolPrimitive(ctx.columnName().symbolPrimitive()).name.text val type = visit(ctx.type()) as PartiqlAst.Type val constrs = ctx.columnConstraint().map { visitColumnConstraint(it) } + if (ctx.OPTIONAL() != null) { + throw ParserException("PIG Parser does not support OPTIONAL Field", ErrorCode.PARSE_UNEXPECTED_TOKEN) + } + if (ctx.comment() != null) { + throw ParserException("PIG Parser does not support COMMENT Clause", ErrorCode.PARSE_UNEXPECTED_TOKEN) + } columnDeclaration(name, type, constrs) } @@ -281,6 +288,12 @@ internal class PartiQLPigVisitor( columnNull() } + override fun visitTableConstrDeclaration(ctx: PartiQLParser.TableConstrDeclarationContext) = throw ParserException("PIG Parser does not support tuple level constraint", ErrorCode.PARSE_UNEXPECTED_TOKEN) + + override fun visitTblExtensionPartition(ctx: PartiQLParser.TblExtensionPartitionContext) = throw ParserException("PIG Parser does not support PARTITION BY Clause", ErrorCode.PARSE_UNEXPECTED_TOKEN) + + override fun visitTblExtensionTblProperties(ctx: PartiQLParser.TblExtensionTblPropertiesContext) = throw ParserException("PIG Parser does not support TBLPROPERTIES Clause", ErrorCode.PARSE_UNEXPECTED_TOKEN) + /** * * EXECUTE diff --git a/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserDDLTest.kt b/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserDDLTest.kt index 743348b69c..2662034473 100644 --- a/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserDDLTest.kt +++ b/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserDDLTest.kt @@ -96,6 +96,44 @@ internal class PartiQLParserDDLTest : PartiQLParserTestBase() { code = ErrorCode.PARSE_UNEXPECTED_TOKEN, context = mapOf(), ), + ParserErrorTestCase( + description = "PIG Parser does not support OPTIONAL Attribute", + query = """ + CREATE TABLE tbl ( + a OPTIONAL INT2 + ) + """.trimIndent(), + code = ErrorCode.PARSE_UNEXPECTED_TOKEN, + context = mapOf(), + ), + ParserErrorTestCase( + description = "PIG Parser does not support COMMENT keyword", + query = """ + CREATE TABLE tbl ( + a INT2 COMMENT 'this is a comment' + ) + """.trimIndent(), + code = ErrorCode.PARSE_UNEXPECTED_TOKEN, + context = mapOf(), + ), + ParserErrorTestCase( + description = "PIG Parser does not support PARTITION BY keyword", + query = """ + CREATE TABLE tbl + PARTITION BY (a, b) + """.trimIndent(), + code = ErrorCode.PARSE_UNEXPECTED_TOKEN, + context = mapOf(), + ), + ParserErrorTestCase( + description = "PIG Parser does not support TBLPROPERTIES keyword", + query = """ + CREATE TABLE tbl + TBLPROPERTIES ('k1' = 'v1') + """.trimIndent(), + code = ErrorCode.PARSE_UNEXPECTED_TOKEN, + context = mapOf(), + ), // Putting those tests here are they are impacted by DDL implementation ParserErrorTestCase( diff --git a/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserMatchTest.kt b/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserMatchTest.kt index d45c4a4fb1..fcc1a10e27 100644 --- a/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserMatchTest.kt +++ b/partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserMatchTest.kt @@ -1067,7 +1067,7 @@ class PartiQLParserMatchTest : PartiQLParserTestBase() { @Test fun prefilters() = assertExpression( - "SELECT u as banCandidate FROM g MATCH (p:Post Where p.isFlagged = true) <-[:createdPost]- (u:Usr WHERE u.isBanned = false AND u.karma < 20) -[:createdComment]->(c:Comment WHERE c.isFlagged = true) WHERE p.title LIKE '%considered harmful%'", + "SELECT u as banCandidate FROM g MATCH (p:Post Where p.isFlagged = true) <-[:createdPost]- (u:Usr WHERE u.isBanned = false AND u.karma < 20) -[:createdComment]->(c:\"Comment\" WHERE c.isFlagged = true) WHERE p.title LIKE '%considered harmful%'", ) { PartiqlAst.build { select( diff --git a/partiql-parser/src/main/antlr/PartiQL.g4 b/partiql-parser/src/main/antlr/PartiQL.g4 index 90d693aa74..e08b512716 100644 --- a/partiql-parser/src/main/antlr/PartiQL.g4 +++ b/partiql-parser/src/main/antlr/PartiQL.g4 @@ -77,6 +77,7 @@ qualifiedName : (qualifier+=symbolPrimitive PERIOD)* name=symbolPrimitive; tableName : symbolPrimitive; columnName : symbolPrimitive; constraintName : symbolPrimitive; +comment : COMMENT LITERAL_STRING; ddl : createCommand @@ -84,7 +85,7 @@ ddl ; createCommand - : CREATE TABLE qualifiedName ( PAREN_LEFT tableDef PAREN_RIGHT )? # CreateTable + : CREATE TABLE qualifiedName ( PAREN_LEFT tableDef PAREN_RIGHT )? tableExtension* # CreateTable | CREATE INDEX ON symbolPrimitive PAREN_LEFT pathSimple ( COMMA pathSimple )* PAREN_RIGHT # CreateIndex ; @@ -98,7 +99,7 @@ tableDef ; tableDefPart - : columnName type columnConstraint* # ColumnDeclaration + : columnName OPTIONAL? type columnConstraint* comment? # ColumnDeclaration | ( CONSTRAINT constraintName )? tableConstraintDef # TableConstrDeclaration ; @@ -136,6 +137,20 @@ uniqueConstraintDef // but we at least can eliminate SFW query here. searchCondition : exprOr; +// SQL/HIVE DDL Extension, Support additional table metadatas such as partition by, tblProperties, etc. +tableExtension + : PARTITION BY partitionBy # TblExtensionPartition + | TBLPROPERTIES PAREN_LEFT keyValuePair (COMMA keyValuePair)* PAREN_RIGHT # TblExtensionTblProperties + ; + +// Limiting the scope to only allow String as valid value for now +keyValuePair : key=LITERAL_STRING EQ value=LITERAL_STRING; + +// For now: just support a list of column name +// In the future, we might support common partition expression such as Hash(), Range(), etc. +partitionBy + : PAREN_LEFT columnName (COMMA columnName)* PAREN_RIGHT #PartitionColList + ; /** * * DATA MANIPULATION LANGUAGE (DML) @@ -836,5 +851,5 @@ type ; structField - : columnName COLON type columnConstraint* + : columnName OPTIONAL? COLON type columnConstraint* comment? ; diff --git a/partiql-parser/src/main/antlr/PartiQLTokens.g4 b/partiql-parser/src/main/antlr/PartiQLTokens.g4 index 5ab8b50059..28c1581da1 100644 --- a/partiql-parser/src/main/antlr/PartiQLTokens.g4 +++ b/partiql-parser/src/main/antlr/PartiQLTokens.g4 @@ -59,6 +59,7 @@ COALESCE: 'COALESCE'; COLLATE: 'COLLATE'; COLLATION: 'COLLATION'; COLUMN: 'COLUMN'; +COMMENT: 'COMMENT'; COMMIT: 'COMMIT'; CONNECT: 'CONNECT'; CONNECTION: 'CONNECTION'; @@ -175,6 +176,7 @@ ON: 'ON'; ONLY: 'ONLY'; OPEN: 'OPEN'; OPTION: 'OPTION'; +OPTIONAL: 'OPTIONAL'; OR: 'OR'; ORDER: 'ORDER'; OUTER: 'OUTER'; @@ -287,6 +289,7 @@ MODIFIED: 'MODIFIED'; NEW: 'NEW'; OLD: 'OLD'; NOTHING: 'NOTHING'; +TBLPROPERTIES: 'TBLPROPERTIES'; /** * diff --git a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt index f75b54c6c3..0f633cf8ae 100644 --- a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt +++ b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt @@ -44,6 +44,7 @@ import org.partiql.ast.GroupBy import org.partiql.ast.Identifier import org.partiql.ast.Let import org.partiql.ast.OnConflict +import org.partiql.ast.PartitionBy import org.partiql.ast.Path import org.partiql.ast.Returning import org.partiql.ast.Select @@ -139,6 +140,7 @@ import org.partiql.ast.onConflictActionDoUpdate import org.partiql.ast.onConflictTargetConstraint import org.partiql.ast.onConflictTargetSymbols import org.partiql.ast.orderBy +import org.partiql.ast.partitionByAttrList import org.partiql.ast.path import org.partiql.ast.pathStepIndex import org.partiql.ast.pathStepSymbol @@ -176,6 +178,7 @@ import org.partiql.ast.statementExplainTargetDomain import org.partiql.ast.statementQuery import org.partiql.ast.tableDefinition import org.partiql.ast.tableDefinitionAttribute +import org.partiql.ast.tableProperty import org.partiql.ast.typeAny import org.partiql.ast.typeArray import org.partiql.ast.typeBag @@ -610,7 +613,26 @@ internal class PartiQLParserDefault : PartiQLParser { override fun visitCreateTable(ctx: GeneratedParser.CreateTableContext) = translate(ctx) { val table = visitQualifiedName(ctx.qualifiedName()) val definition = ctx.tableDef()?.let { visitTableDef(it) } - ddlOpCreateTable(table, definition) + val partitionBy = ctx + .tableExtension() + .filterIsInstance() + .let { + if (it.size > 1) throw error(ctx, "Expect one PARTITION BY clause.") + it.firstOrNull()?.let { visitTblExtensionPartition(it) } + } + val tblProperties = ctx + .tableExtension() + .filterIsInstance() + .let { + if (it.size > 1) throw error(ctx, "Expect one TBLPROPERTIES clause.") + val tblPropertiesCtx = it.firstOrNull() + tblPropertiesCtx?.keyValuePair()?.map { + val key = it.key.getStringValue() + val value = it.value.getStringValue() + tableProperty(key, stringValue(value)) + } ?: emptyList() + } + ddlOpCreateTable(table, definition, partitionBy, tblProperties) } override fun visitCreateIndex(ctx: GeneratedParser.CreateIndexContext) = translate(ctx) { @@ -640,7 +662,12 @@ internal class PartiQLParserDefault : PartiQLParser { isValidTypeDeclarationOrThrow(it, ctx.type()) } val constraints = ctx.columnConstraint().map { visitColumnConstraint(it) } - tableDefinitionAttribute(name, type, constraints) + val optional = when (ctx.OPTIONAL()) { + null -> false + else -> true + } + val comment = ctx.comment()?.LITERAL_STRING()?.getStringValue() + tableDefinitionAttribute(name, type, constraints, optional, comment) } /** @@ -710,6 +737,13 @@ internal class PartiQLParserDefault : PartiQLParser { constraint(identifier, body) } + override fun visitTblExtensionPartition(ctx: GeneratedParser.TblExtensionPartitionContext) = + ctx.partitionBy().accept(this) as PartitionBy + + override fun visitPartitionColList(ctx: GeneratedParser.PartitionColListContext) = translate(ctx) { + partitionByAttrList(ctx.columnName().map { visitAs (it.symbolPrimitive()) }) + } + /** * * EXECUTE @@ -2255,8 +2289,13 @@ internal class PartiQLParserDefault : PartiQLParser { else -> throw error(it, "Only NULL Constraint and NOT NULL Constraint are allowed in Struct field") } } + val optional = when (structFieldCtx.OPTIONAL()) { + null -> false + else -> true + } + val comment = structFieldCtx.comment()?.LITERAL_STRING()?.getStringValue() - typeStructField(name, type, constraints) + typeStructField(name, type, constraints, optional, comment) } typeStruct(fields) } diff --git a/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt b/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt index 46a2cce13a..7eea0be96a 100644 --- a/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt +++ b/partiql-parser/src/test/kotlin/org/partiql/parser/internal/PartiQLParserDDLTests.kt @@ -10,6 +10,7 @@ import org.partiql.ast.Constraint import org.partiql.ast.DdlOp import org.partiql.ast.Expr import org.partiql.ast.Identifier +import org.partiql.ast.PartitionBy import org.partiql.ast.Type import org.partiql.ast.constraint import org.partiql.ast.constraintDefinitionCheck @@ -25,9 +26,11 @@ import org.partiql.ast.identifierSymbol import org.partiql.ast.statementDDL import org.partiql.ast.tableDefinition import org.partiql.ast.tableDefinitionAttribute +import org.partiql.ast.tableProperty import org.partiql.parser.PartiQLParserException import org.partiql.value.PartiQLValueExperimental import org.partiql.value.int32Value +import org.partiql.value.stringValue import java.util.stream.Stream import kotlin.test.assertEquals @@ -67,6 +70,8 @@ class PartiQLParserDDLTests { ddlOpCreateTable( identifierSymbol("foo", Identifier.CaseSensitivity.INSENSITIVE), null, + null, + emptyList() ) ), // Support Case Sensitive identifier as table name @@ -77,7 +82,9 @@ class PartiQLParserDDLTests { "CREATE TABLE \"foo\"", ddlOpCreateTable( identifierSymbol("foo", Identifier.CaseSensitivity.SENSITIVE), - null + null, + null, + emptyList() ) ), SuccessTestCase( @@ -91,7 +98,9 @@ class PartiQLParserDDLTests { identifierSymbol("foo", Identifier.CaseSensitivity.INSENSITIVE), ) ), - null + null, + null, + emptyList() ) ), SuccessTestCase( @@ -105,7 +114,9 @@ class PartiQLParserDDLTests { identifierSymbol("foo", Identifier.CaseSensitivity.INSENSITIVE), ) ), - null + null, + null, + emptyList() ) ), @@ -127,10 +138,14 @@ class PartiQLParserDDLTests { identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), listOf(constraint(null, constraintDefinitionNotNull())), + false, + null ) ), emptyList() - ) + ), + null, + emptyList() ) ), @@ -149,10 +164,14 @@ class PartiQLParserDDLTests { identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), listOf(constraint(null, constraintDefinitionUnique(null, false))), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -171,10 +190,14 @@ class PartiQLParserDDLTests { identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), listOf(constraint(null, constraintDefinitionUnique(null, true))), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -204,10 +227,14 @@ class PartiQLParserDDLTests { ) ) ), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -235,6 +262,8 @@ class PartiQLParserDDLTests { ) ) ), + null, + emptyList() ) ), @@ -262,6 +291,8 @@ class PartiQLParserDDLTests { ) ) ), + null, + emptyList() ) ), @@ -289,6 +320,8 @@ class PartiQLParserDDLTests { ) ) ), + null, + emptyList() ) ), @@ -307,10 +340,14 @@ class PartiQLParserDDLTests { identifierSymbol("a", Identifier.CaseSensitivity.SENSITIVE), Type.Int2(), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -335,20 +372,28 @@ class PartiQLParserDDLTests { Type.Struct.Field( identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), - emptyList() + emptyList(), + false, + null ), Type.Struct.Field( identifierSymbol("c", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), - listOf(Constraint(null, Constraint.Definition.NotNull())) + listOf(Constraint(null, Constraint.Definition.NotNull())), + false, + null ) ) ), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -377,24 +422,34 @@ class PartiQLParserDDLTests { Type.Struct.Field( identifierSymbol("c", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), - emptyList() + emptyList(), + false, + null ), ) ), - emptyList() + emptyList(), + false, + null ), Type.Struct.Field( identifierSymbol("d", Identifier.CaseSensitivity.INSENSITIVE), Type.Array(Type.Int2()), - emptyList() + emptyList(), + false, + null ) ) ), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -415,10 +470,14 @@ class PartiQLParserDDLTests { emptyList() ), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -437,10 +496,14 @@ class PartiQLParserDDLTests { identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), Type.Array(Type.Int2()), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), SuccessTestCase( @@ -462,16 +525,22 @@ class PartiQLParserDDLTests { Type.Struct.Field( identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), - emptyList() + emptyList(), + false, + null ), ) ), ), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), SuccessTestCase( @@ -493,16 +562,22 @@ class PartiQLParserDDLTests { Type.Struct.Field( identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), Type.Int2(), - emptyList() + emptyList(), + false, + null ), ) ), ), emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() ) ), @@ -521,10 +596,313 @@ class PartiQLParserDDLTests { identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), Type.Array(null), emptyList(), + false, + null + ) + ), + emptyList() + ), + null, + emptyList() + ) + ), + + // + // Optional keyword + // + SuccessTestCase( + "CREATE TABLE with top level attribute optional", + """ + CREATE TABLE tbl ( + a OPTIONAL INT2 + ) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + tableDefinition( + listOf( + tableDefinitionAttribute( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + Type.Int2(), + emptyList(), + true, + null + ) + ), + emptyList() + ), + null, + emptyList() + ) + ), + + SuccessTestCase( + "CREATE TABLE with struct optional field", + """ + CREATE TABLE tbl ( + a STRUCT + ) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + tableDefinition( + listOf( + tableDefinitionAttribute( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + Type.Struct( + listOf( + Type.Struct.Field( + identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), + Type.Int2(), + emptyList(), + true, + null + ) + ) + ), + emptyList(), + false, + null + ) + ), + emptyList() + ), + null, + emptyList() + ) + ), + + SuccessTestCase( + "CREATE TABLE with optional struct which has optional field", + """ + CREATE TABLE tbl ( + a OPTIONAL STRUCT + ) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + tableDefinition( + listOf( + tableDefinitionAttribute( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + Type.Struct( + listOf( + Type.Struct.Field( + identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), + Type.Int2(), + emptyList(), + true, + null + ) + ) + ), + emptyList(), + true, + null + ) + ), + emptyList() + ), + null, + emptyList() + ) + ), + + // COMMENT keyword + SuccessTestCase( + "CREATE TABLE with comment on top level attribute ", + """ + CREATE TABLE tbl ( + a INT2 COMMENT 'attribute a' + ) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + tableDefinition( + listOf( + tableDefinitionAttribute( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + Type.Int2(), + emptyList(), + false, + "attribute a" + ) + ), + emptyList() + ), + null, + emptyList() + ) + ), + + SuccessTestCase( + "CREATE TABLE with comment on struct field", + """ + CREATE TABLE tbl ( + a STRUCT + ) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + tableDefinition( + listOf( + tableDefinitionAttribute( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + Type.Struct( + listOf( + Type.Struct.Field( + identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), + Type.Int2(), + emptyList(), + false, + "comment on struct field" + ) + ) + ), + emptyList(), + false, + null ) ), emptyList() ), + null, + emptyList() + ) + ), + + SuccessTestCase( + "CREATE TABLE with comment on struct which has comment on field", + """ + CREATE TABLE tbl ( + a STRUCT COMMENT 'comment on top level' + ) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + tableDefinition( + listOf( + tableDefinitionAttribute( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + Type.Struct( + listOf( + Type.Struct.Field( + identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), + Type.Int2(), + emptyList(), + false, + "comment on inner level" + ) + ) + ), + emptyList(), + false, + "comment on top level" + ) + ), + emptyList() + ), + null, + emptyList() + ) + ), + + // Partition BY + SuccessTestCase( + "CREATE TABLE with Partition by single attribute", + """ + CREATE TABLE tbl + PARTITION BY (a) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + null, + PartitionBy.AttrList( + listOf( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + ) + ), + emptyList() + ) + ), + + SuccessTestCase( + "CREATE TABLE with Partition by multiple attribute", + """ + CREATE TABLE tbl + PARTITION BY (a, b) + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + null, + PartitionBy.AttrList( + listOf( + identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE), + identifierSymbol("b", Identifier.CaseSensitivity.INSENSITIVE), + ) + ), + emptyList() + ) + ), + + // Table Properties + SuccessTestCase( + "CREATE TABLE with TBLPROPERTIES single property", + """ + CREATE TABLE tbl + TBLPROPERTIES ('k1' = 'v1') + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + null, + null, + listOf(tableProperty("k1", stringValue("v1"))) + ) + ), + + SuccessTestCase( + "CREATE TABLE with TBLPROPERTIES preserve case sensitivity", + """ + CREATE TABLE tbl + TBLPROPERTIES ('K1k' = 'V1v') + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + null, + null, + listOf(tableProperty("K1k", stringValue("V1v"))) + ) + ), + + SuccessTestCase( + "CREATE TABLE with TBLPROPERTIES multiple properties", + """ + CREATE TABLE tbl + TBLPROPERTIES ('k1' = 'v1', 'k2' = 'v2') + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + null, + null, + listOf( + tableProperty("k1", stringValue("v1")), + tableProperty("k2", stringValue("v2")) + ) + ) + ), + + SuccessTestCase( + "CREATE TABLE with TBLPROPERTIES and PARTITION BY", + """ + CREATE TABLE tbl + PARTITION BY (a) + TBLPROPERTIES ('k1' = 'v1') + """.trimIndent(), + ddlOpCreateTable( + identifierSymbol("tbl", Identifier.CaseSensitivity.INSENSITIVE), + null, + PartitionBy.AttrList(listOf(identifierSymbol("a", Identifier.CaseSensitivity.INSENSITIVE),),), + listOf(tableProperty("k1", stringValue("v1")),) ) ), ) @@ -619,6 +997,90 @@ class PartiQLParserDDLTests { ) """.trimIndent() ), + ErrorTestCase( + "Multiple Partition by not allowed", + """ + CREATE TABLE TBL + PARTITION BY (a) + PARTITION BY (b) + """.trimIndent() + ), + ErrorTestCase( + "Empty Partition by not allowed", + """ + CREATE TABLE TBL + PARTITION BY () + """.trimIndent() + ), + + ErrorTestCase( + "Multiple TBLPROPERTIES not allowed", + """ + CREATE TABLE TBL + TBLPROPERTIES('k1' = 'v1') + TBLPROPERTIES('k2' = 'v2') + """.trimIndent() + ), + + ErrorTestCase( + "Empty TBLPROPERTIES not allowed", + """ + CREATE TABLE TBL + TBLPROPERTIES() + """.trimIndent() + ), + + ErrorTestCase( + "TBLPROPERTIES only allowed String value", + """ + CREATE TABLE TBL + TBLPROPERTIES('k1' = 1) + """.trimIndent() + ), + + ErrorTestCase( + "TBLPROPERTIES only allowed String key", + """ + CREATE TABLE TBL + TBLPROPERTIES(1 = '1') + """.trimIndent() + ), + + ErrorTestCase( + "OPTIONAL needs to follow attribute name", + """ + CREATE TABLE TBL ( + a INT2 OPTIONAL + ) + """.trimIndent() + ), + + ErrorTestCase( + "Multiple Optional not allowed", + """ + CREATE TABLE TBL ( + a OPTIONAL OPTIONAL INT2 + ) + """.trimIndent() + ), + + ErrorTestCase( + "Multiple COMMENT not allowed", + """ + CREATE TABLE TBL ( + a INT2 COMMENT 'comment1' COMMENT 'comment2' + ) + """.trimIndent() + ), + + ErrorTestCase( + "Inline comment needs to appear last", + """ + CREATE TABLE TBL ( + a INT2 COMMENT 'comment1' NOT NULL + ) + """.trimIndent() + ), // TODO: Move this to another place as part of parser test porting process ErrorTestCase(