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

Support INTERVAL type #280

Open
apstndb opened this issue Jan 31, 2025 · 0 comments
Open

Support INTERVAL type #280

apstndb opened this issue Jan 31, 2025 · 0 comments

Comments

@apstndb
Copy link
Contributor

apstndb commented Jan 31, 2025

INTERVAL type is not yet officially released, but it is available in API definition and it can already be used partially.

https://github.com/googleapis/google-cloud-go/blob/8500e9eb4ec11530dce02573a79cec98361e2d7b/spanner/apiv1/spannerpb/type.pb.go#L108-L113

spanner> SELECT CAST("P1Y2M3DT4H5M6.5S" AS INTERVAL);
+------------------+
|                  |
| INTERVAL         |
+------------------+
| P1Y2M3DT4H5M6.5S |
+------------------+
1 rows in set (0.12 msecs)

Currently, memefish can't parse this query because INTERVAL is keyword.

$ go run github.com/cloudspannerecosystem/memefish/tools/parse@latest -mode statement "SELECT CAST("P1Y2M3DT4H5M6.5S" AS INTERVAL);"                
--- Error
syntax error: :1:33: expected token: <ident>, ARRAY, STRUCT, but: INTERVAL
  1|  SELECT CAST(P1Y2M3DT4H5M6.5S AS INTERVAL);
   |                                  ^~~~~~~~
syntax error: :1:42: expected token: <eof>, but: ;
  1|  SELECT CAST(P1Y2M3DT4H5M6.5S AS INTERVAL);
   |                                           ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant