[MCOL-5161] MODA() to support char and varchar Created: 2022-07-15 Updated: 2022-08-16 Resolved: 2022-08-16 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | PrimProc |
| Affects Version/s: | None |
| Fix Version/s: | 22.08.1 |
| Type: | New Feature | Priority: | Major |
| Reporter: | David Hall (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Assigned for Testing: | |
||||||||
| Description |
|
Our current implementation of the aggregate MODA supports all numeric types. Implementations by other databases support string types as well. I would expect some users to want such functionality. |
| Comments |
| Comment by David Hall (Inactive) [ 2022-07-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This functionality was incorporated in | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2022-07-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
QA: Moda() takes the input column (after filters) and finds the value with the most occurrences. If there's a tie for numerical types it grabs the one closest to avg(). If there's still a tie, it uses the smallest one. For string types, there is no concept of avg(), so in case of a tie, it should choose the one with the lowest collation order. We should test for both CHAR with lengths < 9 and lengths > 8 and VARCHAR with lengths < 8 and lengths > 7. Note that this is byte lengths. We should also test with various collations and character sets with multi-byte characters. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2022-08-15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Build tested: 22.08-1 (#5290) Tested the following test case using different data types char(5), char(13), varchar(5), and varchar(13). Using numeric strings
Using strings
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2022-08-15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
2 or t2 were expected from the tests above. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2022-08-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Reopen per the last test result. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2022-08-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Build verified: 22.08-1 (#5303) |