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

Replace Row methods getStringLength() and getStringPointer() to getConstString()

    XMLWordPrintable

Details

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

    Description

      These two methods:

      inline const uint8_t* Row::getStringPointer(uint32_t colIndex) const
      {
          if (inStringTable(colIndex))
              return strings->getPointer(*((uint64_t*) &data[offsets[colIndex]]));
       
          return &data[offsets[colIndex]];
      }
      

      inline uint32_t Row::getStringLength(uint32_t colIndex) const
      {
          if (inStringTable(colIndex))
              return strings->getStringLength(*((uint64_t*) &data[offsets[colIndex]]));
       
          return strnlen((char*) &data[offsets[colIndex]], getColumnWidth(colIndex));
      }
      

      test exactly the same condition isStringTable(colIndex). In 99% cases these two methods are used at the same time. Therefore, the condition is tested two times.

      Also, under terms of MCOL-4691 we'll introduce a new VARCHAR in-memory format (length followed by the actual data) to avoid strnlen() calls. This will make this duplicate condition more complex.

      In order to avoid duplicate code and double condition evaluation, let's do the following:

      • Remove the above two methods
      • Change getConstString() as follows:
        inline utils::ConstString Row::getConstString(uint32_t colIndex) const { return inStringTable(colIndex) ? strings->getConstString(*((uint64_t*) &data[offsets[colIndex]])) : getShortConstString(colIndex); }
      • Change all the affected code to use getConstString() instead of the removed methods

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.