Skip to content

Fails to parse BigQuery UDF with "ANY TYPE" parameters #1601

Closed

Description

@MartinSahlen

EDIT: The "proper" name for this pattern is "Templated, SQL UDF Parameters", which can be further elaborated in the BQ Docs: https://cloud.google.com/bigquery/docs/user-defined-functions#templated-sql-udf-parameters

trying to parse this simple function like this:

fn main() {
    let sql = "
CREATE TEMP FUNCTION my_function(are_map ANY TYPE)
AS (
  (SELECT 1)
);
    ";

    let ast = Parser::parse_sql(&BigQueryDialect, sql).unwrap();
    for stmt in &ast {
        println!("{:?}", stmt);
    }
}

Yields this error:

thread 'main' panicked at src/main.rs:18:56:
called `Result::unwrap()` on an `Err` value: ParserError("Expected: ), found: TYPE at Line: 2, Column: 46")

I can try to have a look at this , seems relatively straightforward to fix!

Activity

  1. MartinSahlen commented on Dec 13, 2024

    @MartinSahlen
    ContributorAuthor

    Jus adding to the context that is is working in BigQuery - see screenshot:
    Screenshot 2024-12-13 at 16 16 57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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