alamb commented on code in PR #7682:
URL: https://github.com/apache/arrow-datafusion/pull/7682#discussion_r1341584570
##########
datafusion/core/tests/user_defined/user_defined_aggregates.rs:
##########
@@ -169,6 +169,37 @@ async fn test_udaf_returning_struct_subquery() {
assert_batches_eq!(expected, &execute(&ctx, sql).await.unwrap());
}
+#[tokio::test]
+async fn test_udaf_shadows_builtin_fn() {
+ let TestContext {
+ mut ctx,
+ test_state,
+ } = TestContext::new();
+ let sql = "SELECT sum(arrow_cast(time, 'Int64')) from t";
+
+ // compute with builtin `sum` aggregator
+ let expected = [
+ "+-------------+",
+ "| SUM(t.time) |",
+ "+-------------+",
+ "| 19000 |",
+ "+-------------+",
+ ];
+ assert_batches_eq!(expected, &execute(&ctx, sql).await.unwrap());
+
+ // Register `TimeSum` with name `sum`. This will shadow the builtin one
Review Comment:
💯
##########
datafusion/core/tests/user_defined/user_defined_aggregates.rs:
##########
@@ -169,6 +169,37 @@ async fn test_udaf_returning_struct_subquery() {
assert_batches_eq!(expected, &execute(&ctx, sql).await.unwrap());
}
+#[tokio::test]
+async fn test_udaf_shadows_builtin_fn() {
+ let TestContext {
+ mut ctx,
+ test_state,
+ } = TestContext::new();
+ let sql = "SELECT sum(arrow_cast(time, 'Int64')) from t";
+
+ // compute with builtin `sum` aggregator
+ let expected = [
+ "+-------------+",
+ "| SUM(t.time) |",
+ "+-------------+",
+ "| 19000 |",
+ "+-------------+",
+ ];
+ assert_batches_eq!(expected, &execute(&ctx, sql).await.unwrap());
+
+ // Register `TimeSum` with name `sum`. This will shadow the builtin one
Review Comment:
💯
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]