Luka Zdravic created SPARK-61559:
------------------------------------
Summary: Infer filters across ASOF JOIN keys
Key: SPARK-61559
URL: https://issues.apache.org/jira/browse/SPARK-61559
Project: Spark
Issue Type: Improvement
Components: SQL
Affects Versions: 4.4.0
Reporter: Luka Zdravic
InferFiltersFromConstraints does not handle AsOfJoin, so a filter on the left
side's ON key does not reach the right side.
{code:sql}
SELECT * FROM trades t LEFT ASOF JOIN quotes q
MATCH_CONDITION (t.ts >= q.ts) ON t.cust = q.cust
WHERE t.cust % 100 = 7
{code}
Today only trades is filtered, so every quotes row is shuffled and sorted. A
quote with another cust can never match a trade, so quotes can also get q.cust
% 100 = 7 and q.cust IS NOT NULL before the join, and the result stays the same.
Proposal: infer filters across AsOfJoin from the ON condition. The right side
gets them for inner and left outer as-of joins. The left side gets them only
for inner as-of joins, because a left outer join keeps every left row.
MATCH_CONDITION is not used, and a filter that can fail is not added.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]