Skip to content

Apache DataFusion SQL Query Engine

fix: set `supports_retract_batch` to false for `ApproxPercentileAccumulator` (#12132)

Jonah Gao6f183043e9c2
diff --git a/datafusion/functions-aggregate/src/approx_percentile_cont.rs b/datafusion/functions-aggregate/src/approx_percentile_cont.rs
index e860783dbe..867dfed485 100644
--- a/datafusion/functions-aggregate/src/approx_percentile_cont.rs
+++ b/datafusion/functions-aggregate/src/approx_percentile_cont.rs
@@ -460,10 +460,6 @@ impl Accumulator for ApproxPercentileAccumulator {
+ self.return_type.size()
- std::mem::size_of_val(&self.return_type)
}
-
- fn supports_retract_batch(&self) -> bool {
- true
- }
}
#[cfg(test)]
diff --git a/datafusion/sqllogictest/test_files/aggregate.slt b/datafusion/sqllogictest/test_files/aggregate.slt
index c3609e59f2..b826dd31f4 100644
--- a/datafusion/sqllogictest/test_files/aggregate.slt
+++ b/datafusion/sqllogictest/test_files/aggregate.slt
@@ -104,6 +104,11 @@ SELECT approx_percentile_cont(c12, c12) FROM aggregate_test_100
statement error DataFusion error: This feature is not implemented: Tdigest max_size value for 'APPROX_PERCENTILE_CONT' must be a literal
SELECT approx_percentile_cont(c12, 0.95, c5) FROM aggregate_test_100
+# Not supported over sliding windows
+query error This feature is not implemented: Aggregate can not be used as a sliding accumulator because `retract_batch` is not implemented
+SELECT approx_percentile_cont(c3, 0.5) OVER (ROWS BETWEEN 4 PRECEDING AND CURRENT ROW)
+FROM aggregate_test_100
+
# array agg can use order by
query ?
SELECT array_agg(c13 ORDER BY c13)