When I try write Spark SQL with bit()
, it result in an error.
Code
val tpos_dfr = sqlContext.sql("SELECT idcustomer, quantity, CASE WHEN quantity < 0 THEN 1::bit(1) ELSE 0::bit(1) END as isthisreturn FROM pointofsale WHERE iddataloadmanager = 10 and quantity <> 0")
Error
Exception in thread "main" org.apache.spark.sql.catalyst.parser.ParseException:
extraneous input 'quantity' expecting {, ',', 'FROM', 'WHERE', GROUP', 'ORDER', 'HAVING', 'LIMIT', 'LATERAL', 'WINDOW', 'UNION', 'EXCEPT', 'INTERSECT', 'SORT', 'CLUSTER', 'DISTRIBUTE'}(line 1, pos 122)