S02042
错误代码
S02042
报错信息
Distributed queries do not support the ‘exists’ keyword. RefId:S02042
错误原因
在分布式表查询中,WHERE 子句不支持 EXISTS 关键字。以下示例将导致错误:
dbName = "dfs://test"
if (existsDatabase(dbName)) {
dropDatabase(dbName)
}
t = table(2023.01.01..2023.01.03 as tradeDate)
db = database(dbName, VALUE, 2023.01.01..2023.01.03)
pt = db.createPartitionedTable(t, `pt, `tradeDate)
pt.append!(t)
select * from pt where exists(select * from t where t.tradeDate=pt.tradeDate)
解决办法
将上面的查询语句修改为如下语句:
select pt.* from pt left semijoin t on t.tradeDate=pt.tradeDate where t.tradeDate!=NULL