Hi team,
I’m using Dremio version 25.2.0-202410241428100111-a963b970 and encountering an issue with filter pushdown behavior when querying a union of two MySQL-backed views.
I’ve created the following views:
- campaign_fct
SELECT EVNT_DATE, CAMPAIGN_NAME, DEL_CNT, SUB_CNT
FROM mysql7.Autopilot.CAMPAIGN_DATA_FACT
WHERE EVNT_DATE <= DATE_SUB(CURRENT_DATE, 2)
- campaign_trans
SELECT EVNT_DATE, CAMPAIGN_NAME, SUM(DEL_CNT), SUM(SUB_CNT)
FROM mysql7.Autopilot.CAMPAIGN_DATA_TRANS
WHERE EVNT_DATE > DATE_SUB(CURRENT_DATE, 2)
GROUP BY EVNT_DATE, CAMPAIGN_NAME
- campaign_common
SELECT * FROM “campaign_report_r&d”.“campaign_fct”
UNION ALL
SELECT * FROM “campaign_report_r&d”.“campaign_trans”
When I run the following query:
SELECT * FROM “campaign_report_r&d”.“campaign_common”
WHERE EVNT_DATE >= ‘2025-04-07’
22242fe4-11c7-4f59-8c39-068fc8a24d90-evnt-gtr-eql.zip (14.4 KB)
Only the filter is pushed to CAMPAIGN_DATA_TRANS, which is expected.
However, when I run this query:
SELECT * FROM “campaign_report_r&d”.“campaign_common”
WHERE EVNT_DATE = ‘2025-04-07’
e29f31ce-c3ec-4815-9954-bee02667a4e8-evnt-equals.zip (14.4 KB)
The EVNT_DATE filter gets pushed to both CAMPAIGN_DATA_FACT and CAMPAIGN_DATA_TRANS, which is not expected since CAMPAIGN_DATA_FACT is restricted to dates <= CURRENT_DATE - 2.
All tables and views are based on MySQL data sources.
Please find the attached query profiles for both queries for reference.
Question:
Why is the EVNT_DATE = ‘2025-04-07’ filter being pushed to both underlying sources in the union? Is this a known behavior or optimization limitation? How can we ensure filters are correctly pushed only to relevant branches of the union?
Thanks in advance!