Open Kamulau opened 1 year ago
Also, perhaps this is related to https://github.com/goccy/bigquery-emulator/issues/32
This is related to #265
I've fixed the TO_JSON() for the TimestampValue
in this PR https://github.com/goccy/go-zetasqlite/pull/111/files#diff-a710e43b641c24f0f092d550d22fd984a9f09c62b7b4b8e41db3144c0217f592R2105-R2108
I'm having the same problem. I have a query that returns a timestamp field in a struct. The emulator returns the timestamp as a string and bigquery can't convert it to a time.Time object and I get this error
panic: strconv.ParseInt: parsing "2024-10-12T18:05:52+02:00"
Did anyone manage to solve this?
I found the bug while writing an integration test using python and test-containers, and have also confirmed behavior via CLI.
Steps to reproduce via Python (used Python 3.8.16)
Python Error
Here is the error message when running the Python code above
ValueError: invalid literal for int() with base 10: '2021-11-29T22:00:00Z'
Steps to reproduce using CLI
CLI Actual Response
Here is the response of the second query via CLI, with the nested timestamp field:
CLI Expected Response
Here is the expected response (tested w/ BQ):
An aside
I have also found that you can wrap the struct with
TO_JSON_STRING
, and it mostly works for CLI (although the timestamp is formatted for JSON),but it does notit appears to work with the Python client. Note that the timestamp lacks double quotes (which is what BQ returns in this case):I have also tested the above with BigQuery, and there were no errors and CLI returned responses, as expected.