[MDEV-8926] Date type column of CONNECT CSV table type fails to return result on equal matches Created: 2015-10-09  Updated: 2015-10-18  Resolved: 2015-10-18

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.0.15, 10.0.17, 10.0.21
Fix Version/s: 10.0.22, 10.1.9

Type: Bug Priority: Major
Reporter: Tuco Assignee: Olivier Bertrand
Resolution: Fixed Votes: 0
Labels: CONNECT
Environment:

Windows Server 2008 R2; Windows 7



 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]>



 Comments   
Comment by Olivier Bertrand [ 2015-10-18 ]

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.

Generated at Thu Feb 08 07:30:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.