These instructions apply to iotdb-core/relational-grammar/ and supplement the
repository instructions.
- For each new keyword token in the lexer portion of
RelationalSql.g4,
determine whether it is intentionally reserved. If it is not a reserved word, add the token
to the
nonReservedrule in the same change. Defining only the lexer token can make a previously valid unquoted database, table, column, or alias name stop parsing, because theidentifierrule accepts these keyword tokens throughnonReserved. - Keep
nonReservedas a list of token alternatives only; do not add nested parser rules. The DataNode SQL parser'sexitNonReservedimplementation depends on this structure. - Do not reserve a word accidentally by omitting it from
nonReserved, or make an existing reserved word non-reserved merely to resolve a grammar conflict. Intentional reservation must be part of the SQL change's contract and covered by compatibility tests. This rule is about keyword tokens, not operators, punctuation, whitespace, fragments, or literals.
- Cover the new SQL syntax and non-reserved keyword use as unquoted identifiers in the relevant database/table/column/alias positions, including case variants. Quoted-only tests do not protect unquoted-name compatibility. For intentionally reserved words, verify rejection in unquoted identifier positions and acceptance with supported quoting.
- The existing StreamKeywordTest demonstrates reserved and non-reserved identifier checks. For integration coverage, follow integration-test/AGENTS.md and use the table-model profile.
- Edit the
.g4sources and regenerate through Maven; do not edit generated Java,.tokens, or.interpfiles. Rebuild the affected grammar and DataNode consumers and run the affected parser/identifier tests. Successful grammar generation alone does not establish identifier compatibility or correct AST construction.