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

string like "1900-01-00" in func datediff,unix_timestamp will make tablet crash #3194

Closed
lqy222 opened this issue Apr 6, 2023 · 4 comments · Fixed by #3543
Closed

string like "1900-01-00" in func datediff,unix_timestamp will make tablet crash #3194

lqy222 opened this issue Apr 6, 2023 · 4 comments · Fixed by #3543
Assignees
Labels
bug Something isn't working cant-reproduce enhancement New feature or request execute-engine hybridse sql engine storage-engine openmldb storage engine. nameserver & tablet

Comments

@lqy222
Copy link
Collaborator

lqy222 commented Apr 6, 2023

Bug Description

datediff and unix_timestamp func that convert string to date extract "1900-01-00" fail

Expected Behavior

Relation Case
inputs:
- columns: ["id int64", "c1 string", "c2 string", "c3 date", "c4 date", "c5 timestamp"]
indexs: ["index1: id: c5"]
rows:
- [5, "1900-01-01", "1900-01-00", "9999-12-31", "1900-01-01", 1590738991300]
sql: select id ,datediff(c1,c2) as svs,datediff(c1,c3) as svd,datediff(c3,c1) as dvs,datediff(c3,c4) as dvd from {0};

inputs:
- columns: ["id int64", "c1 string", "c2 timestamp"]
indexs: ["index1: id: c2"]
rows:
- [1, 1900-01-00, 1590738991000]
sql: select id ,unix_timestamp(c1) as unix_timestamp from {0};


This is a example problem of #926, null value returned by e.g timestamp(-1) become UndefValue for timestamp_to_date

@lqy222 lqy222 added the bug Something isn't working label Apr 6, 2023
@aceforeverd aceforeverd added the storage-engine openmldb storage engine. nameserver & tablet label Apr 6, 2023
@aceforeverd
Copy link
Collaborator

@lqy222 what's the executing environment ? online or offline. Provide the core dump trace info ?

@lqy222
Copy link
Collaborator Author

lqy222 commented Apr 6, 2023

It's online env.
cli log
select c0,datediff(c1,c2) as svs,datediff(c1,c3) as svd,datediff(c3,c1) as dvs,datediff(c3,c4) as dvd from t2;

W0406 01:33:21.178077 23237 rpc_client.h:122] request error. [E1014]Got EOF of Socket{id=2 fd=13 addr=10.100.121.245:30003:47162} (0x0x671e400) [R1][E112]Not connected to 10.100.121.245:30003 yet, server_id=2 [R2][E112]Not connected to 10.100.121.245:30003 yet, server_id=2 [R3][E112]Not connected to 10.100.121.245:30003 yet, server_id=2
W0406 01:33:21.178284 23237 tablet_client.cc:94] send rpc request failed
W0406 01:33:21.178313 23237 sql_cluster_router.cc:1249] Status: [1500] Query rpc failed--[E1014]Got EOF of Socket{id=2 fd=13 addr=10.100.121.245:30003:47162} (0x0x671e400) [R1][E112]Not connected to 10.100.121.245:30003 yet, server_id=2 [R2][E112]Not connected to 10.100.121.245:30003 yet, server_id=2 [R3][E112]Not connected to 10.100.121.245:30003 yet, server_id=2--ReturnCode[0]--
Error: [1500] Query rpc failed--[E1014]Got EOF of Socket{id=2 fd=13 addr=10.100.121.245:30003:47162} (0x0x671e400) [R1][E112]Not connected to 10.100.121.245:30003 yet, server_id=2 [R2][E112]Not connected to 10.100.121.245:30003 yet, server_id=2 [R3][E112]Not connected to 10.100.121.245:30003 yet, server_id=2--ReturnCode[0]--

journalctl error log
localhost kernel: openmldb[14011]: segfault at 7fd50f865008 ip 00007fd5defe5841 sp 00007fd50f9697c0 error 4 in libgcc_s-4.8.5-20150702.so.1[7fd5defd5000+15000]

no tablet log recorded

@aceforeverd
Copy link
Collaborator

can't reproduce in sql engine. I'll add a feature enhance for string to timestamp/date conversion, it seems problematic for many edge cases.

@aceforeverd aceforeverd added enhancement New feature or request execute-engine hybridse sql engine cant-reproduce labels Jun 30, 2023
@aceforeverd aceforeverd changed the title string like "1900-01-00" in func datediff,unix_timestampand will make tablet crash string like "1900-01-00" in func datediff,unix_timestamp will make tablet crash Sep 11, 2023
@aceforeverd
Copy link
Collaborator

aceforeverd commented Oct 7, 2023

Failed cases:

  • select datediff(Date(timestamp(2177481600)), Date("2021-05-01"));
  • select datediff(Date(timestamp(-1)), Date("2021-05-01"));

Fixed:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cant-reproduce enhancement New feature or request execute-engine hybridse sql engine storage-engine openmldb storage engine. nameserver & tablet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants