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

New string-to-decimal conversion implementation

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 6.1.1
    • 6.1.1
    • PrimProc
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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