spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yana <yana.kadiy...@gmail.com>
Subject RE: Does SparkSQL support "..... having count (fieldname)" in SQL statement?
Date Wed, 04 Mar 2015 12:47:22 GMT
I think the problem is that you are using an alias in the having clause. I am not able to try
just now but see if HAVING count (*)> 2 works ( ie dont use cnt)


Sent on the new Sprint Network from my Samsung Galaxy S®4.

<div>-------- Original message --------</div><div>From: shahab <shahab.mokari@gmail.com>
</div><div>Date:03/04/2015  7:22 AM  (GMT-05:00) </div><div>To: user@spark.apache.org
</div><div>Subject: Does SparkSQL support "..... having count (fieldname)" in
SQL statement? </div><div>
</div>Hi,

It seems that SparkSQL, even the HiveContext, does not support SQL statements like :   SELECT
category, count(1) AS cnt FROM products GROUP BY category HAVING cnt > 10;

I get this exception:

Error: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Unresolved attributes:
CAST(('cnt < 2), BooleanType), tree:


I couldn't find anywhere is documentation whether "having" keyword is not supported ?
If this is the case, what would be the work around? using two nested select statements?

best,
/Shahab
Mime
View raw message