[MCOL-840] Query answer different than MariaDB Created: 2017-07-28  Updated: 2017-09-13  Resolved: 2017-09-13

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

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

CentOS


Sprint: 2017-15, 2017-16, 2017-17, 2017-18

 Description   

working_tpch1_compareLogOnly/fnJoin.tpch11:

select ps_partkey, sum(ps_supplycost * ps_availqty) as value
from partsupp, supplier, nation
where replace(concat(ps_suppkey, 'A'), 'A', '') = s_suppkey
and 0-s_nationkey = 0-n_nationkey
and n_name = 'GERMANY'
group by ps_partkey
having sum(ps_supplycost * ps_availqty) > ( select sum(ps_supplycost * ps_availqty) * 0.0001 from partsupp, supplier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_name = 'GERMANY' )
order by value desc;

In older Columnstore versions, this caused an error:
ERROR 1815 (HY000) at line 1: Internal error: IDB-1002: 'supplier' and 'partsupp' have incompatible column type specified for join condition.

Columnstore 1.1 returns an empty set.

Run against MariaDB 10.2:

MariaDB [tpch1]> select ps_partkey, sum(ps_supplycost * ps_availqty) as value
-> from partsupp, supplier, nation
-> where replace(concat(ps_suppkey, 'A'), 'A', '') = s_suppkey
-> and 0-s_nationkey = 0-n_nationkey
-> and n_name = 'GERMANY'
-> group by ps_partkey
-> having sum(ps_supplycost * ps_availqty) > ( select sum(ps_supplycost * ps_availqty) * 0.0001 from partsupp, supplier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_name = 'GERMANY' )
-> order by value desc;
-----------------------+

ps_partkey value

-----------------------+

129760 17538456.86
166726 16503353.92
191287 16474801.97
161758 16101755.54
34452 15983844.72
139035 15907078.34
9403 15451755.62
154358 15212937.88

.
.
.
-----------------------+
1048 rows in set (18.88 sec)

MariaDB [tpch1]>



 Comments   
Comment by David Hall (Inactive) [ 2017-07-28 ]

This query has been known to not work for columnstore. I don't know why it was deemed acceptable to throw an error. But now it just returns an empty set, which is not what the query should return.

Comment by Andrew Hutchings (Inactive) [ 2017-07-28 ]

There was a valid reason for this, but I don't recall what it was. I'll look into it.

Comment by Andrew Hutchings (Inactive) [ 2017-08-01 ]

This is a bug. A case I didn't seem to anticipate in MCOL-677

Comment by Andrew Hutchings (Inactive) [ 2017-08-01 ]

Patch adds error back for the missed cases of joining a CHAR/VARCHAR with an INT as part of an expression step.

This changes 4 test results in the fnJoin, 1 was incorrect and 3 were working more by chance than anything else. There is a pull request for this too.

Longer term we need to look at supporting the joining of INT with non-INT columns. But that should be a feature request for another ticket if we don't have one already.

Comment by Andrew Hutchings (Inactive) [ 2017-08-01 ]

MCOL-695 is for tracking the CHAR/VARCHAR to INT join.

Comment by Daniel Lee (Inactive) [ 2017-09-13 ]

Build verified: 1.1.0-1

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 21
Server version: 10.2.8-MariaDB-log Columnstore 1.1.0-1

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [tpch1]> select ps_partkey, sum(ps_supplycost * ps_availqty) as value
-> from partsupp, supplier, nation
-> where replace(concat(ps_suppkey, 'A'), 'A', '') = s_suppkey
-> and 0-s_nationkey = 0-n_nationkey
-> and n_name = 'GERMANY'
-> group by ps_partkey
-> having sum(ps_supplycost * ps_availqty) > ( select sum(ps_supplycost * ps_availqty) * 0.0001 from partsupp, supplier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_name = 'GERMANY' )
-> order by value desc;
ERROR 1815 (HY000): Internal error: IDB-1002: 'partsupp' and 'supplier' have incompatible column type specified for join condition.
M

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