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 - cardinality function parsing error #2221

Closed LaizaAngrest closed 1 day ago

LaizaAngrest commented 4 days ago

Describe the bug Cardinality function parsing error

Database Engine Athena

To Reproduce

it('should parse a query with cardinality function', function () {
    const parser = new SqlParserV2()
    const query = `
    SELECT
      id,
      CAST(CURRENT_TIMESTAMP AS TIMESTAMP(6)) AS dbt_insert_time
    FROM
      some_table
    WHERE
      cardinality(
        filter(map_values(note), VALUE -> VALUE IS NOT NULL)
      ) = 0;
    `
    const parsedSql = parser.parse(query, WarehouseType.Athena)
    expect(parsedSql).toBeDefined()
  })