apache / apache/druid

RequireTimeCondition does not handle complex joins

Open
#17,407 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

Enabling druid.sql.planner.requireTimeCondition results in valid join queries being blocked.
Example -

SELECT distinct T1.dim1, T2.dim2 FROM
(SELECT dim1 from druid.foo WHERE dim1 <> '' AND __time >= '2000-01-01') AS T1,
(SELECT dim2 from druid.foo WHERE dim1 <> '' AND __time >= '2000-02-01') AS T2
WHERE T1.dim1=T2.dim2

Both the nested queries have a time filter for the above inner join, however the requireTimeCondition logic is looking for a time filter on the top level query.

Contributor guide

Open the contributing guide

Research direction

Reproduce the supplied join query with druid.sql.planner.requireTimeCondition enabled, then trace the RequireTimeCondition logic in the SQL planner. Compare its handling of nested subqueries with a query lacking time filters; done means valid joins whose inner queries each have time filters are allowed without weakening rejection of unsafe queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.