情况
在presto中使用查询语句如下:
select id from table where id in array[1,2,3];
报错如下:
select id from table where id in array[1,2,3];
mismatched input 'in' expecting {<EOF>, 'AND', 'EXCEPT', 'GROUP', 'HAVING', 'INTERSECT', 'LIMIT', 'OR', 'ORDER', 'UNION'}
原因
mismatched input ‘in’ expecting 含义为 in不是关键词,无法识别。
解决方案
需要使用contains关键词替换in的用法
使用语句如下:
Select id from table where contains(ARRAY[1,2,3], id) ;
详细的原因解释可查看文档
https://prestodb.io/docs/current/functions/array.html