Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20280

PERCENTILE_DISC() rejects temporal and string input

Details

    Description

      PERCENTILE_DISC() now return an error on temporal and string input:

      CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
      INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
      INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
      INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
      INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
      INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
      SELECT name, PERCENTILE_DISC(0.5)
        WITHIN GROUP (ORDER BY star_rating)
        OVER (PARTITION BY name) AS pc FROM t1;
      

      ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
      

      It should be extended to support all string and temporal data types.

      Note, PERCENTILE_DISC() previously crashed on temporal input. The patch for MDEV-20272 fixed the crash and made it return an error instead. Allowing temporal and string types in PERCENTILE_DISC() needs some refactoring, which was not desirable in 10.3.

      Refactoring needed:
      Item_sum_percentile_disc currently recursively derives from Item_sum_num, which cannot return string/temporal values by design.
      In order to support string/temporal data types in PERCENTILE_DISC(), Item_sum_percentile_disc should be moved to the Item_sum_hybrid
      branch in the hierarchy.

      It's not desirable to do such refactoring in 10.3 or 10.4.

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov created issue -
            bar Alexander Barkov made changes -
            Field Original Value New Value
            bar Alexander Barkov made changes -
            Description PERCENTILE_DISC() now return an error on temporal and string input:

            {code:sql}
            CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
            SELECT name, PERCENTILE_DISC(0.5)
              WITHIN GROUP (ORDER BY star_rating)
              OVER (PARTITION BY name) AS pc FROM t1;
            {code}
            {noformat}
            ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
            {noformat}

            It should be extended to support all string and temporal data types.
            PERCENTILE_DISC() now return an error on temporal and string input:

            {code:sql}
            CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
            SELECT name, PERCENTILE_DISC(0.5)
              WITHIN GROUP (ORDER BY star_rating)
              OVER (PARTITION BY name) AS pc FROM t1;
            {code}
            {noformat}
            ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
            {noformat}

            It should be extended to support all string and temporal data types.

            Note, PERCENTILE_DISC() crashed on temporal input. The patch for MDEV-20272 fixed the crash and made it return an error instead. Allowing temporal and string types in PERCENTILE_DISC() needs some refactoring, which was not desirable in 10.3.

            Refactoring needed:
            Item_sum_percentile_disc currently recursively derives from Item_sum_num, which cannot return string/temporal values by design.
            In order to support string/temporal data types in PERCENTILE_DISC(), Item_sum_percentile_disc should be moved to the Item_sum_hybrid branch in the hierarchy.
            bar Alexander Barkov made changes -
            Description PERCENTILE_DISC() now return an error on temporal and string input:

            {code:sql}
            CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
            SELECT name, PERCENTILE_DISC(0.5)
              WITHIN GROUP (ORDER BY star_rating)
              OVER (PARTITION BY name) AS pc FROM t1;
            {code}
            {noformat}
            ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
            {noformat}

            It should be extended to support all string and temporal data types.

            Note, PERCENTILE_DISC() crashed on temporal input. The patch for MDEV-20272 fixed the crash and made it return an error instead. Allowing temporal and string types in PERCENTILE_DISC() needs some refactoring, which was not desirable in 10.3.

            Refactoring needed:
            Item_sum_percentile_disc currently recursively derives from Item_sum_num, which cannot return string/temporal values by design.
            In order to support string/temporal data types in PERCENTILE_DISC(), Item_sum_percentile_disc should be moved to the Item_sum_hybrid branch in the hierarchy.
            PERCENTILE_DISC() now return an error on temporal and string input:

            {code:sql}
            CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
            SELECT name, PERCENTILE_DISC(0.5)
              WITHIN GROUP (ORDER BY star_rating)
              OVER (PARTITION BY name) AS pc FROM t1;
            {code}
            {noformat}
            ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
            {noformat}

            It should be extended to support all string and temporal data types.

            Note, PERCENTILE_DISC() previously crashed on temporal input. The patch for MDEV-20272 fixed the crash and made it return an error instead. Allowing temporal and string types in PERCENTILE_DISC() needs some refactoring, which was not desirable in 10.3.

            Refactoring needed:
            Item_sum_percentile_disc currently recursively derives from Item_sum_num, which cannot return string/temporal values by design.
            In order to support string/temporal data types in PERCENTILE_DISC(), Item_sum_percentile_disc should be moved to the Item_sum_hybrid branch in the hierarchy.
            bar Alexander Barkov made changes -
            Fix Version/s 10.5 [ 23123 ]
            bar Alexander Barkov made changes -
            Description PERCENTILE_DISC() now return an error on temporal and string input:

            {code:sql}
            CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
            SELECT name, PERCENTILE_DISC(0.5)
              WITHIN GROUP (ORDER BY star_rating)
              OVER (PARTITION BY name) AS pc FROM t1;
            {code}
            {noformat}
            ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
            {noformat}

            It should be extended to support all string and temporal data types.

            Note, PERCENTILE_DISC() previously crashed on temporal input. The patch for MDEV-20272 fixed the crash and made it return an error instead. Allowing temporal and string types in PERCENTILE_DISC() needs some refactoring, which was not desirable in 10.3.

            Refactoring needed:
            Item_sum_percentile_disc currently recursively derives from Item_sum_num, which cannot return string/temporal values by design.
            In order to support string/temporal data types in PERCENTILE_DISC(), Item_sum_percentile_disc should be moved to the Item_sum_hybrid branch in the hierarchy.
            PERCENTILE_DISC() now return an error on temporal and string input:

            {code:sql}
            CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:05');
            INSERT INTO t1 VALUES ('Lord of the Ladybirds', '00:00:03');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:01');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:02');
            INSERT INTO t1 VALUES ('Lady of the Flies', '00:00:05');
            SELECT name, PERCENTILE_DISC(0.5)
              WITHIN GROUP (ORDER BY star_rating)
              OVER (PARTITION BY name) AS pc FROM t1;
            {code}
            {noformat}
            ERROR 4101 (HY000): Numeric datatype is required for percentile_disc function
            {noformat}

            It should be extended to support all string and temporal data types.

            Note, PERCENTILE_DISC() previously crashed on temporal input. The patch for MDEV-20272 fixed the crash and made it return an error instead. Allowing temporal and string types in PERCENTILE_DISC() needs some refactoring, which was not desirable in 10.3.

            Refactoring needed:
            Item_sum_percentile_disc currently recursively derives from Item_sum_num, which cannot return string/temporal values by design.
            In order to support string/temporal data types in PERCENTILE_DISC(), Item_sum_percentile_disc should be moved to the Item_sum_hybrid
            branch in the hierarchy.

            It's not desirable to do such refactoring in 10.3 or 10.4.
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            bar Alexander Barkov made changes -
            Fix Version/s 10.5.4 [ 24264 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 98777 ] MariaDB v4 [ 156585 ]
            elenst Elena Stepanova made changes -

            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.