解析异常-org.apache.spark.sql.catalyst.parser.parseexception:

7xzttuei  于 2021-05-27  发布在  Spark
关注(0)|答案(1)|浏览(929)

我正在运行下面的sql,但出现了一个错误,
“不匹配的输入'r'应为(第1行,位置17)”scala>hivecontext.sql(“选择case when r.code in'0000'then''else'xyz'end from test.reporting r left join test.exclude i on r.id=i.id left join test.region c on r.name=c.name where r.id is null limit 10”).show
这看起来是case语句的一个问题,好像我删除了case语句,它工作正常。有人能帮我吗?

1cosmwyk

1cosmwyk1#

In 必须更改列表/数组 r.code in ‘0000’r.code = ‘0000’ (或) r.code in (‘0000’) ```
hiveContext.sql("select case when r.code in (‘0000’) then ‘ABC’ else ‘XYZ’ end from test.reporting r left join test.exclude i on r.id = i.id LEFT JOIN test.region c ON r.name = c.name where r.id IS NULL limit 10").show

相关问题