Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
3.1.15
-
None
-
None
-
None
Description
Hello,
I have a PowerBI model composed of 2 tables connected to MariaDB:
- DIM_DATE - Import mode
- FACT_TRAN - DirectQuery mode
The 2 tables have a relation using Date_SK, which is of int datatype in both tables.
I've added a slicer with a date range, using [Date] column (datatype is date) from DIM_DATE table.
When I select a single date in the slicer, the query submitted to the fact table does a CAST() in the WHERE clause which prevents usage of the index in the fact table.
select count(1) as `C1`
from
(
select `TRAN_ID`
from `FACT_TRAN`
where cast(`TRAN_DATE_SK` as INTEGER) = 20220303
) as `IT
However, when I select a date range greater than 1 date the CAST() isn't applied anymore.
select count(1) as `C1`
from
(
select `TRAN_ID`
from `FACT_TRAN`
where `TRAN_DATE_SK` in (20220303, 20220304, 20220305, 20220306, 20220307, 20220308)
) as `ITBL`
You can easily reproduce this case.
I'm using latest version of Power BI Desktop and MariaDB Connector for PowerBI.
Please can you fix this bug so that when selecting a single date in the slicer there will be no cast in the WHERE clause anymore, which prevents index use,
Thanks.
Attachments
Issue Links
- relates to
-
ODBC-409 PowerBI measure with text filter raises SQL syntax error
-
- Open
-
Thank you for your report. Are you sure, that the problem is in the connector, and not in the Power BI? Since it works fine on single day, it feels like metadata provided by the connector is correct, but on multiple dates the query, generated by Power BI is wrong. The connector itself doesn't do that - we only provide information on tables, fields, types. And that information used by Power BI to create queries. It's still can be some wrong metadata from our side, but atm I can't think of anything, since, again, with single date it works fine.