[MCOL-430] invalid null date values for cross engine join query Created: 2016-12-02  Updated: 2017-08-04  Resolved: 2016-12-06

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: 1.0.5
Fix Version/s: 1.0.6

Type: Bug Priority: Major
Reporter: David Thompson (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
includes MCOL-433 Small row results can cause CrossEngi... Closed
Sprint: 2016-23, 2016-24

 Description   

For the following query pattern and data setup, the results will sometimes get corrupted with 0 date values. The query does not fall into the normal star schema model. In addition the issues only appears to happen with more than 8k rows and likely related to the id value in junk. Repro steps:

CREATE TABLE `junk` (
  `id` int(11) DEFAULT NULL,
  `dt` date DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=latin1;
 
CREATE TABLE `junk_inno` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `dt` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16385 DEFAULT CHARSET=latin1;
 
insert into junk values (6071, "2016-11-17");
 
insert into junk_inno values (0, FROM_UNIXTIME(UNIX_TIMESTAMP('2015-01-01 00:00:00') + FLOOR(0 + (RAND() * 63072000))));
 
--  repeat the following until 8192 rows inserted (resulting in 16k rows):
insert into junk_inno select 0, FROM_UNIXTIME(UNIX_TIMESTAMP('2015-01-01 00:00:00') + FLOOR(0 + (RAND() * 63072000))) from junk_inno;
 
pager grep 0000
MariaDB [dbt3]> select dt from junk_inno where id>(select ifnull(max(id),0) from junk);             16384 rows in set, 1 warning (0.03 sec)
 
MariaDB [dbt3]> select dt from junk_inno where id>(select ifnull(max(id),0) from junk);
| 0000-00-00 |
| 0000-00-00 |
| 0000-00-00 |
| 0000-00-00 |
| 0000-00-00 |
15766 rows in set, 1 warning (0.03 sec)



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2016-12-02 ]

First issue here is a buffer underflow issue in libdrizzle, this was causing leaks, hangs, etc... Once fixed we are buffering the right number of rows so there is another issue in the crossengine I'm looking into.

Comment by Andrew Hutchings (Inactive) [ 2016-12-05 ]

For testing see the description. It will either produce bad results with the wrong row count or it will hang completely on one of the fifo.h conditional mutexes without this patch.

Comment by Daniel Lee (Inactive) [ 2016-12-06 ]

Build verified: source from Github

[root@localhost columnstore]# ls
mariadb-columnstore-server
[root@localhost columnstore]# cd mariadb-columnstore-server/
[root@localhost mariadb-columnstore-server]# git show
commit 8592d353c5477940f9600566639302de9fa994c7
Merge: 3795bd4 7af4e57
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Tue Dec 6 09:49:03 2016 -0600

Merge pull request #20 from mariadb-corporation/MCOL-441

MCOL-441 Fix segfault on SP error

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit d4a601b4fbc81a5929ed5b36890e70514b96803a
Merge: cb8ffed fe381ab
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Tue Dec 6 12:26:09 2016 -0600

Merge pull request #68 from mariadb-corporation/MCOL-442

MCOL-442 Allow default zero date/datetime

Verified with mentioned test case.

MariaDB [mytest]> select dt from junk_inno where id>(select ifnull(max(id),0) from junk);
------------

dt

------------

2016-12-08
2016-09-30
2015-12-09
2016-06-08
2015-05-17
2016-07-20
2015-08-25
2015-07-31
2016-06-04
2016-12-03
2016-05-05
2015-12-10
2015-09-07
2015-08-04
2015-11-25

.
.
.

2016-09-16
2015-02-25

------------
32768 rows in set (0.10 sec)

Generated at Thu Feb 08 02:21:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.