From d71b5be03447a9f2dfc0090877fe590824910251 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 5 Apr 2015 15:57:01 +0300 Subject: [PATCH] cql3: enable cql3 function-in-select path --- cql3/Cql.g | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cql3/Cql.g b/cql3/Cql.g index a01a61c2aa..03617b80a9 100644 --- a/cql3/Cql.g +++ b/cql3/Cql.g @@ -364,8 +364,8 @@ unaliasedSelector returns [shared_ptr s] #if 0 | K_WRITETIME '(' c=cident ')' { tmp = new Selectable.WritetimeOrTTL.Raw(c, true); } | K_TTL '(' c=cident ')' { tmp = new Selectable.WritetimeOrTTL.Raw(c, false); } - | f=functionName args=selectionFunctionArgs { tmp = new Selectable.WithFunction.Raw(f, args); } #endif + | f=functionName args=selectionFunctionArgs { tmp = ::make_shared(std::move(f), std::move(args)); } ) #if 0 ( '.' fi=cident { tmp = new Selectable.WithFieldSelection.Raw(tmp, fi); } )* @@ -373,14 +373,14 @@ unaliasedSelector returns [shared_ptr s] { $s = tmp; } ; -#if 0 -selectionFunctionArgs returns [List a] - : '(' ')' { $a = Collections.emptyList(); } - | '(' s1=unaliasedSelector { List args = new ArrayList(); args.add(s1); } - ( ',' sn=unaliasedSelector { args.add(sn); } )* - ')' { $a = args; } +selectionFunctionArgs returns [std::vector> a] + : '(' ')' + | '(' s1=unaliasedSelector { a.push_back(std::move(s1)); } + ( ',' sn=unaliasedSelector { a.push_back(std::move(sn)); } )* + ')' ; +#if 0 selectCountClause returns [List expr] @init{ ColumnIdentifier alias = new ColumnIdentifier("count", false); } : K_COUNT '(' countArgument ')' (K_AS c=ident { alias = c; })? { $expr = new ArrayList(); $expr.add( new RawSelector(new Selectable.WithFunction.Raw(FunctionName.nativeFunction("countRows"), Collections.emptyList()), alias));}