Skip to content

Exception parsing query that casts ROW #1267

Description

@hdeyo

We are using JSqlParser (version 4.1) to parse queries from Amazon's Athena service. Many queries include a cast to a formatted ROW. Here is a simple example of this:

SELECT CAST(ROW(dataid, value, calcMark) AS ROW(datapointid CHAR, value CHAR, calcMark CHAR)) AS datapoints

This throws the following exception:

com.morningstar.neti.sqlparse.SqlParseException: Failed to parse sql: 'SELECT CAST(ROW(dataid, value, calcMark) AS ROW(datapointid CHAR, value CHAR, calcMark CHAR)) AS datapoints'
net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "ROW" "ROW"
at line 1, column 45.

Was expecting one of:

"BINARY"
"BIT"
"CHAR"
"CHARACTER"
"DOUBLE"
"INTERVAL"
"JSON"
"SET"
"SIGNED"
"UNSIGNED"
"XML"
<DT_ZONE>
<K_DATETIMELITERAL>
<K_DATE_LITERAL>
<S_IDENTIFIER>

Is this currently supported by the parser? If not, could it be added?

Thanks.

Activity

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