[MCOL-5068] Extract Quarter does not always return correct values Created: 2022-05-02  Updated: 2023-10-04  Resolved: 2023-06-16

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 23.02.3
Fix Version/s: 23.02.4

Type: Bug Priority: Major
Reporter: Edward Stoever Assignee: Leonid Fedorov
Resolution: Fixed Votes: 0
Labels: None

Attachments: File example.sh    
Sprint: 2023-6
Assigned for Review: Roman Roman
Assigned for Testing: Daniel Lee Daniel Lee (Inactive)

 Description   

QUARTER(q.claim_closing_date) as QUARTER,
and
EXTRACT(QUARTER FROM claim_closing_date) as EXTRACT_QUARTER

should return the same values, but they do not from a columnstore table:

 
show create table extract_quarter_example\G
*************************** 1. row ***************************
       Table: extract_quarter_example
Create Table: CREATE TABLE `extract_quarter_example` (
  `claim_id` int(11) NOT NULL,
  `claim_name` varchar(11) DEFAULT NULL,
  `claim_closing_date` date DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3
 
select count(1) from extract_quarter_example;
+----------+
| count(1) |
+----------+
|   500000 |
+----------+
 
SELECT q.claim_id,
       q.claim_closing_date,
       QUARTER(q.claim_closing_date) as QUARTER,
       EXTRACT(QUARTER FROM claim_closing_date) as EXTRACT_QUARTER
FROM extract_quarter_example q limit 10;
+-----------+--------------------+---------+-----------------+
| claim_id  | claim_closing_date | QUARTER | EXTRACT_QUARTER |
+-----------+--------------------+---------+-----------------+
| 234751530 | 2014-06-11         |       2 |               2 |
|  14834870 | 2012-07-28         |       3 |               2 |
|  36617706 | 2019-11-13         |       4 |               3 |
|   2170626 | 2022-06-12         |       2 |               2 |
| 124181396 | 2021-06-25         |       2 |               2 |
| 128071009 | NULL               |    NULL |            NULL |
| 177692964 | NULL               |    NULL |            NULL |
| 193813621 | 2015-07-02         |       3 |               2 |
| 305626077 | 2012-07-15         |       3 |               2 |
|  59257621 | 2022-06-22         |       2 |               2 |
+-----------+--------------------+---------+-----------------+

A factor in this might be that some rows include null values for the date column.



 Comments   
Comment by Edward Stoever [ 2022-05-02 ]

I have attached a script you can use to populate the table with sample data using cpimport.

Comment by Edward Stoever [ 2023-06-16 ]

CS0397277 - Customer asks why this has taken so long to get fixed.

Comment by Leonid Fedorov [ 2023-06-16 ]

Must be fixed with MCOL:5503

Comment by Daniel Lee (Inactive) [ 2023-06-30 ]

This ticket also has been verified by QA.

Generated at Thu Feb 08 02:55:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.