Skip to content

Commit f8f32d7

Browse files
committed
Adding compatibility documentation. Simplify field name
1 parent 2949a95 commit f8f32d7

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

proto/substrait/algebra.proto

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,8 @@ message AggregateRel {
375375

376376
// Various modes of operations of AggregateRel to capture different behaviors across systems.
377377
message Compatibility {
378-
// If true, the AggregateRel must not yield a row on empty input
379-
// when specified with non-empty groupings field even when groupings includes
380-
// empty grouping sets.
381-
bool groupings_yield_no_rows_on_empty_input = 1;
378+
// If true, the AggregateRel must not yield a row on empty input.
379+
bool yield_no_rows_on_empty_input = 1;
382380
}
383381
}
384382

site/docs/relations/logical_relations.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,25 @@ If at least one grouping expression is present, the aggregation is allowed to no
407407
| Per Grouping Set | A list of expression grouping that the aggregation measured should be calculated for. | Optional. |
408408
| Measures | A list of one or more aggregate expressions along with an optional filter. | Optional, required if no grouping sets. |
409409

410+
### Aggregate Compatibility
411+
412+
The aggregate operation is one of the most complex operations in the spec. Although implementations mostly agree on behaviors, there may be gaps in corner cases. Those behavioral differences are captured in compatibility.
413+
414+
NOTE: The compatibility is meant to address gaps in the core implementation of aggregation such as grouping sets. For custom aggregations, consider using aggregate extension functions. If you want to introduce a new compatibility mode, reach out Substrait PMC to discuss.
415+
416+
#### yield_no_rows_on_empty_input
417+
418+
AggregateRel **MUST NOT** produce a row on empty input even if the `groupings` is empty or `groupings` include an empty grounping set.
419+
420+
**Default:** ***false***. Both empty `groupings` or any empty grounping sets in `groupings` yield a row on empty input.
421+
**Compatibility for**: Microsoft SQL server family, Oracle.
422+
423+
**Example:**
424+
```sql
425+
-- The following two SQL statements yields a single row with value 0 in the systems DO NOT require this compatibility.
426+
SELECT COUNT(*) FROM T -- [(0)] when T is empty.
427+
SELECT COUNT(*) FROM T GROUP BY GROUNPING SETS (()) -- [] when T is empty in systems requiring this compatibility.
428+
```
410429

411430
=== "AggregateRel Message"
412431

0 commit comments

Comments
 (0)