Failing SQL Feature
A cast to a named ROW with one field parses successfully, but both Statement.toString() and StatementDeParser throw NullPointerException. This prevents applications from serializing or rewriting the parsed query.
SQL Example
SELECT CAST(ROW(1) AS ROW(x BIGINT))
Minimal Java reproduction (run each serialization call separately):
Statement statement = CCJSqlParserUtil.parse(
"SELECT CAST(ROW(1) AS ROW(x BIGINT))");
System.out.println(statement.toString());
StringBuilder output = new StringBuilder();
statement.accept(new StatementDeParser(output));
Expected: both paths preserve the query, including ROW(x BIGINT).
Actual: the first throws from CastExpression.toString(), and the second throws from ExpressionDeParser.visit(CastExpression, ...), because colDataType is null. The parser correctly stores the target in a one-element columnDefinitions list, but both serializers require its size to be greater than one before rendering it as a row type.
Software Information
- Reproduced with the Maven Central
com.github.jsqlparser:jsqlparser:5.4 artifact.
- Also reproduced on current master
26d3e02a78e061f5fecf2eb2e783bf0482e10840 (5.5-SNAPSHOT).
- Java 21.
- SQL dialect: Trino. Its ROW documentation describes named row fields; the type grammar permits one field:
ROW '(' rowField (',' rowField)* ')'.
The online formatter also returns -- failed to format start around this query.
The earlier #1267 / #1274 added support for casting to multi-field row types. This report concerns the remaining single-field serialization case.
Failing SQL Feature
A cast to a named
ROWwith one field parses successfully, but bothStatement.toString()andStatementDeParserthrowNullPointerException. This prevents applications from serializing or rewriting the parsed query.SQL Example
Minimal Java reproduction (run each serialization call separately):
Expected: both paths preserve the query, including
ROW(x BIGINT).Actual: the first throws from
CastExpression.toString(), and the second throws fromExpressionDeParser.visit(CastExpression, ...), becausecolDataTypeis null. The parser correctly stores the target in a one-elementcolumnDefinitionslist, but both serializers require its size to be greater than one before rendering it as a row type.Software Information
com.github.jsqlparser:jsqlparser:5.4artifact.26d3e02a78e061f5fecf2eb2e783bf0482e10840(5.5-SNAPSHOT).ROW '(' rowField (',' rowField)* ')'.The online formatter also returns
-- failed to format startaround this query.The earlier #1267 / #1274 added support for casting to multi-field row types. This report concerns the remaining single-field serialization case.