[MCOL-695] Implement joins between CHAR/VARCHAR and INT columns Created: 2017-05-02  Updated: 2023-07-02  Resolved: 2023-07-02

Status: Closed
Project: MariaDB ColumnStore
Component/s: N/A
Affects Version/s: 1.1.0
Fix Version/s: Icebox

Type: New Feature Priority: Major
Reporter: Daniel Lee (Inactive) Assignee: Todd Stoffel (Inactive)
Resolution: Won't Do Votes: 0
Labels: Compatibility

Issue Links:
Duplicate
duplicates MCOL-917 Issue with "IDB-1002 incompatible col... Closed
Relates
relates to MCOL-677 Columnstore executes join on incompat... Closed
Epic Link: ColumnStore Compatibility Improvements

 Description   

We need to support joins between CHAR/VARCHAR and INT columns. For example the query in working_tpch1_compareLogOnly/fnJoin/tpch11.sql which fails because we are casting an INT column to a VARCHAR before joining it to an INT column. The error we generate is:

ERROR 1815 (HY000) at line 1: Internal error: IDB-1002: 'partsupp' and 'supplier' have incompatible column type specified for join condition.



 Comments   
Comment by David Thompson (Inactive) [ 2017-09-13 ]

An explicit cast can be used to work around this in the mean time, for example:

select * from i1 join t1 on i1.i = cast(t1.c as int);

assuming i1.i is an int column and t1.c is a char/varchar containing number strings that might match.

Comment by Todd Stoffel (Inactive) [ 2020-11-09 ]

dleeyh Please retest in 5.4.1

Comment by Daniel Lee (Inactive) [ 2020-11-10 ]

Build tested: 5.4.3-1

It is still an issue

[ubuntu18:root~]# /data/qa/autopilot/databases/dbt3/sh/buildDatabase.sh tpch1 columnstore 1g
[ubuntu18:root~]# mysql tpch1
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 44
Server version: 10.5.6-4.5.4.3-MariaDB-enterprise MariaDB Enterprise Server

Copyright (c) 2000, 2018, 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.
MariaDB [tpch1]>

Comment by Todd Stoffel (Inactive) [ 2023-07-02 ]

The "create date" on this ticket is pre-convergence with MariaDB server. If the issue still exists in a modern version of the engine/plugin please submit a new ticket.

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