lid>>,
"dev@spark.apache.org<mailto:dev@spark.apache.org>"
mailto:dev@spark.apache.org>>,
"u...@spark.apache.org<mailto:u...@spark.apache.org>"
mailto:u...@spark.apache.org>>
Subject: Re: Spark SQL use of alias in where clause
That is corre
That is correct. Aliases in the SELECT clause can only be referenced in the
ORDER BY and HAVING clauses. Otherwise, you'll have to just repeat the
statement, like concat() in this case.
A more elegant alternative, which is probably not available in Spark SQL
yet, is to use Common Table Expressions
Maybe it's the way SQL works.
The select part is executed after the where filter is applied, so you
cannot use alias declared in select part in where clause.
Hive and Oracle behavior the same as Spark SQL.
2014-09-25 8:58 GMT+08:00 Du Li :
> Hi,
>
> The following query does not work in Shark n