HonestManXin opened a new pull request, #57124:
URL: https://github.com/apache/doris/pull/57124
## Proposed changes
```
CREATE TABLE agg_array_sum_test (
`group_id` bigint(20) NOT NULL,
`array_column` array<bigint(20)> NULL
) ENGINE=OLAP
duplicate KEY(`group_id`)
DISTRIBUTED BY HASH(`group_id`) BUCKETS 2
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false"
);
```
Consider the data below, we want to sum the array data use a aggregation
function: agg_array_sum.
```
MySQL [demo]> select * from agg_array_sum_test;
+----------+--------------+
| group_id | array_column |
+----------+--------------+
| 2 | NULL |
| 2 | [40, 50, 60] |
| 2 | [10, 20] |
| 1 | [4, 5, 6] |
| 1 | [1, 2, 3] |
+----------+--------------+
5 rows in set (0.036 sec)
MySQL [demo]> select group_id, agg_array_sum(array_column) as sum_array from
agg_array_sum_test group by group_id;
+----------+--------------+
| group_id | sum_array |
+----------+--------------+
| 2 | [50, 70, 60] |
| 1 | [5, 7, 9] |
+----------+--------------+
2 rows in set (0.037 sec)
```
This function only support numerical data types
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]