Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-358

PowerBI mixed mode SQL with cast() in WHERE clause

    XMLWordPrintable

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

          Activity

            People

              Lawrin Lawrin Novitsky
              astelian Adi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.