[MCOL-5283] Add conversion from char to decimal Created: 2022-10-28  Updated: 2023-12-15

Status: Open
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: 22.08.2
Fix Version/s: 23.10

Type: New Feature Priority: Major
Reporter: David Hall (Inactive) Assignee: Max Mether
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MCOL-5248 Truncate on char and varchar columns ... Closed

 Description   

Currently, TreeNode::getDecimalVal() throws an error if called for a char type. We can implement a conversion function and throw ERR_FUNC_OUT_OF_RANGE_RESULT if it won't fit into a 128 bit decimal.

Part of this feature is to find all the places where conversion is from char to double when conversion to 128 bit decimal would be more accurate. That is, find where TreeNode::getDoubleVal() is called for CHAR types and replace with TreeNode::getDecimalVal() where appropriate.

Also look for other possible conversion from string that would be better server with decimal.

This feature adds 128 bit precision where currently, only double precision is used. Care must be taken to possibly keep the double if the char value won't fit into a decimal 128.

In SQL, it's inadvisable to use char types to hold numeric values that might actually be used as numeric, such as for calculations or as parameters to functions that act on numbers. Such conversions only serve to slow down processing and may result in loss of accuracy.


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