我正在运行下面的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语句,它工作正常。有人能帮我吗?
1条答案
按热度按时间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