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

substr() on view returns NULL sometimes

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.0.3
    • 1.0.5
    • PrimProc
    • None
    • CentOS
    • 2016-21, 2016-22

    Description

      This issue exists in InfiniDB.

      This issue arose because of an anomoly seen in working_tcph_comparelogonly/partitionOptimization/vTpch22.sql

      When substr is called on a view, sometimes it returns NULL

      Here we select substr and acct_bal from the table. We get the expected result.
      MariaDB [tpch1]> select substr(c_phone, 1, 2) as cntrycode, c_acctbal from customer where substr(c_phone, 1, 2) in ('13', '31', '23', '29', '30', '18', '17') limit 10;
      --------------------+

      cntrycode c_acctbal

      --------------------+

      23 121.65
      13 794.47
      30 7638.57
      18 8324.07
      23 3396.49
      13 3857.34
      18 1428.25
      13 591.98
      13 3332.02
      23 9255.67

      --------------------+
      10 rows in set, 1 warning (0.30 sec)

      Here we select substr and acct_bal from the view. We get unexpected NULLs on some of the rows.
      MariaDB [tpch1]> select substr(c_phone, 1, 2) as cntrycode, c_acctbal from v_customer where substr(c_phone, 1, 2) in ('13', '31', '23', '29', '30', '18', '17') limit 10;
      --------------------+

      cntrycode c_acctbal

      --------------------+

      NULL 121.65
      13 794.47
      NULL 7638.57
      NULL 8324.07
      NULL 3396.49
      NULL 3857.34
      NULL 1428.25
      NULL 591.98
      NULL 3332.02
      23 9255.67

      --------------------+
      10 rows in set, 1 warning (0.34 sec)

      Here we select only substr from the view. We get the expected result.
      MariaDB [tpch1]> select substr(c_phone, 1, 2) as cntrycode from v_customer where substr(c_phone, 1, 2) in ('13', '31', '23', '29', '30', '18', '17') limit 10;
      -----------

      cntrycode

      -----------

      23
      13
      30
      18
      23
      13
      18
      13
      13
      23

      -----------
      10 rows in set, 1 warning (0.46 sec)

      MariaDB [tpch1]>

      Attachments

        Activity

          People

            dleeyh Daniel Lee (Inactive)
            David.Hall David Hall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.