Skip to content

Apache DataFusion SQL Query Engine

[MINOR]: Add getter methods to first and last value (#8555)

Mustafa Akur82235aeaec0e
diff --git a/datafusion/physical-expr/src/aggregate/first_last.rs b/datafusion/physical-expr/src/aggregate/first_last.rs
index 0dc27dede8..5e2012bdbb 100644
--- a/datafusion/physical-expr/src/aggregate/first_last.rs
+++ b/datafusion/physical-expr/src/aggregate/first_last.rs
@@ -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 {
@@ -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 {