Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8926

Date type column of CONNECT CSV table type fails to return result on equal matches

Details

    Description

      CONNECT's CSV table type does not return matching result for `date` type on an equal match. It does return the matching results on greater-than matches, but not on less-than matches.

      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 5
      Server version: 10.0.21-MariaDB mariadb.org binary distribution
       
      Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> use test
      Database changed
      MariaDB [test]> create table foo_csv(col1 date) engine=CONNECT table_type=CSV fi
      le_name='C:/temp/foo.csv';
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]>
      MariaDB [test]> insert into foo_csv(col1)
          -> values   ('2015-01-01'),
          ->                  ('2015-02-01'),
          ->                  ('2015-03-01'),
          ->                  ('2015-04-01');
      Query OK, 4 rows affected (0.00 sec)
      Records: 4  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> select * from foo_csv\G
      *************************** 1. row ***************************
      col1: 2015-01-01
      *************************** 2. row ***************************
      col1: 2015-02-01
      *************************** 3. row ***************************
      col1: 2015-03-01
      *************************** 4. row ***************************
      col1: 2015-04-01
      4 rows in set (0.00 sec)
       
      MariaDB [test]> select * from foo_csv where col1 = '2015-02-01'\G
      Empty set (0.00 sec)
       
      MariaDB [test]> select * from foo_csv where col1 > '2015-02-01'\G
      *************************** 1. row ***************************
      col1: 2015-03-01
      *************************** 2. row ***************************
      col1: 2015-04-01
      2 rows in set (0.00 sec)
       
      MariaDB [test]>

      Attachments

        Activity

          This is not specific to the CSV CONNECT table type. It is caused by a bug in the condition pushdown feature (called with the constant type as string instead of date value) that is partially fixed in MariaDB 10.1.8 (but only for equality).
          It will be temporarily fixed in CONNECT by not using condition pushdown when a date column is involved.
          Unfortunately, it is no more possible to disable engine_condition_pushdown. However, a workaround exist. instead of saying

          select * from foo_csv where col1 = '2015-02-01';

          you can say:

          select * from foo_csv where col1 = date('2015-02-01');

          This will work with any comparison operators.

          bertrandop Olivier Bertrand added a comment - This is not specific to the CSV CONNECT table type. It is caused by a bug in the condition pushdown feature (called with the constant type as string instead of date value) that is partially fixed in MariaDB 10.1.8 (but only for equality). It will be temporarily fixed in CONNECT by not using condition pushdown when a date column is involved. Unfortunately, it is no more possible to disable engine_condition_pushdown. However, a workaround exist. instead of saying select * from foo_csv where col1 = '2015-02-01'; you can say: select * from foo_csv where col1 = date('2015-02-01'); This will work with any comparison operators.

          People

            bertrandop Olivier Bertrand
            Tuco Tuco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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