lincoln-lil commented on code in PR #20242: URL: https://github.com/apache/flink/pull/20242#discussion_r925114125
########## flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl: ########## @@ -2203,3 +2203,94 @@ SqlNode TryCastFunctionCall() : return operator.createCall(s.end(this), args); } } + +/** +* Parses a partition key/value, +* e.g. p or p = '10'. +*/ +SqlPartitionSpecProperty PartitionSpecProperty(): +{ + final SqlParserPos pos; + final SqlIdentifier key; + SqlNode value = null; +} +{ + key = SimpleIdentifier() { pos = getPos(); } + [ + LOOKAHEAD(1) + <EQ> value = Literal() + ] + { + return new SqlPartitionSpecProperty(key, value, pos); + } +} + +/** +* Parses a partition specifications statement, +* e.g. ANALYZE TABLE tbl1 partition(col1='val1', col2='val2') xxx +* or +* ANALYZE TABLE tbl1 partition(col1, col2) xxx. +*/ +void ExtendedPartitionSpecCommaList(SqlNodeList list) : +{ + SqlPartitionSpecProperty property; +} +{ + <LPAREN> + property = PartitionSpecProperty() + { + list.add(property); + } + ( + <COMMA> property = PartitionSpecProperty() + { + list.add(property); + } + )* + <RPAREN> +} + +/** Parses a comma-separated list of simple identifiers with position. */ +SqlNodeList SimpleIdentifierCommaListWithPosition() : +{ + final Span s; + final List<SqlNode> list = new ArrayList<SqlNode>(); +} +{ + { s = span(); } + SimpleIdentifierCommaList(list) { + return new SqlNodeList(list, s.end(this)); + } +} + +/** Parses an ANALYZE TABLE statement. */ +SqlNode SqlAnalyzeTable(): +{ + final Span s; + final SqlIdentifier tableName; + SqlNodeList partitionSpec = SqlNodeList.EMPTY; + SqlNodeList columns = SqlNodeList.EMPTY; + boolean allColumns = false; +} +{ + <ANALYZE> <TABLE> { s = span(); } + tableName = CompoundIdentifier() + [ + <PARTITION> { + partitionSpec = new SqlNodeList(getPos()); + ExtendedPartitionSpecCommaList(partitionSpec); Review Comment: I see.. hint parser doesn't support combined form options. Current version looks to me. Thanks for your explaination @godfreyhe -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org