clickhousebook icon indicating copy to clipboard operation
clickhousebook copied to clipboard

第九章 JOIN 查询 9.5.1 ASOF 连接精度的问题

Open LeoWuxg opened this issue 4 years ago • 1 comments

ASOF SQL示例: SELECT a.id, a.name, b.rate, a.time, b.time FROM join_tb1 AS a ASOF INNER JOIN join_tb2 AS b ON a.id = b.id AND a.time = b.time 该SQL 执行失败:(SQL工具 DBeaver) SQL 错误 [403]: ClickHouse exception, code: 403, host: 10.202.249.105, port: 8123; Code: 403, e.displayText() = DB::Exception: No inequality in ASOF JOIN ON section. (version 20.4.4.18 (official build))

书中表述: 而紧随其后的 a.time = b.time 则是 asof_column模糊连接条件,这条语句的语义等同于: a.id = b.id AND a.time >= b.time.

我觉的好像不是这样,将 最上面的SQL中 a.time = b.time 替换为 a.time >= b.time 则能执行成功。 说明 a.time = b.time 在语义上不等于 a.time >= b.time 是由于 ClickHouse 版本升级的原因吗

LeoWuxg avatar Nov 19 '20 02:11 LeoWuxg

还有个地方有问题,184页的“代码清单9-2”里没有rate=105的记录,在185页怎么可能联结产生rate=105的记录呢。

movingheart avatar Aug 17 '21 06:08 movingheart