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

Crash when using DATE/NULL inside of an UNNEST statement #30

Closed
ageiduschek opened this issue Aug 29, 2022 · 3 comments · Fixed by goccy/go-zetasqlite#23
Closed

Crash when using DATE/NULL inside of an UNNEST statement #30

ageiduschek opened this issue Aug 29, 2022 · 3 comments · Fixed by goccy/go-zetasqlite#23
Labels
bug Something isn't working

Comments

@ageiduschek
Copy link

I'm seeing a crash when I try to use a date inside of a STRUCT in UNNEST statement.

For reference, this query does NOT crash:

SELECT DATE(2022, 1, 1) AS a, b 
FROM UNNEST([
  STRUCT(1 AS b)
]);

But this very similar query that should produce the same results does:

SELECT a, b 
FROM UNNEST([
  STRUCT(DATE(2022, 1, 1) AS a, 1 AS b)
]);

This is the error log:

2022-08-29T23:38:03.026Z	ERROR	server/handler.go:40	internal error	{"error": "failed to query SELECT zetasqlite_get_struct_field_date(`$unnest1#1`, 0) AS `a#2`,zetasqlite_get_struct_field_int64(`$unnest1#1`, 1) AS `b#3` FROM (SELECT json_each.value AS `$unnest1#1` FROM json_each(zetasqlite_decode_array_string(zetasqlite_make_array_array(zetasqlite_make_struct_struct('zetasqlite_date_date(2022,1,1)',zetasqlite_date_date(2022,1,1),'1',1))))): no such function: zetasqlite_make_array_array"}

I also see the same crash when using a different date function:

SELECT a, b 
FROM UNNEST([
  STRUCT(PARSE_DATE('%Y-%m-%d', '2022-01-01') AS a, 1 AS b)
]);

Thank you!

@ageiduschek
Copy link
Author

I am actually also seeing this for a much simpler case where I have a NULL value in the struct:

SELECT a
FROM UNNEST([
   STRUCT(NULL AS a)
]);

@ageiduschek ageiduschek changed the title Crash when using DATE inside of an UNNEST statement Crash when using DATE/NULL inside of an UNNEST statement Aug 30, 2022
@goccy goccy added the bug Something isn't working label Sep 2, 2022
@goccy
Copy link
Owner

goccy commented Sep 2, 2022

This problem fixed with v0.1.8

@ageiduschek
Copy link
Author

Confirmed this works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants