Mryange opened a new pull request, #62756:
URL: https://github.com/apache/doris/pull/62756
## What problem does this PR solve?
Problem Summary:
Multiple BE aggregate and array functions failed at runtime when given
`TIMESTAMPTZ` input, despite the FE planner accepting the queries. All failures
shared the same root cause: manually maintained primitive-type dispatch
switch-cases omitted `TYPE_TIMESTAMPTZ`.
Affected functions and errors:
| Function | Error |
|----------|-------|
| `max_by(timestamptz, ...)` / `min_by(timestamptz, ...)` | `Illegal type
TimeStampTz(6) of argument` |
| `max_by(..., timestamptz)` / `min_by(..., timestamptz)` | `Agg Function
max_by(..., timestamptz(6)) is not implemented` |
| `array_position` / `array_contains` / `countequal` with
`Array<TIMESTAMPTZ>` | `execute failed or unsupported types for function` |
| `map_agg_v2(timestamptz, ...)` | `Agg Function ... is not implemented` |
| `histogram(timestamptz)` | `Agg Function ... is not implemented` |
| `group_array_intersect(array<timestamptz>)` | `Agg Function ... is not
implemented` |
| `group_array_union(array<timestamptz>)` | `Agg Function ... is not
implemented` |
## Fix
**`aggregate_function_min_max_by.cpp` / `.h`** — Replace the large
switch-case in both `create_max_min_value()` and
`create_aggregate_function_min_max_by()` with `dispatch_switch_scalar()`, which
covers all scalar types including `TYPE_TIMESTAMPTZ` automatically. Only
non-scalar cases (`STRING`, `ARRAY`, `BITMAP`) are handled separately.
**`function_array_index.h`** — Replace the split `dispatch_switch_number()`
+ datetime if-else + IP if-else dispatch in `_execute_dispatch()` with a single
`dispatch_switch_scalar()` call.
**`aggregate_function_map_v2.cpp`** — Add `TYPE_TIMESTAMPTZ` to the key-type
switch.
**`aggregate_function_histogram.cpp`** — Add `TYPE_TIMESTAMPTZ` to
`creator_with_type_list`.
**`aggregate_function_group_array_set_op_impl.h`** — Replace the large
nested-type switch-case with `dispatch_switch_scalar()` + `is_string_type()`,
covering all scalar types including `TYPE_TIMESTAMPTZ` without manual
enumeration.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]