Try like this
SELECT name, case when ts>0 then price else 0 end from table
On Sun, May 17, 2015 at 12:21 AM, Antony Mayi
wrote:
> Hi,
>
> is it expected I can't reference a column inside of IF statement like this:
>
> sctx.sql("SELECT name, IF(ts>0, price, 0) FROM table").collect()
>
> I get an
Hi,
is it expected I can't reference a column inside of IF statement like this:
sctx.sql("SELECT name, IF(ts>0, price, 0) FROM table").collect()
I get an error:
org.apache.spark.sql.AnalysisException: unresolved operator 'Project [name#0,if
((CAST(ts#1, DoubleType) > CAST(0, DoubleType))) price#2