Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4531

New string-to-decimal conversion implementation



    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 6.1.1
    • Fix Version/s: 6.1.1
    • Component/s: PrimProc
    • Labels:


      We have at least two implementations of string-to-decimal conversion:

      • dataconvert::number_int_value(), which is used either directly or inside the wrapper SystemCatalog::TypeAttributesStd::decimal128FromString().
      • Func_cast_decimal::getDecimalVal()

      These two implementations have a lot of duplicate code and have problems:

      • MCOL-4462 - This problem existed for a long time
      • MCOL-4500 - This problem was introduced by MCOL-4464
      • MCOL-4532 - Introduced by MCOL-641
      • They use a lot of std::string objects copying and padding, which is not performance friendly.

      Under terms of this task we'll do the following:

      • Introduce a new implementation of a string-to-decimal conversion function which won't have the mentioned bugs
      • The new function should not do any std::string copying/padding and should only use the source string (and therefore should hopefully be faster). It should only iterate on the source string.
      • The new function should get a const char * pointer and its length instead of a '\0' terminated C-style string. This is to avoid calling string::c_ptr() which is also not performance friendly.
      • Add a new constructor:

        Decimal::Decimal(const char *str, size_t length, DataCondition & convError,
                        int8_t s, uint8_t p)

        which will use the new conversion function internally.

      • Replace the code in GenericToBitOperand() in func_bit.cc to the new function call
      • Replace the code in Func_cast_decimal::getDecimalVal() to thew new constructor call

      Further steps

      Note, after these changes, the functions dataconvert::number_int_value() and SystemCatalog::TypeAttributesStd::decimal128FromString() will still exist.

      Later, under terms of a separate tasks (or even multiple tasks), we'll:

      • Replace all remaining calls for dataconvert::number_int_value() to the new functionality.
      • Replace all remaining calls for SystemCatalog::TypeAttributesStd::decimal128FromString() to the new functionality.
      • Remove dataconvert::number_int_value() and SystemCatalog::TypeAttributesStd::decimal128FromString() completely.


          Issue Links



              bar Alexander Barkov
              bar Alexander Barkov
              0 Vote for this issue
              1 Start watching this issue



                  Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.