Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent test depends from local host timezone and fails if it is not UTC #2160

Closed
8 tasks done
klirichek opened this issue May 10, 2024 · 5 comments
Closed
8 tasks done
Assignees
Labels
bug rel::6.3.0 Released in 6.3.0

Comments

@klirichek
Copy link
Contributor

klirichek commented May 10, 2024

Bug Description:

clause from test 446, pushed in 973703b

    INSERT into rt1 (id, tid) values (1, 1568577600), (2, '2019-10'),(3, '2019-10-15T20:00');
    SELECT id, tid, date_format(tid, '%Y-%m-%dT%H:%M') as d from rt1 order by id asc;

expected result is

sphinxql-31> SELECT id, tid, date_format(tid, '%Y-%m-%dT%H:%M') as d from rt1 order by id asc;
	id	tid	d
	1	1568577600	2019-09-15T20:00
	2	1569888000	2019-10-01T00:00
	3	1571169600	2019-10-15T20:00
3 rows in set

real result is

sphinxql-31> SELECT id, tid, date_format(tid, '%Y-%m-%dT%H:%M') as d from rt1 order by id asc;
	id	tid	d
	1	1568577600	2019-09-16T03:00
	2	1569888000	2019-10-01T07:00
	3	1571169600	2019-10-16T03:00
3 rows in set

The most prominent is that just inserted 2019-10-15T20:00 immediately got parsed as 2019-10-16T03:00, i.e. 7 hours later. Looks, like date_format implicitly uses local timezone or something like.

While it is possible to suppress such difference by assigning a timezone, the fact that parse/render are not synced together and produces different result looks not very friendly. I would at least expect that just inserted value will be rendered the same way to produce same result as inserted.

Manticore Search Version:

since 973703b

Operating System Version:

linux, macos

Have you tried the latest development version?

  • Yes

Internal Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Task estimated
  • Specification created, reviewed, and approved
  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation proofread
  • Changelog updated
@sanikolaev
Copy link
Collaborator

Looks like it considers the entered time is in UTC instead of converting it to UTC internally from the current time zone.

MRE:

mysql> set global timezone='Asia/Novosibirsk'; drop table if exists rt1; create table rt1(tid timestamp); INSERT into rt1 (id, tid) values (3, '2022-01-01T00:00'); SELECT id, date_format(tid, '%Y-%m-%dT%H:%M') from rt1;
--------------
set global timezone='Asia/Novosibirsk'
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
drop table if exists rt1
--------------

Query OK, 0 rows affected (0.08 sec)

--------------
create table rt1(tid timestamp)
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
INSERT into rt1 (id, tid) values (3, '2022-01-01T00:00')
--------------

Query OK, 1 row affected (0.00 sec)

--------------
SELECT id, date_format(tid, '%Y-%m-%dT%H:%M') from rt1
--------------

+------+------------------------------------+
| id   | date_format(tid, '%Y-%m-%dT%H:%M') |
+------+------------------------------------+
|    3 | 2022-01-01T07:00                   |
+------+------------------------------------+
1 row in set (0.00 sec)
--- 1 out of 1 results in 0ms ---

@sanikolaev
Copy link
Collaborator

Same with hour():

select hour(tid) from rt1
--------------

+-----------+
| hour(tid) |
+-----------+
|         7 |
+-----------+
1 row in set (0.00 sec)

@sanikolaev
Copy link
Collaborator

Another failing test is col_434 when run in the columnar mode - https://github.com/manticoresoftware/columnar/runs/24873252849

@sanikolaev sanikolaev added the rel::upcoming Upcoming release label May 13, 2024
@sanikolaev sanikolaev assigned glookka and unassigned tomatolog May 14, 2024
@glookka
Copy link
Contributor

glookka commented May 14, 2024

These are actually two unrelated issues. One issue is using UTC instead on local timezone on inserts and another issue is treating quoted timestamps as strings that need to be parsed via cctz

@glookka
Copy link
Contributor

glookka commented May 16, 2024

Fixed in f6af49b

@glookka glookka closed this as completed May 16, 2024
@sanikolaev sanikolaev added rel::6.3.0 Released in 6.3.0 and removed rel::upcoming Upcoming release labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rel::6.3.0 Released in 6.3.0
Projects
None yet
Development

No branches or pull requests

4 participants