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 else 0 AS c1#378];
it works ok if I use value instead of column ref:
sctx.sql("SELECT name, IF(ts>0, 1, 0) FROM table").collect()

thx,Antony.

Reply via email to