Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7340

Filter is not pushed to JDBC database when several databases are used in the query

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.16.0
    • Fix Version/s: 1.18.0
    • Component/s: Storage - JDBC
    • Labels:
      None

      Description

      For the case when several databases are used in the query, some rules weren't added to the rule set for one of the conventions. It is observed in queries similar to the next query:

      select * from mysql.`drill_mysql_test`.person t1
      INNER JOIN h2.drill_h2_test.person t2 on t1.person_id = t2.person_id where t1.first_name = 'first_name_1' and t2.last_name = 'last_name_1
      

      Plan for this query is the following:

      00-00    Screen
      00-01      Project(person_id=[$0], first_name=[$1], last_name=[$2], address=[$3], city=[$4], state=[$5], zip=[$6], json=[$7], bigint_field=[$8], smallint_field=[$9], numeric_field=[$10], boolean_field=[$11], double_field=[$12], float_field=[$13], real_field=[$14], time_field=[$15], timestamp_field=[$16], date_field=[$17], datetime_field=[$18], year_field=[$19], text_field=[$20], tiny_text_field=[$21], medium_text_field=[$22], long_text_field=[$23], blob_field=[$24], bit_field=[$25], enum_field=[$26], PERSON_ID0=[$27], FIRST_NAME0=[$28], LAST_NAME0=[$29], ADDRESS0=[$30], CITY0=[$31], STATE0=[$32], ZIP0=[$33], JSON0=[$34], BIGINT_FIELD0=[$35], SMALLINT_FIELD0=[$36], NUMERIC_FIELD0=[$37], BOOLEAN_FIELD0=[$38], DOUBLE_FIELD0=[$39], FLOAT_FIELD0=[$40], REAL_FIELD0=[$41], TIME_FIELD0=[$42], TIMESTAMP_FIELD0=[$43], DATE_FIELD0=[$44], CLOB_FIELD=[$45])
      00-02        HashJoin(condition=[=($0, $27)], joinType=[inner], semi-join: =[false])
      00-03          Project(PERSON_ID0=[$0], FIRST_NAME0=[$1], LAST_NAME0=[$2], ADDRESS0=[$3], CITY0=[$4], STATE0=[$5], ZIP0=[$6], JSON0=[$7], BIGINT_FIELD0=[$8], SMALLINT_FIELD0=[$9], NUMERIC_FIELD0=[$10], BOOLEAN_FIELD0=[$11], DOUBLE_FIELD0=[$12], FLOAT_FIELD0=[$13], REAL_FIELD0=[$14], TIME_FIELD0=[$15], TIMESTAMP_FIELD0=[$16], DATE_FIELD0=[$17], CLOB_FIELD=[$18])
      00-05            SelectionVectorRemover
      00-06              Filter(condition=[=($2, 'last_name_1')])
      00-07                Jdbc(sql=[SELECT * FROM "TMP"."DRILL_H2_TEST"."PERSON" ])
      00-04          Jdbc(sql=[SELECT * FROM `drill_mysql_test`.`person` WHERE `first_name` = 'first_name_1' ])
      

      DrillJdbcFilterRule wasn't applied for H2 convention and Filter wasn't pushed to H2 database.

      This issue may be fixed by specifying JdbcConvention in rules descriptions in Drill DrillJdbcFilterRule and DrillJdbcProjectRule rules and other rules should be fixed in Calcite in the scope of CALCITE-3115.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ihuzenko Igor Guzenko
                Reporter:
                volodymyr Vova Vysotskyi
                Reviewer:
                Vova Vysotskyi
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: