[MCOL-4099] Function Insert not inserting. Created: 2020-06-24  Updated: 2020-09-21  Resolved: 2020-08-31

Status: Closed
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: 1.5.2
Fix Version/s: 5.4.1

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

Issue Links:
Issue split
split from MCOL-3536 Order by with UTF Closed
Epic Link: ColumnStore Compatibility Improvements

 Description   

the distributed Function Insert doesn't do anything if you ask to insert at position 1. It needs a simple switch of the lines that test for negative index and the one that converts the position from 1 based to 0 based.



 Comments   
Comment by Daniel Lee (Inactive) [ 2020-07-09 ]

Build verified: 1.5.3-1 (drone build #287)

Reproduced the issue in 1.5.2-1

MariaDB [mytest]> create table t1 (c1 int, c2 char(20)) engine=columnstore;
Query OK, 0 rows affected (0.175 sec)

MariaDB [mytest]> insert into t1 values (50, 'Hawaii');
Query OK, 1 row affected (0.285 sec)

MariaDB [mytest]> select * from t1;
------------+

c1 c2

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

50 Hawaii

------------+
1 row in set (0.100 sec)

MariaDB [mytest]> select c1, insert(c2,1,5,'aloha') from t1;
----------------------------+

c1 insert(c2,1,5,'aloha')

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

50 Hawaii

----------------------------+
1 row in set (0.020 sec)

Verified fix in 1.5.3-1

MariaDB [mytest]> create table t1 (c1 int, c2 char(20)) engine=columnstore;
Query OK, 0 rows affected (0.230 sec)

MariaDB [mytest]> insert into t1 values (50, 'Hawaii');
Query OK, 1 row affected (0.375 sec)

MariaDB [mytest]> select c1, insert(c2,1,5,'aloha') from t1;
----------------------------+

c1 insert(c2,1,5,'aloha')

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

50 alohai

----------------------------+
1 row in set (0.097 sec)

MariaDB [mytest]> select c1, insert(c2,1,3,'aloha') from t1;
----------------------------+

c1 insert(c2,1,3,'aloha')

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

50 alohaaii

----------------------------+
1 row in set (0.022 sec)

MariaDB [mytest]> select c1, insert(c2,2,3,'aloha') from t1;
----------------------------+

c1 insert(c2,2,3,'aloha')

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

50 Halohaii

----------------------------+
1 row in set (0.018 sec)

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

Restested in 1.5.3-1 (drone #280)

It is also fixed in build #280

Comment by Gagan Goel (Inactive) [ 2020-08-28 ]

David.Hall Is there a test case that dleeyh can use for testing, that demonstrates the fix applied by the PR for this issue?

Comment by Daniel Lee (Inactive) [ 2020-08-31 ]

Build verified: 1.5.4-1 (Drone #496)

Additional tests:

MariaDB [mytest]> select c1, insert(c2,-1,3,'aloha') from t1;
-----------------------------+

c1 insert(c2,-1,3,'aloha')

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

50 Hawaii

-----------------------------+
1 row in set (0.050 sec)

MariaDB [mytest]> select c1, insert(c2,0,3,'aloha') from t1;
----------------------------+

c1 insert(c2,0,3,'aloha')

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

50 Hawaii

----------------------------+
1 row in set (0.019 sec)

MariaDB [mytest]> select c1, insert(c2,6,3,'aloha') from t1;
----------------------------+

c1 insert(c2,6,3,'aloha')

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

50 Hawaialoha

----------------------------+
1 row in set (0.021 sec)

MariaDB [mytest]> select c1, insert(c2,7,3,'aloha') from t1;
----------------------------+

c1 insert(c2,7,3,'aloha')

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

50 Hawaii

----------------------------+
1 row in set (0.017 sec)

Comment by David Hall (Inactive) [ 2020-08-31 ]

For 1.5.4, test for the last char in the field and last +1.

select insert(c2,6,5,'aloha') from t1;
------------------------

insert(c2,6,5,'aloha')

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

Hawaialoha

------------------------
1 row in set (0.028 sec)

select insert(c2,7,5,'aloha') from t1;
------------------------

insert(c2,7,5,'aloha')

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

Hawaii

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

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