You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The UNNEST([STRUCT(...), ...]) statement thats generated in BQ does not pass in any types. This causes all elements to be inferred as a number type, INT64 I think. The CAST that then happens in the SELECT statement fails on uncoercible types. Most obviously with DATE / TIMESTAMP. You can reproduce with this:
select cast(x as timestamp) from unnest([null]) as x
Action:
select cast(x as timestamp) from unnest([cast(null as timestamp)]) as x
Adding a cast to just the first index of the [...] array is sufficient for BQ to type it correctly. With or without the outer CAST which would then be a no-op. A real life query generated by the UT framework may look like this:
The
UNNEST([STRUCT(...), ...])
statement thats generated in BQ does not pass in any types. This causes all elements to be inferred as a number type,INT64
I think. TheCAST
that then happens in theSELECT
statement fails on uncoercible types. Most obviously withDATE
/TIMESTAMP
. You can reproduce with this:select cast(x as timestamp) from unnest([null]) as x
Action:
select cast(x as timestamp) from unnest([cast(null as timestamp)]) as x
Adding a cast to just the first index of the
[...]
array is sufficient for BQ to type it correctly. With or without the outerCAST
which would then be a no-op. A real life query generated by the UT framework may look like this:The text was updated successfully, but these errors were encountered: