Skip to content

Commit

Permalink
Remove hard-coded aggregations from parser and ast
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed May 29, 2024
1 parent c53be04 commit 5d1a779
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 235 deletions.
69 changes: 13 additions & 56 deletions partiql-ast/api/partiql-ast.api
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ public final class org/partiql/ast/Ast {
public static final fun excludeStepCollWildcard ()Lorg/partiql/ast/Exclude$Step$CollWildcard;
public static final fun excludeStepStructField (Lorg/partiql/ast/Identifier$Symbol;)Lorg/partiql/ast/Exclude$Step$StructField;
public static final fun excludeStepStructWildcard ()Lorg/partiql/ast/Exclude$Step$StructWildcard;
public static final fun exprAgg (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/Expr$Agg;
public static final fun exprBagOp (Lorg/partiql/ast/SetOp;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;)Lorg/partiql/ast/Expr$BagOp;
public static final fun exprBetween (Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;)Lorg/partiql/ast/Expr$Between;
public static final fun exprBinary (Lorg/partiql/ast/Expr$Binary$Op;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;)Lorg/partiql/ast/Expr$Binary;
public static final fun exprCall (Lorg/partiql/ast/Identifier;Ljava/util/List;)Lorg/partiql/ast/Expr$Call;
public static final fun exprCall (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/Expr$Call;
public static final fun exprCanCast (Lorg/partiql/ast/Expr;Lorg/partiql/ast/Type;)Lorg/partiql/ast/Expr$CanCast;
public static final fun exprCanLosslessCast (Lorg/partiql/ast/Expr;Lorg/partiql/ast/Type;)Lorg/partiql/ast/Expr$CanLosslessCast;
public static final fun exprCase (Lorg/partiql/ast/Expr;Ljava/util/List;Lorg/partiql/ast/Expr;)Lorg/partiql/ast/Expr$Case;
Expand Down Expand Up @@ -516,29 +515,6 @@ public abstract class org/partiql/ast/Expr : org/partiql/ast/AstNode {
public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
}

public final class org/partiql/ast/Expr$Agg : org/partiql/ast/Expr {
public static final field Companion Lorg/partiql/ast/Expr$Agg$Companion;
public final field args Ljava/util/List;
public final field function Lorg/partiql/ast/Identifier;
public final field setq Lorg/partiql/ast/SetQuantifier;
public fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)V
public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static final fun builder ()Lorg/partiql/ast/builder/ExprAggBuilder;
public final fun component1 ()Lorg/partiql/ast/Identifier;
public final fun component2 ()Ljava/util/List;
public final fun component3 ()Lorg/partiql/ast/SetQuantifier;
public final fun copy (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/Expr$Agg;
public static synthetic fun copy$default (Lorg/partiql/ast/Expr$Agg;Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Agg;
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/Expr$Agg$Companion {
public final fun builder ()Lorg/partiql/ast/builder/ExprAggBuilder;
}

public final class org/partiql/ast/Expr$BagOp : org/partiql/ast/Expr {
public static final field Companion Lorg/partiql/ast/Expr$BagOp$Companion;
public final field lhs Lorg/partiql/ast/Expr;
Expand Down Expand Up @@ -636,13 +612,15 @@ public final class org/partiql/ast/Expr$Call : org/partiql/ast/Expr {
public static final field Companion Lorg/partiql/ast/Expr$Call$Companion;
public final field args Ljava/util/List;
public final field function Lorg/partiql/ast/Identifier;
public fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;)V
public final field setq Lorg/partiql/ast/SetQuantifier;
public fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)V
public fun accept (Lorg/partiql/ast/visitor/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object;
public static final fun builder ()Lorg/partiql/ast/builder/ExprCallBuilder;
public final fun component1 ()Lorg/partiql/ast/Identifier;
public final fun component2 ()Ljava/util/List;
public final fun copy (Lorg/partiql/ast/Identifier;Ljava/util/List;)Lorg/partiql/ast/Expr$Call;
public static synthetic fun copy$default (Lorg/partiql/ast/Expr$Call;Lorg/partiql/ast/Identifier;Ljava/util/List;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Call;
public final fun component3 ()Lorg/partiql/ast/SetQuantifier;
public final fun copy (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/Expr$Call;
public static synthetic fun copy$default (Lorg/partiql/ast/Expr$Call;Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Call;
public fun equals (Ljava/lang/Object;)Z
public fun getChildren ()Ljava/util/List;
public fun hashCode ()I
Expand Down Expand Up @@ -4028,16 +4006,14 @@ public final class org/partiql/ast/builder/AstBuilder {
public static synthetic fun excludeStepStructField$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier$Symbol;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Exclude$Step$StructField;
public final fun excludeStepStructWildcard (Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Exclude$Step$StructWildcard;
public static synthetic fun excludeStepStructWildcard$default (Lorg/partiql/ast/builder/AstBuilder;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Exclude$Step$StructWildcard;
public final fun exprAgg (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$Agg;
public static synthetic fun exprAgg$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Agg;
public final fun exprBagOp (Lorg/partiql/ast/SetOp;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$BagOp;
public static synthetic fun exprBagOp$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/SetOp;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$BagOp;
public final fun exprBetween (Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$Between;
public static synthetic fun exprBetween$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Between;
public final fun exprBinary (Lorg/partiql/ast/Expr$Binary$Op;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$Binary;
public static synthetic fun exprBinary$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Expr$Binary$Op;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Binary;
public final fun exprCall (Lorg/partiql/ast/Identifier;Ljava/util/List;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$Call;
public static synthetic fun exprCall$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Ljava/util/List;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Call;
public final fun exprCall (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$Call;
public static synthetic fun exprCall$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$Call;
public final fun exprCanCast (Lorg/partiql/ast/Expr;Lorg/partiql/ast/Type;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$CanCast;
public static synthetic fun exprCanCast$default (Lorg/partiql/ast/builder/AstBuilder;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Type;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/partiql/ast/Expr$CanCast;
public final fun exprCanLosslessCast (Lorg/partiql/ast/Expr;Lorg/partiql/ast/Type;Lkotlin/jvm/functions/Function1;)Lorg/partiql/ast/Expr$CanLosslessCast;
Expand Down Expand Up @@ -4497,22 +4473,6 @@ public final class org/partiql/ast/builder/ExcludeStepStructWildcardBuilder {
public final fun build ()Lorg/partiql/ast/Exclude$Step$StructWildcard;
}

public final class org/partiql/ast/builder/ExprAggBuilder {
public fun <init> ()V
public fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)V
public synthetic fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun args (Ljava/util/List;)Lorg/partiql/ast/builder/ExprAggBuilder;
public final fun build ()Lorg/partiql/ast/Expr$Agg;
public final fun function (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/builder/ExprAggBuilder;
public final fun getArgs ()Ljava/util/List;
public final fun getFunction ()Lorg/partiql/ast/Identifier;
public final fun getSetq ()Lorg/partiql/ast/SetQuantifier;
public final fun setArgs (Ljava/util/List;)V
public final fun setFunction (Lorg/partiql/ast/Identifier;)V
public final fun setSetq (Lorg/partiql/ast/SetQuantifier;)V
public final fun setq (Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/builder/ExprAggBuilder;
}

public final class org/partiql/ast/builder/ExprBagOpBuilder {
public fun <init> ()V
public fun <init> (Lorg/partiql/ast/SetOp;Lorg/partiql/ast/Expr;Lorg/partiql/ast/Expr;Ljava/lang/Boolean;)V
Expand Down Expand Up @@ -4569,15 +4529,18 @@ public final class org/partiql/ast/builder/ExprBinaryBuilder {

public final class org/partiql/ast/builder/ExprCallBuilder {
public fun <init> ()V
public fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;)V
public synthetic fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;)V
public synthetic fun <init> (Lorg/partiql/ast/Identifier;Ljava/util/List;Lorg/partiql/ast/SetQuantifier;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun args (Ljava/util/List;)Lorg/partiql/ast/builder/ExprCallBuilder;
public final fun build ()Lorg/partiql/ast/Expr$Call;
public final fun function (Lorg/partiql/ast/Identifier;)Lorg/partiql/ast/builder/ExprCallBuilder;
public final fun getArgs ()Ljava/util/List;
public final fun getFunction ()Lorg/partiql/ast/Identifier;
public final fun getSetq ()Lorg/partiql/ast/SetQuantifier;
public final fun setArgs (Ljava/util/List;)V
public final fun setFunction (Lorg/partiql/ast/Identifier;)V
public final fun setSetq (Lorg/partiql/ast/SetQuantifier;)V
public final fun setq (Lorg/partiql/ast/SetQuantifier;)Lorg/partiql/ast/builder/ExprCallBuilder;
}

public final class org/partiql/ast/builder/ExprCanCastBuilder {
Expand Down Expand Up @@ -6406,8 +6369,6 @@ public abstract class org/partiql/ast/sql/SqlDialect : org/partiql/ast/visitor/A
public fun visitExcludeStepStructField (Lorg/partiql/ast/Exclude$Step$StructField;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitExcludeStepStructWildcard (Lorg/partiql/ast/Exclude$Step$StructWildcard;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExcludeStepStructWildcard (Lorg/partiql/ast/Exclude$Step$StructWildcard;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitExprAgg (Lorg/partiql/ast/Expr$Agg;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprAgg (Lorg/partiql/ast/Expr$Agg;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitExprBagOp (Lorg/partiql/ast/Expr$BagOp;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprBagOp (Lorg/partiql/ast/Expr$BagOp;Lorg/partiql/ast/sql/SqlBlock;)Lorg/partiql/ast/sql/SqlBlock;
public synthetic fun visitExprBetween (Lorg/partiql/ast/Expr$Between;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -6681,8 +6642,6 @@ public abstract class org/partiql/ast/util/AstRewriter : org/partiql/ast/visitor
public fun visitExcludeStepStructField (Lorg/partiql/ast/Exclude$Step$StructField;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitExcludeStepStructWildcard (Lorg/partiql/ast/Exclude$Step$StructWildcard;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExcludeStepStructWildcard (Lorg/partiql/ast/Exclude$Step$StructWildcard;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitExprAgg (Lorg/partiql/ast/Expr$Agg;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprAgg (Lorg/partiql/ast/Expr$Agg;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitExprBagOp (Lorg/partiql/ast/Expr$BagOp;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprBagOp (Lorg/partiql/ast/Expr$BagOp;Ljava/lang/Object;)Lorg/partiql/ast/AstNode;
public synthetic fun visitExprBetween (Lorg/partiql/ast/Expr$Between;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -7013,7 +6972,6 @@ public abstract class org/partiql/ast/visitor/AstBaseVisitor : org/partiql/ast/v
public fun visitExcludeStepStructField (Lorg/partiql/ast/Exclude$Step$StructField;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExcludeStepStructWildcard (Lorg/partiql/ast/Exclude$Step$StructWildcard;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExpr (Lorg/partiql/ast/Expr;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprAgg (Lorg/partiql/ast/Expr$Agg;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprBagOp (Lorg/partiql/ast/Expr$BagOp;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprBetween (Lorg/partiql/ast/Expr$Between;Ljava/lang/Object;)Ljava/lang/Object;
public fun visitExprBinary (Lorg/partiql/ast/Expr$Binary;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -7207,7 +7165,6 @@ public abstract interface class org/partiql/ast/visitor/AstVisitor {
public abstract fun visitExcludeStepStructField (Lorg/partiql/ast/Exclude$Step$StructField;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitExcludeStepStructWildcard (Lorg/partiql/ast/Exclude$Step$StructWildcard;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitExpr (Lorg/partiql/ast/Expr;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitExprAgg (Lorg/partiql/ast/Expr$Agg;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitExprBagOp (Lorg/partiql/ast/Expr$BagOp;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitExprBetween (Lorg/partiql/ast/Expr$Between;Ljava/lang/Object;)Ljava/lang/Object;
public abstract fun visitExprBinary (Lorg/partiql/ast/Expr$Binary;Ljava/lang/Object;)Ljava/lang/Object;
Expand Down
39 changes: 21 additions & 18 deletions partiql-ast/src/main/kotlin/org/partiql/ast/helpers/ToLegacyAst.kt
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,29 @@ private class AstTranslator(val metas: Map<String, MetaContainer>) : AstBaseVisi
}
val funcName = (node.function as Identifier.Symbol).symbol.lowercase()
val args = node.args.translate<PartiqlAst.Expr>(ctx)
call(funcName, args, metas)
when (funcName.isAggregateCall() || node.setq != null) { // Use existing assumption that function call with set quantifier is an aggregation function
true -> {
val setq = node.setq?.toLegacySetQuantifier() ?: all()
// COUNT(*) is represented as COUNT() in default AST
// Legacy AST translates COUNT(*) to COUNT(1)
if (funcName == "count" && args.isEmpty()) {
return callAgg(setq, "count", lit(ionInt(1)), metas)
}
// Default Case
if (node.args.size != 1) {
error("Cannot translate `call_agg` with more than one argument")
}
val arg = visitExpr(node.args[0], ctx)
callAgg(setq, funcName, arg, metas)
}
false -> call(funcName, args, metas)
}
}

override fun visitExprAgg(node: Expr.Agg, ctx: Ctx) = translate(node) { metas ->
val setq = node.setq?.toLegacySetQuantifier() ?: all()
// Legacy AST translates COUNT(*) to COUNT(1)
if (node.function is Identifier.Symbol && (node.function as Identifier.Symbol).symbol == "COUNT_STAR") {
return callAgg(setq, "count", lit(ionInt(1)), metas)
}
// Default Case
if (node.args.size != 1) {
error("Legacy `call_agg` must have exactly one argument")
}
if (node.function is Identifier.Qualified) {
error("Qualified identifiers are not allowed in legacy AST `call_agg` function identifiers")
}
// Legacy parser/ast always inserts ALL quantifier
val funcName = (node.function as Identifier.Symbol).symbol.lowercase()
val arg = visitExpr(node.args[0], ctx)
callAgg(setq, funcName, arg, metas)
private fun String.isAggregateCall(): Boolean {
// like PartiQLPigVisitor, keep legacy behavior the same as before
// since it is legacy, hard-coded aggregation logic
return listOf("count", "avg", "sum", "min", "max", "any", "some", "every").contains(this)
}

override fun visitExprUnary(node: Expr.Unary, ctx: Ctx) = translate(node) { metas ->
Expand Down
11 changes: 2 additions & 9 deletions partiql-ast/src/main/kotlin/org/partiql/ast/sql/SqlDialect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,10 @@ public abstract class SqlDialect : AstBaseVisitor<SqlBlock, SqlBlock>() {
override fun visitExprPathStepUnpivot(node: Expr.Path.Step.Unpivot, head: SqlBlock): SqlBlock = head concat r(".*")

override fun visitExprCall(node: Expr.Call, head: SqlBlock): SqlBlock {
var h = head
h = visitIdentifier(node.function, h)
h = h concat list { node.args }
return h
}

override fun visitExprAgg(node: Expr.Agg, head: SqlBlock): SqlBlock {
var h = head
val f = node.function
// Special case
if (f is Identifier.Symbol && f.symbol == "COUNT_STAR") {
// Special case -- COUNT() maps to COUNT(*)
if (f is Identifier.Symbol && f.symbol == "COUNT" && node.args.isEmpty()) {
return h concat r("COUNT(*)")
}
val start = if (node.setq != null) "(${node.setq.name} " else "("
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,13 @@ internal abstract class InternalSqlDialect : AstBaseVisitor<InternalSqlBlock, In
override fun visitExprPathStepUnpivot(node: Expr.Path.Step.Unpivot, tail: InternalSqlBlock): InternalSqlBlock = tail concat ".*"

override fun visitExprCall(node: Expr.Call, tail: InternalSqlBlock): InternalSqlBlock {
var t = tail
t = visitIdentifier(node.function, t)
t = t concat list { node.args }
return t
}

override fun visitExprAgg(node: Expr.Agg, tail: InternalSqlBlock): InternalSqlBlock {
var t = tail
val f = node.function
// Special case
if (f is Identifier.Symbol && f.symbol == "COUNT_STAR") {
// Special case -- COUNT() maps to COUNT(*)
if (f is Identifier.Symbol && f.symbol == "COUNT" && node.args.isEmpty()) {
return t concat "COUNT(*)"
}
val start = if (node.setq != null) "(${node.setq!!.name} " else "("
val start = if (node.setq != null) "(${node.setq.name} " else "("
t = visitIdentifier(f, t)
t = t concat list(start) { node.args }
return t
Expand Down
10 changes: 2 additions & 8 deletions partiql-ast/src/main/resources/partiql_ast.ion
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,11 @@ expr::[
],
},

// Scalar Function Call
// Function Call (both scalar + aggregate)
call::{
function: identifier,
args: list::[expr],
},

// Aggregate Function Call
agg::{
function: identifier,
args: list::[expr],
setq: optional::set_quantifier,
setq: optional::set_quantifier
},

// Parameter `?`
Expand Down
Loading

0 comments on commit 5d1a779

Please sign in to comment.