Skip to content

Nested type modifiers/complex type #1932

@ct-badger

Description

@ct-badger

Example Trino SQL:

SELECT
    row_id,
    array_agg(
        CAST(
            ROW(
                total_amount
            )
            AS 
            ROW(
                total_amount    Decimal(14,2)
            )
        )
        ORDER BY payment_requested_date DESC
    ) AS payment_request_details
FROM
    iceberg.my_table_name
GROUP BY 1

This throws an error when using GenericDialect, specifically when it tries to parse Decimal(14,2): ParserError("Expected: type modifiers, found: ( at Line: 10, Column: 37")

Stepping through the code it looks like this is because it does not support deeply nested definitions because parse_optional_type_modifiers does not allow Token::LParen.

This may be by design, but it may break parsing when you get to really complex queries (e.g. deeply nested rows).

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