hi
the most lastest release (0.6.3) have a problem parsing COUNT(DISTINCT col) function
I check into the JSqlParser.jj file, and I have a *hack* to make the parser parse that func correctly
in Function()
"("[["ALL"|"DISTINCT"({distinct=true;})](expressionList=SimpleExpressionList()|"*"{retval.setAllColumns(true);})]")"["}"]{if(distinct){Objectexp=expressionList.getExpressions().remove(0);if(!(expinstanceofColumn)){thrownewParseException("DISTINCT can only be used in an aggregate function,eg. sum,count");}Columncolumn=(Column)exp;DistinctExpressionde=newDistinctExpression(column.toString());expressionList.getExpressions().add(de);}
it's not an elegant solutions(sorry, I'm new to javacc), but it works for count(distinct col), and passes all your testcases.
I hope you can give a better solution.
br
hanzheng
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi
the most lastest release (0.6.3) have a problem parsing COUNT(DISTINCT col) function
I check into the JSqlParser.jj file, and I have a *hack* to make the parser parse that func correctly
in Function()
here's the DistinctExpression.java
it's not an elegant solutions(sorry, I'm new to javacc), but it works for count(distinct col), and passes all your testcases.
I hope you can give a better solution.
br
hanzheng
should be fixed in 0.6.4, with a different approach (Function now has isDistinct())
thanks for replying.
good job!
htbH7F <a href="http://fksdzxzjxqal.com/">fksdzxzjxqal</a>, vprhjpizycwm, cetldijsllgh, http://vsdgawwwcccf.com/
comment3,
comment2,
comment2,
comment6,
comment5,
comment5,
comment2,
comment5,
comment1,
comment2,
comment4,
comment2,
comment1,
comment4,
comment1,
comment1,
comment3,
comment6,
comment5,
comment6,
comment1,