Skip to content

Support field names in BigQuery STRUCT #901

Closed
@gomesfernandes

Description

@gomesfernandes

I want to parse BigQuery queries that assign field names in their STRUCTs.
Example:

SELECT
    STRUCT(
        CONCAT(user.first_name, ' ', user.last_name) AS full_name,
        user.email AS email,
    ) AS viewer
FROM users

This corresponds to the typeless struct syntax mentioned in the BigQuery documentation, and which is as follows:
STRUCT( expr1 [AS field_name] [, ... ])

Note that without the aliases, the query is parsed successfully:

SELECT
    STRUCT(
        CONCAT(user.first_name, ' ', user.last_name),
        user.email
    ) AS viewer
FROM users

It seems there is already an ongoing PR related to BigQuery STRUCTs, but the description does not mention support for field names/aliases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions