Skip to content

Commit

Permalink
Add doc comment next to INTERNAL_GROUPING_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
eejbyfeldt committed Oct 5, 2024
1 parent 9e7c314 commit 920b384
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3066,6 +3066,23 @@ impl Aggregate {
}
}

/// Internal column used when the aggregation is a grouping set.
///
/// This column contains a bitmask where each bit represents a grouping
/// expression. The least significant bit corresponds to the rightmost
/// grouping expression. A bit value of 0 indicates that the corresponding
/// column is included in the grouping set, while a value of 1 means it is excluded.
///
/// For example, for the grouping expressions CUBE(a, b), the grouping ID
/// column will have the following values:
/// 0b00: Both `a` and `b` are included
/// 0b01: `b` is excluded
/// 0b10: `a` is excluded
/// 0b11: Both `a` and `b` are excluded
///
/// This internal column is necessary because excluded columns are replaced
/// with `NULL` values. To handle these cases correctly, we must distinguish
/// between an actual `NULL` value in a column and a column being excluded from the set.
pub const INTERNAL_GROUPING_ID: &'static str = "__grouping_id";
}

Expand Down

0 comments on commit 920b384

Please sign in to comment.