[MCOL-4173] Support JOINs wide-DECIMAL keys. Created: 2020-07-13  Updated: 2021-12-10  Resolved: 2021-08-04

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.1, 6.2.2

Type: Task Priority: Major
Reporter: Roman Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MCOL-4753 Performance problem in Typeless join Closed
relates to MCOL-4755 Allow joins on all numeric data type ... Open
Epic Link: ColumnStore Compatibility Improvements

 Description   

There are number of JOIN types and JOIN-based operations in MCS that doesn't support 16 byte wide-decimal columns as JOIN key parts.
Here is the list of JOIN and JOIN-based operations that must support wide-decimal:

  • INNER JOIN
  • LEFT|RIGHT JOIN
  • [NOT]IN+correlated subquery
  • [NOT] EXISTS
    The JOIN operation must support equi predicates with different width columns ,e.g. DECIMAL(38) = INT. The prerequisite for cross-type join is that both sides must be integers, e.g. DECIMAL(20) and BIGINT. It is impossible to join DECIMAL(20,1) and BIGINT.
    The JOIN operation must also support equi predicates functions with a wide-decimal argument.


 Comments   
Comment by Roman [ 2021-05-25 ]

Plz review.

Comment by Roman [ 2021-06-24 ]

4QA JOIN with wide DECIMAL key column leverages Typeless JOIN so JOINs with strings must be also tested. You could take this and this test as a reference of what had been tested so far.

Comment by Roman [ 2021-08-04 ]

This is not a bug dleeyh this is a new feature for 6.1.1. All tests that were mentioned can be references for QA.

Comment by Daniel Lee (Inactive) [ 2021-08-04 ]

Build verified: 6.2.1-1 ( #2921)

Tested in 6.1.1, 6.1.1 with columnstore_select_handler=off, 6.2.1
Tested inner, left, right joins, in, not in, exists, not exists
Tested with t1 being bigint and varchar(5);

#CASE 1

ColumnStore 6.1.1
Found this issue in 6.1.1

create table t1 (c1 bigint) engine=columnstore;
create table t2 (c1 decimal(38)) engine=columnstore;
insert into t1 values (1), (3), (5), (6), (NULL);
insert into t2 values (1), (2), (3), (4), (5), (NULL);
select * from t1 where c1 not in (select c1 from t2);

Columnstore tables, returned 6
Columnstore tables, columnstore_select_handler=off; returned empty set
Innodb tables, returned empty set

ColumnStore 6.2.1
The issue has been corrected in 6.2.1

#CASE 2
ColumnStore 6.1.1
Found this issue in 6.1.1

create table t1 (c1 varchar(5)) engine=columnstore;
create table t2 (c1 decimal(38)) engine=columnstore;
create table t3 (c1 decimal(38)) engine=columnstore;
#

  1. varchar(5), decimal(38)
    #
    #INNER JOIN
    insert into t1 values ('1'), ('2'), ('3'), ('4'), ('5');
    insert into t2 values (1), (2), (3), (4), (5);
    insert into t3 values (1), (2), (3), (4), (5);
    select *
    from t1
    inner join t2 on t1.c1=t2.c1
    inner join t3 on t1.c1=t3.c1;

MariaDB [mytest]> select *
-> from t1
-> inner join t2 on t1.c1=t2.c1
-> inner join t3 on t1.c1=t3.c1;
ERROR 1815 (HY000): Internal error: IDB-1002: 't1' and 't3' have incompatible column type specified for join condition.

The issue has been corrected in 6.2.1

Comment by Roman [ 2021-08-04 ]

dleeyh
Case 1 The join must return a record 6 with select_handler.
Case 2 The join implementation in MCS is never supposed to work for joins on varchar(5) to decimal(38) columns.

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