[Feature request] Support `GROUP BY ALL` syntax for improved query ergonomics (Table Model only)
Los mantenedores suelen responder en 1 día
@Eliaaazzz ya está trabajando en esto.
Desde el 28/3/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Search before asking
- I searched in the issues and found nothing similar.
Motivation
When performing complex aggregation queries, standard SQL requires users to explicitly repeat all non-aggregated columns from the SELECT list inside the GROUP BY clause. In real-world development and data analysis scenarios, this introduces several pain points:
- Tedious and Error-Prone Queries: When grouping by multiple dimensional attributes or tags (e.g.,
region,plant_id,device_model,status), users have to write these fields twice. If a user updates theSELECTlist during iteration but forgets to update theGROUP BYlist, it results in a syntax error. - High Friction in Exploratory Data Analysis (EDA): Data analysts frequently add or remove dimension columns to observe metrics at different granularities. Synchronizing the
SELECTandGROUP BYclauses for every minor adjustment breaks the analytical flow and reduces efficiency. - Alignment with Modern Analytical Databases: Mainstream modern OLAP and analytical databases (such as DuckDB, ClickHouse, etc.) already support the
GROUP BY ALLsyntax. It automatically infers the grouping columns, significantly simplifying SQL writing.
With the introduction of IoTDB's Table Model, the relational semantics are highly geared towards data analysts. Introducing GROUP BY ALL will further elevate the ease of use and the overall developer experience within the Table Model.
Solution
We propose introducing the GROUP BY ALL syntax into the IoTDB SQL dialect.
Note: To maintain architectural clarity and backward compatibility, this feature will ONLY be implemented within the Table Model. The existing Tree Model requires no changes.
The implementation will primarily focus on the frontend parsing and logical planning phases of the Table Model:
- Update Antlr4 Grammar (Parser): Modify the table-model-specific grammar file (
iotdb-core/relational-grammar/src/main/antlr4/org/apache/iotdb/db/relational/grammar/sql/RelationalSql.g4) to support theALLkeyword within theGROUP BYclause rules. - Rewrite Analyzer Logic (Analyzer / Logical Planner): Intercept the
GROUP BY ALLsyntax during the semantic analysis phase. If detected, the analyzer should iterate through the currentSELECTclause:- Automatically extract all scalar expressions or column references that do not contain aggregate functions.
- Implicitly convert these extracted expressions into Grouping Keys and inject them into the subsequent Logical Plan.
- Execution Engine Transparency: This feature is purely syntactic sugar. After the AST transformation by the Analyzer, the underlying logical plan and physical operators generated will be identical to a query where all columns are manually specified. Therefore, the physical execution layer and memory control require zero modifications.
- Edge Case Handling:
- If the
SELECTclause consists entirely of aggregate functions (e.g.,SELECT COUNT(s1), SUM(s2) FROM table GROUP BY ALL), the analyzer should recognize that there are no non-aggregated columns and equivalently transform it into a global aggregation (a query without aGROUP BYclause). - Ensure seamless compatibility with other clauses, such as
ORDER BY.
- If the
Example Usage:
USE plant_database;
-- Current Syntax (Standard, but verbose)
SELECT
region,
plant_id,
device_id,
AVG(temperature) AS avg_temp,
MAX(vibration) AS max_vib
FROM sensor_data
WHERE time >= 10
GROUP BY region, plant_id, device_id;
-- Proposed Syntax (Using GROUP BY ALL)
SELECT
region,
plant_id,
device_id,
AVG(temperature) AS avg_temp,
MAX(vibration) AS max_vib
FROM sensor_data
WHERE time >= 10
GROUP BY ALL;
Alternatives
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Lenguaje dominante
- Java
- Estrellas
- 6.4k
- Forks
- 1.2k
- Merge medio
- 1 d 17 h
- PR fusionados (30 d)
- 152
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iotdb
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/iotdb#18655 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports successAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug] 执行start-all.sh后无法启动集群问题Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column nameAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/iotdb
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
Black theme and viewing mode.Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
oracle/javavscode#652 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenAPITools/openapi-generator#25014 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
AloisSeckar/demos-java#380 ·