gpt4 book ai didi

scala - Spark 查询 : unclosed character literal

转载 作者:行者123 更新时间:2023-12-01 11:08:00 27 4
gpt4 key购买 nike

我使用 Hive SQL 使用 spark 执行此查询:

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")
但我收到此错误:
<console>:1: error: unclosed character literal
where shipdate <= '1990-09-16' group by linestatus order by
你知道为什么吗?

最佳答案

Scala 中的多行字符串必须使用三引号括起来:

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""")

关于scala - Spark 查询 : unclosed character literal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36410061/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com