[MCOL-331] INSERT() function misbehaves with our of range parameters Created: 2016-09-26  Updated: 2016-09-29  Resolved: 2016-09-29

Status: Closed
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: None
Fix Version/s: 1.0.4

Type: Bug Priority: Major
Reporter: Andrew Hutchings (Inactive) Assignee: Andrew Hutchings (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MCOL-25 001 Working Folder UM Join Test Fails Closed
Sprint: 2016-19

 Description   

working_tpch1/qa_fe_cnxFunctions/insert.sql

INSERT() is not following the documented behaviour for 'len' and 'pos' out of range.



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2016-09-29 ]

Emailed to Ben:

The thing to look for is:

https://mariadb.com/kb/en/mariadb/insert-function/

"Returns the original string if pos is not within the length of the string. Replaces the rest of the string from position pos if len is not within the length of the rest of the string."

The two rules there are not working. I've attached a zip with the SQL to test with. The ref log from InnoDB and the log from ColumnStore. You can use "diff -u" on the two logs to see where ColumnStore is going wrong.

A good example is:

cidx	CVCHAR1	INSERT(CVCHAR1,2,4,'a')
-1	a	a
-2	a	a
-3	a	a
-4	a	a
-5	a	a
-6	z	z
-7	z	z
-8	z	z
-9	z	z
-10	z	z
+1	a	aa
+2	a	aa
+3	a	aa
+4	a	aa
+5	a	aa
+6	z	za
+7	z	za
+8	z	za
+9	z	za
+10	z	za

Here you can see pos is not within the length of the string so the original string should be returned which is what InnoDB (the '-') does. But ColumnStore (the '+') is increasing the length of the string instead.

I suspect the logic behind this will be in the file utils/funcexp/func_insert.cpp but I haven't looked at this file yet.

Comment by Andrew Hutchings (Inactive) [ 2016-09-29 ]

Good fix, test already in suite and I tested it against your patch. All good.

Comment by Andrew Hutchings (Inactive) [ 2016-09-29 ]

Reopening as close didn't ask my why...

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