taozhi8833998 / node-sql-parser

Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList and convert it back to SQL
https://taozhi8833998.github.io/node-sql-parser/
Apache License 2.0
818 stars 181 forks source link

Athena parser error - UNNEST with db.schema.table #2224

Closed LaizaAngrest closed 1 day ago

LaizaAngrest commented 2 days ago

Describe the bug Athena parser error - UNNEST with db.schema.table

Database Engine Athena

To Reproduce

it('should parse a query with db.schema.table', function () {
    const parser = new SqlParserV2()
    const query = `
    SELECT
        j.id,
        h.created AS change_time,
        i.fromstring AS from_status,
        i.tostring AS to_status
    FROM
        "bronze_prod"."jira_issues" j
    CROSS JOIN
        UNNEST(j.changelog.histories) AS T (h)
    CROSS JOIN
        UNNEST(h.items) AS T (i)
    WHERE
        i.field = 'status'`
    const parsedSql = parser.parse(query, WarehouseType.Athena)
    expect(parsedSql).toBeDefined()
  })