brownsys/K9db

Weird interaction between filter optimization and keys in planner/calcite

KinanBab opened this issue · 0 comments

Calcite opt rules understand when columns are supposed to be equal (on joins) and pushes conditions on one of them below the join on both branches, making both columns keys in cases where one of them is conditioned on with ?

If the other column is ever dropped, Pelton throws an error as it believes a key was dropped.

Example:

CREATE TABLE art (id int NOT NULL PRIMARY KEY, title varchar(16) NOT NULL) ENGINE = ROCKSDB;
CREATE TABLE vt (id int PRIMARY KEY AUTO_INCREMENT, u int NOT NULL, article_id int NOT NULL) ENGINE = ROCKSDB;
CREATE VIEW  vn AS '"\
SELECT art.id, art.title, count(*) as votes \
FROM art \
JOIN vt ON art.id = vt.article_id \
GROUP BY art.id, art.title, vt.article_id \
HAVING art.id = ?"';