You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Johannes Zillmann <jz...@101tec.com> on 2008/03/02 05:23:35 UTC
count function in split statement
Hi there,
just wondering if something like this is/should be possible ? :
A=
(a, {(a, 1), (a, 2), (a, 3)})
(a, {})
split A into B if (count($1)==3), C;
Trying this gives me an exception:
Caused by: org.apache.pig.impl.logicalLayer.parser.ParseException: could
not instantiate 'count' with arguments '[]'
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.EvalFunction(QueryParser.java:2597)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.FuncEvalSpec(QueryParser.java:2134)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseEvalSpec(QueryParser.java:2010)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.UnaryExpr(QueryParser.java:1955)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.MultiplicativeExpr(QueryParser.java:1886)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.AdditiveExpr(QueryParser.java:1818)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.InfixExpr(QueryParser.java:1786)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PUnaryCond(QueryParser.java:890)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PAndCond(QueryParser.java:835)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.POrCond(QueryParser.java:785)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PCond(QueryParser.java:753)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PUnaryCond(QueryParser.java:887)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PAndCond(QueryParser.java:835)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.POrCond(QueryParser.java:785)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.PCond(QueryParser.java:753)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.SplitClause(QueryParser.java:295)
at
org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.java:249)
at
org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBuilder.java:47)
at org.apache.pig.PigServer.registerQuery(PigServer.java:237)
... 17 more
Johanne
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany
http://www.101tec.com
Re: count function in split statement
Posted by Johannes Zillmann <jz...@101tec.com>.
Ok, discovered that i have to use "count" in upper-case.
Then it works!
Johannes
Johannes Zillmann wrote:
> Hi there,
>
> just wondering if something like this is/should be possible ? :
> A=
> (a, {(a, 1), (a, 2), (a, 3)})
> (a, {})
> split A into B if (count($1)==3), C;
>
> Trying this gives me an exception:
> Caused by: org.apache.pig.impl.logicalLayer.parser.ParseException:
> could not instantiate 'count' with arguments '[]'
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.EvalFunction(QueryParser.java:2597)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.FuncEvalSpec(QueryParser.java:2134)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.BaseEvalSpec(QueryParser.java:2010)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.UnaryExpr(QueryParser.java:1955)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.MultiplicativeExpr(QueryParser.java:1886)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.AdditiveExpr(QueryParser.java:1818)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.InfixExpr(QueryParser.java:1786)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.PUnaryCond(QueryParser.java:890)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.PAndCond(QueryParser.java:835)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.POrCond(QueryParser.java:785)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.PCond(QueryParser.java:753)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.PUnaryCond(QueryParser.java:887)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.PAndCond(QueryParser.java:835)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.POrCond(QueryParser.java:785)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.PCond(QueryParser.java:753)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.SplitClause(QueryParser.java:295)
>
> at
> org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.java:249)
>
> at
> org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBuilder.java:47)
>
> at org.apache.pig.PigServer.registerQuery(PigServer.java:237)
> ... 17 more
>
> Johanne
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101tec GmbH
Halle (Saale), Saxony-Anhalt, Germany
http://www.101tec.com