Hi all, I would like to propose adding support for FROM-first syntax to IoTDB's Table SQL dialect.
*This feature improves the user experience in the following ways:* - Better IDE/CLI auto-completion: The IDE knows the table schema before the SELECT clause, enabling intelligent column suggestions - Logical flow alignment: FROM-first syntax aligns better with the actual execution order, and the human thought process defines the source first, then filter, then project - Quick data exploration: Instead of writing SELECT * FROM sensors, you simply write FROM sensors For more details, please refer to the GitHub issue: https://github.com/apache/iotdb/issues/17336 *Proposed Syntax:* Add a new grammar rule to RelationalSql.g4: fromFirstQuerySpecification : FROM relation (',' relation)* (SELECT setQuantifier? selectItem (',' selectItem)*)? (WHERE where=booleanExpression)? (GROUP BY groupBy)? (HAVING having=booleanExpression)? (WINDOW windowDefinition (',' windowDefinition)*)? ; Add the new rule as an alternative to queryPrimary: queryPrimary : querySpecification #queryPrimaryDefault | TABLE qualifiedName #table | VALUES expression (',' expression)* #inlineTable | '(' queryNoWith ')' #subquery | fromFirstQuerySpecification #fromFirstQuery // NEW ; *Usage Examples:* -- Current syntax SELECT temperature, humidity FROM sensors WHERE time >= 10; -- Proposed FROM-first syntax FROM sensors SELECT temperature, humidity WHERE time >= 10; -- Quick exploration (omitting SELECT implies SELECT *) FROM sensors LIMIT 10; *Implementation Approach:* 1. Grammar Update: Add fromFirstQuerySpecification rule to RelationalSql.g4 2. AST Builder: Add visitFromFirstQuerySpecification() in AstBuilder.java, reusing the existing visitQuerySpecification() logic with added handling for the omitted SELECT clause implying SELECT * 3. Testing: Add integration tests covering all new syntax scenarios 4. Documentation: Update IoTDB docs with usage examples and sample use cases *Note:* This is an additive feature for Table mode only; the traditional SELECT ... FROM ... syntax will remain fully supported. I will begin implementation once the community confirms the design. My GitHub handle is @Abdelrahman-358 if you would like to assign the issue to me. Any feedback or comments are welcome. Best regards, Abdelrahman
