help,在用 isDuplicated去重查询时报错

如下所示,我按secode和securityid对分布式表t_dk_day_zz985 进行去重查询:

tt = select secode,securityid as instrument from t_dk_day_zz985 where tradetime between 2018.01.01 : 2021.05.31 and isDuplicated([ secode, securityid ], FIRST) == false

但执行时报错了,提示信息如下:

 The where clause [tradetime between 2018.01.01 : 2021.05.31 and isDuplicated([ secode, securityid ], FIRST) == 0] of a distributed/partitioned sql shouldn't use any aggregate or order-sensitive function.

其中tradetime 和securityid分别表示日期和股票代码,是分区列。

请先 登录 后评论

1 个回答

wale

上述报错是说不支持在分布式表查询的 where 子句中使用聚合函数或者序列相关函数进行条件过滤。解决问题的办法是使用map子句。跨分区查询时,指定 map关键字,SQL 语句就会在每个分区内分别执行,然后输出每个分区的执行结果

tt = select secode,securityid as instrument from t_dk_day_zz985 where tradetime between 2018.01.01 : 2021.05.31 and isDuplicated([ secode, securityid ], FIRST) == false map


请先 登录 后评论