Skip to content

Commit

Permalink
[MINOR]: Add getter methods to first and last value (#8555)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafasrepo authored Dec 15, 2023
1 parent f54eeea commit 82235ae
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions datafusion/physical-expr/src/aggregate/first_last.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,31 @@ impl FirstValue {
ordering_req,
}
}

/// Returns the name of the aggregate expression.
pub fn name(&self) -> &str {
&self.name
}

/// Returns the input data type of the aggregate expression.
pub fn input_data_type(&self) -> &DataType {
&self.input_data_type
}

/// Returns the data types of the order-by columns.
pub fn order_by_data_types(&self) -> &Vec<DataType> {
&self.order_by_data_types
}

/// Returns the expression associated with the aggregate function.
pub fn expr(&self) -> &Arc<dyn PhysicalExpr> {
&self.expr
}

/// Returns the lexical ordering requirements of the aggregate expression.
pub fn ordering_req(&self) -> &LexOrdering {
&self.ordering_req
}
}

impl AggregateExpr for FirstValue {
Expand Down Expand Up @@ -285,6 +310,31 @@ impl LastValue {
ordering_req,
}
}

/// Returns the name of the aggregate expression.
pub fn name(&self) -> &str {
&self.name
}

/// Returns the input data type of the aggregate expression.
pub fn input_data_type(&self) -> &DataType {
&self.input_data_type
}

/// Returns the data types of the order-by columns.
pub fn order_by_data_types(&self) -> &Vec<DataType> {
&self.order_by_data_types
}

/// Returns the expression associated with the aggregate function.
pub fn expr(&self) -> &Arc<dyn PhysicalExpr> {
&self.expr
}

/// Returns the lexical ordering requirements of the aggregate expression.
pub fn ordering_req(&self) -> &LexOrdering {
&self.ordering_req
}
}

impl AggregateExpr for LastValue {
Expand Down

0 comments on commit 82235ae

Please sign in to comment.