Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL), 10.4(EOL), 10.5
-
None
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
- causes
-
MDEV-30292 Server crashes in Static_binary_string::length / save_window_function_values
- Confirmed
- relates to
-
MDEV-20272 PERCENTILE_DISC() crashes on a temporal type input
- Closed
-
MDEV-21392 Cleanup redundant overriding in Item_sum_num
- Closed
-
MDEV-22764 Crash with a stored aggregate function returning INET6
- Closed