Im executing this query with spark using HiveQL:
var hiveContext = new org.apache.spark.sql.hive.HiveContext(sc)
result = hiveContext.sql("select linestatus, sum(quantity) as sum_qty,count(*) as count_order from lineitem
where shipdate <= '1990-09-16' group by linestatus order by
linestatus")
But Im getting this error:
<console>:1: error: unclosed character literal
where shipdate <= '1990-09-16' group by linestatus order by
Do you know understand why?
答案 0 :(得分:5)
Multiline strings in Scala have to be enclosed using triple quotes:
hiveContext.sql("""
select linestatus, sum(quantity) as sum_qty,count(*) as count_order
from lineitem
where shipdate <= '1990-09-16' group by linestatus order by linestatus""")