Benoît Paris created FLINK-11399:
------------------------------------ Summary: Parsing nested ROW()s in SQL Key: FLINK-11399 URL: https://issues.apache.org/jira/browse/FLINK-11399 Project: Flink Issue Type: Bug Components: Table API & SQL Affects Versions: 1.7.1 Reporter: Benoît Paris Hi! I'm trying to build a nested structure in SQL (mapping to json with flink-json). This works fine: {code:java} INSERT INTO outputTable SELECT ROW(col1, col2) FROM ( SELECT col1, ROW(col1, col1) as col2 FROM inputTable ) tbl2 {code} (and I use it as a workaround), but it fails in the simpler version: {code:java} INSERT INTO outputTable SELECT ROW(col1, ROW(col1, col1)) FROM inputTable {code} , yielding the following stacktrace: {noformat} Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered ", ROW" at line 1, column 40. Was expecting one of: ")" ... "," <IDENTIFIER> ... "," <QUOTED_IDENTIFIER> ... "," <BACK_QUOTED_IDENTIFIER> ... "," <BRACKET_QUOTED_IDENTIFIER> ... "," <UNICODE_QUOTED_IDENTIFIER> ... at org.apache.flink.table.calcite.FlinkPlannerImpl.parse(FlinkPlannerImpl.scala:94) at org.apache.flink.table.api.TableEnvironment.sqlUpdate(TableEnvironment.scala:803) at org.apache.flink.table.api.TableEnvironment.sqlUpdate(TableEnvironment.scala:777) at TestBug.main(TestBug.java:32) Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered ", ROW" at line 1, column 40. Was expecting one of: ")" ... "," <IDENTIFIER> ... "," <QUOTED_IDENTIFIER> ... "," <BACK_QUOTED_IDENTIFIER> ... "," <BRACKET_QUOTED_IDENTIFIER> ... "," <UNICODE_QUOTED_IDENTIFIER> ... at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:347) at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:128) at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:137) at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:162) at org.apache.flink.table.calcite.FlinkPlannerImpl.parse(FlinkPlannerImpl.scala:90) ... 3 more Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered ", ROW" at line 1, column 40. Was expecting one of: ")" ... "," <IDENTIFIER> ... "," <QUOTED_IDENTIFIER> ... "," <BACK_QUOTED_IDENTIFIER> ... "," <BRACKET_QUOTED_IDENTIFIER> ... "," <UNICODE_QUOTED_IDENTIFIER> ... at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:23019) at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:22836) at org.apache.calcite.sql.parser.impl.SqlParserImpl.ParenthesizedSimpleIdentifierList(SqlParserImpl.java:4466) at org.apache.calcite.sql.parser.impl.SqlParserImpl.Expression3(SqlParserImpl.java:3328) at org.apache.calcite.sql.parser.impl.SqlParserImpl.Expression2b(SqlParserImpl.java:3066) at org.apache.calcite.sql.parser.impl.SqlParserImpl.Expression2(SqlParserImpl.java:3092) at org.apache.calcite.sql.parser.impl.SqlParserImpl.Expression(SqlParserImpl.java:3045) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SelectExpression(SqlParserImpl.java:1525) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SelectItem(SqlParserImpl.java:1500) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SelectList(SqlParserImpl.java:1477) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlSelect(SqlParserImpl.java:912) at org.apache.calcite.sql.parser.impl.SqlParserImpl.LeafQuery(SqlParserImpl.java:552) at org.apache.calcite.sql.parser.impl.SqlParserImpl.LeafQueryOrExpr(SqlParserImpl.java:3030) at org.apache.calcite.sql.parser.impl.SqlParserImpl.QueryOrExpr(SqlParserImpl.java:2949) at org.apache.calcite.sql.parser.impl.SqlParserImpl.OrderedQueryOrExpr(SqlParserImpl.java:463) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlInsert(SqlParserImpl.java:1212) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmt(SqlParserImpl.java:847) at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:869) at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:184) at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:130) ... 5 more{noformat} I was thinking it could be a naming/referencing issue; or I was not using ROW() properly, in the json-idiomatic way I want to push on it. Anyway this is very minor, thanks for all the good work on Flink! Cheers, Ben -- This message was sent by Atlassian JIRA (v7.6.3#76005) |
Free forum by Nabble | Edit this page |