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

UDAF with multiple arguments has a wrong ColType in a projection RowGroup

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 6.1.1
    • 6.1.1
    • MDB Plugin
    • None
    • 2021-2

    Description

      The current plugin code sets the ColType in the projection RowGroup for UDAF using UDAF's first parameter. This might produce errors with a UDAF that has multiple arguments. Consider the example:

      MariaDB [tpch1]> select * from (select CCHAR9, regr_count(CDECIMAL9_2, length(CCHAR9)) f from datatypetestm1 group by 1) a;
      +-----------+------+
      | CCHAR9    | f    |
      +-----------+------+
      | rrrrrrrr  |    0 |
      | rrrrrrr   |    0 |
      | iii       |    0 |
      | i         |    0 |
      | ii        |    0 |
      | iiii      |    0 |
      | zzzzzzzzz |    0 |
      | aaaaaaaaa |    0 |
      | rrrrrrrrr |    0 |
      | NULL      |    0 |
      +-----------+------+
      10 rows in set (0.021 sec)
       
      MariaDB [tpch1]> select * from (select CCHAR9, regr_count(CDECIMAL9_2, length(CCHAR9)) f from datatypetestm1 where CCHAR9 = 'ii' group by 1) a;
      +--------+------+
      | CCHAR9 | f    |
      +--------+------+
      | ii     |    0 |
      +--------+------+
      1 row in set (0.033 sec)
      

      The f column contains 0 b/c f's ColType is a DECIMAL(9,2) so that Decimal TypeHandler first prints f value as '0.2' and stores it in the MDB's Field. MDB rounds the result to the nearest INT value that is 0 storing the string representation of the DECIMAL(9,2).

      Here is what MCS must return.

      MariaDB [test]> select * from (select CCHAR9, regr_count(CDECIMAL9_2, length(CCHAR9)) f from datatypetestm1 group by 1) a;
      +-----------+------+
      | CCHAR9    | f    |
      +-----------+------+
      | rrrrrrrr  |    2 |
      | rrrrrrr   |    2 |
      | iii       |    2 |
      | i         |    2 |
      | ii        |    2 |
      | iiii      |    2 |
      | zzzzzzzzz |    2 |
      | aaaaaaaaa |    2 |
      | rrrrrrrrr |    4 |
      | NULL      |    0 |
      +-----------+------+
      10 rows in set (0.117 sec)
       
      MariaDB [test]> select * from (select CCHAR9, regr_count(CDECIMAL9_2, length(CCHAR9)) f from datatypetestm1 where CCHAR9 = 'ii' group by 1) a;
      +--------+------+
      | CCHAR9 | f    |
      +--------+------+
      | ii     |    2 |
      +--------+------+
      1 row in set (0.037 sec)
       
      MariaDB [test]> 
      

      Attachments

        Issue Links

          Activity

            People

              dleeyh Daniel Lee (Inactive)
              drrtuy Roman
              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.