[MCOL-4414] TIME_TO_SEC() gives unexpected results for seconds having decimals Created: 2020-11-26  Updated: 2023-12-15

Status: Stalled
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: 6.1.1
Fix Version/s: 23.10

Type: Bug Priority: Major
Reporter: Bharath Bokka (Inactive) Assignee: Roman
Resolution: Unresolved Votes: 1
Labels: beginner-friendly, gsoc23

Issue Links:
Relates
relates to MCOL-4743 Regression: TIME_TO_SEC(const_expr) e... Closed

 Description   

TIME_TO_SEC() gives unexpected results for seconds having decimals

 
CREATE TABLE t1(col TIME(3))ENGINE=Columnstore;
INSERT INTO t1 VALUES('00:00:40.991');

SELECT TIME_TO_SEC('00:00:40.991') FROM t1;
+-----------------------------+
| TIME_TO_SEC('00:00:40.991') |
+-----------------------------+
|                       0.000 |
+-----------------------------+
SELECT TIME_TO_SEC('00:00:40.99') FROM t1;
+-----------------------------+
| TIME_TO_SEC('00:00:40.99') |
+-----------------------------+
|                       40.99 |
+-----------------------------+

SELECT col, TIME_TO_SEC(col) FROM t1;
+--------------+------------------+
| col          | TIME_TO_SEC(col) |
+--------------+------------------+
| 00:00:40.991 |           40.000 |
+--------------+------------------+

This is a regression.

Artifacts: https://cspkg.s3.amazonaws.com/index.html?prefix=develop/cron/1175



 Comments   
Comment by Karim Taha [ 2023-03-24 ]

I'm debugging this issue right now, here are my results

The output for the debug build,

root@271d43d01a39:~# mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 11.0.2-MariaDB-debug MariaDB Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> create database debug;
Query OK, 1 row affected (0.001 sec)
 
MariaDB [(none)]> use debug
Database changed
MariaDB [debug]> CREATE TABLE t1(col TIME(3))ENGINE=Columnstore;
Query OK, 0 rows affected (14.087 sec)
 
MariaDB [debug]> INSERT INTO t1 VALUES('00:00:40.991');
Query OK, 1 row affected (1.074 sec)
 
MariaDB [debug]> SELECT TIME_TO_SEC('00:00:40.991') FROM t1;
+-----------------------------+
| TIME_TO_SEC('00:00:40.991') |
+-----------------------------+
|                      40.991 |
+-----------------------------+
1 row in set (0.154 sec)
 
MariaDB [debug]> SELECT TIME_TO_SEC('00:00:40.99') FROM t1;
+----------------------------+
| TIME_TO_SEC('00:00:40.99') |
+----------------------------+
|                      40.99 |
+----------------------------+
1 row in set (0.016 sec)
 
MariaDB [debug]> SELECT col, TIME_TO_SEC(col) FROM t1;
+--------------+------------------+
| col          | TIME_TO_SEC(col) |
+--------------+------------------+
| 00:00:40.991 |           40.000 |
+--------------+------------------+
1 row in set (0.015 sec)

The output for the release with debug symbols build

MariaDB [(none)]> create database debug;
Query OK, 1 row affected (0.001 sec)
 
MariaDB [(none)]> use debug;
Database changed
MariaDB [debug]> CREATE TABLE t1(col TIME(3))ENGINE=Columnstore;
Query OK, 0 rows affected (13.020 sec)
 
MariaDB [debug]> INSERT INTO t1 VALUES('00:00:40.991');
^[[Query OK, 1 row affected (3.277 sec)
 
MariaDB [debug]> SELECT TIME_TO_SEC('00:00:40.991') FROM t1;
+-----------------------------+
| TIME_TO_SEC('00:00:40.991') |
+-----------------------------+
|                      40.991 |
+-----------------------------+
1 row in set (0.232 sec)
 
MariaDB [debug]> SELECT TIME_TO_SEC('00:00:40.99') FROM t1;
+----------------------------+
| TIME_TO_SEC('00:00:40.99') |
+----------------------------+
|                      40.99 |
+----------------------------+
1 row in set (0.014 sec)
 
MariaDB [debug]> SELECT col, TIME_TO_SEC(col) FROM t1;
+--------------+------------------+
| col          | TIME_TO_SEC(col) |
+--------------+------------------+
| 00:00:40.991 |           40.000 |
+--------------+------------------+
1 row in set (0.017 sec)

Comment by JiraAutomate [ 2023-12-15 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

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