Closed senbrow closed 1 year ago
Note: the examples above connect to an emulated spanner instance running in a local Docker container to evaluate the SQL.
I don't think this is a valid query. When I try to execute this against a Spanner table from the cloud console, I get the below error
Statement failed: Unsupported query shape: This query returns a STRUCT value constructed by a scalar subquery or struct construction syntax. Spanner does not yet support returning STRUCT except as arrays-of-structs. Rephrase your query to produce the struct value with an array subquery: ARRAY(SELECT AS STRUCT expr ...) or flatten the structs fields into the result.
Could you send a valid select statement against a Spanner table?
Environment details
OS type and version:
Linux Mint 5.15.0-79-generic #86-Ubuntu
Java version:20
Spanner Java Library Version:6.42.3
Steps to reproduce
ARRAY
ofSTRUCT
s in a query into aResultSet
STRUCT
contents to manually-constructed JavaStruct
objects.Code example
These are JUnit4 testcases implemented with AssertJ assertions:
EXAMPLE 1 (list of structs):
Result:
EXAMPLE 2 (piecewise comparison):
Result: