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

MCS-2045 / wrong byte (0xFF/0x3F) returned instead of SQL NULL for CHAR/VARCHAR(width<=8) read via CrossEngineStep

    XMLWordPrintable

Details

    Description

      Summary

      A NULL value in a CHAR/VARCHAR column with width ≤ 8 read from InnoDB via CrossEngineStep is delivered to the client as the byte 0xFF (CHAR(1) → ? / 0x3F after charset conversion) instead of NULL.

      Repro (standalone, no state)

      CREATE TABLE t (a CHAR(1)) ENGINE=InnoDB;
      INSERT INTO t VALUES (NULL),('x');
      SET SESSION columnstore_innodb_queries_use_mcs=ON;
      SELECT a, HEX(a), a IS NULL FROM t;
      -- expected: NULL, NULL, 1   |   x, 78, 0
      -- actual:   ?,    FF,   0   |   x, 78, 0

      Root cause

      dbcon/joblist/crossenginestep.cpp::convertValueNum() hardcodes the 8-byte NULL marker for any CHAR/VARCHAR width:

      case CHAR: case VARCHAR:
        if (nullFlag) rv = joblist::CHAR8NULL;   // 0xFEFFFFFFFFFFFFFFULL

      For colWidth=1, setIntField then truncates to the low byte = 0xFF (which is CHAR1EMPTYROW, not CHAR1NULL=0xFE). Per-width markers already exist in joblist/joblisttypes.h (CHAR1NULL, CHAR2NULL, CHAR4NULL, CHAR8NULL) — fix is a switch (ct.colWidth).

      Trigger / scope

      Bug is pre-existing. Exposed in CI by columnstore commit 09783833b (2026-04-17) which set innodb_queries_use_mcs=ON globally in build/run_mtr.sh. With OFF, MTR test passes (verified in rocky9 container).

      Affected MTR test / artifacts

      columnstore/basic.mcol_2000 — disabled in c4635ff6b under MCOL-6340. Artifacts: mcol_2000_artifacts.tgz.

      Attachments

        Issue Links

          Activity

            People

              drrtuy Roman
              patrizio.tamorri Patrizio Tamorri (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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