|
15 | 15 | // specific language governing permissions and limitations |
16 | 16 | // under the License. |
17 | 17 |
|
18 | | -use arrow_schema::{Field, Schema}; |
| 18 | +use arrow::datatypes::{Field, Schema}; |
| 19 | +use datafusion::physical_expr::NullState; |
19 | 20 | use datafusion::{arrow::datatypes::DataType, logical_expr::Volatility}; |
20 | | -use datafusion_physical_expr::NullState; |
21 | 21 | use std::{any::Any, sync::Arc}; |
22 | 22 |
|
23 | | -use arrow::{ |
24 | | - array::{ |
25 | | - ArrayRef, AsArray, Float32Array, PrimitiveArray, PrimitiveBuilder, UInt32Array, |
26 | | - }, |
27 | | - datatypes::{ArrowNativeTypeOp, ArrowPrimitiveType, Float64Type, UInt32Type}, |
28 | | - record_batch::RecordBatch, |
| 23 | +use arrow::array::{ |
| 24 | + ArrayRef, AsArray, Float32Array, PrimitiveArray, PrimitiveBuilder, UInt32Array, |
29 | 25 | }; |
| 26 | +use arrow::datatypes::{ArrowNativeTypeOp, ArrowPrimitiveType, Float64Type, UInt32Type}; |
| 27 | +use arrow::record_batch::RecordBatch; |
| 28 | +use datafusion::common::{cast::as_float64_array, ScalarValue}; |
30 | 29 | use datafusion::error::Result; |
31 | | -use datafusion::prelude::*; |
32 | | -use datafusion_common::{cast::as_float64_array, ScalarValue}; |
33 | | -use datafusion_expr::{ |
| 30 | +use datafusion::logical_expr::{ |
34 | 31 | expr::AggregateFunction, |
35 | 32 | function::{AccumulatorArgs, AggregateFunctionSimplification, StateFieldsArgs}, |
36 | 33 | simplify::SimplifyInfo, |
37 | | - Accumulator, AggregateUDF, AggregateUDFImpl, GroupsAccumulator, Signature, |
| 34 | + Accumulator, AggregateUDF, AggregateUDFImpl, EmitTo, GroupsAccumulator, Signature, |
38 | 35 | }; |
| 36 | +use datafusion::prelude::*; |
39 | 37 |
|
40 | 38 | /// This example shows how to use the full AggregateUDFImpl API to implement a user |
41 | 39 | /// defined aggregate function. As in the `simple_udaf.rs` example, this struct implements |
@@ -308,7 +306,7 @@ impl GroupsAccumulator for GeometricMeanGroupsAccumulator { |
308 | 306 | } |
309 | 307 |
|
310 | 308 | /// Generate output, as specified by `emit_to` and update the intermediate state |
311 | | - fn evaluate(&mut self, emit_to: datafusion_expr::EmitTo) -> Result<ArrayRef> { |
| 309 | + fn evaluate(&mut self, emit_to: EmitTo) -> Result<ArrayRef> { |
312 | 310 | let counts = emit_to.take_needed(&mut self.counts); |
313 | 311 | let prods = emit_to.take_needed(&mut self.prods); |
314 | 312 | let nulls = self.null_state.build(emit_to); |
@@ -344,7 +342,7 @@ impl GroupsAccumulator for GeometricMeanGroupsAccumulator { |
344 | 342 | } |
345 | 343 |
|
346 | 344 | // return arrays for counts and prods |
347 | | - fn state(&mut self, emit_to: datafusion_expr::EmitTo) -> Result<Vec<ArrayRef>> { |
| 345 | + fn state(&mut self, emit_to: EmitTo) -> Result<Vec<ArrayRef>> { |
348 | 346 | let nulls = self.null_state.build(emit_to); |
349 | 347 | let nulls = Some(nulls); |
350 | 348 |
|
|
0 commit comments