XnY-wei opened a new pull request, #65681:
URL: https://github.com/apache/doris/pull/65681
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
AUTO PARTITION BY LIST previously accepted only bare column references
while RANGE already supported date_trunc / date_floor / date_ceil.
Extend LIST to accept a whitelist of functions (date_trunc, from_unixtime)
mixed with bare columns at any position, so users can write:
AUTO PARTITION BY LIST(date_trunc(dt, 'day'), region) ()
AUTO PARTITION BY LIST(from_unixtime(ts, 'yyyy-MM-dd'), biz) ()
### Release note
Design notes:
- DDL: remove the hard rejection in Nereids PartitionTableInfo, add a
LIST_PARTITION_FUNCTIONS whitelist in PartitionDesc, and relax
getColNamesFromExpr's LIST + FunctionCallExpr branch. Column type is
overridden per-position via a new PartitionExprUtil helper so that
from_unixtime(BIGINT) -> VARCHAR partition keys stay type-consistent
without altering the underlying schema column.
- Ingest: no BE change. The existing generic VExpr evaluation and the
LIST branch of getAddPartitionClauseFromPartitionValues already handle
multi-column tuples, so wiring is FE-only.
- Pruning: OneListPartitionEvaluator now takes per-slot partitionExprs
and, at positions whose key is a function output, keeps the partition
conservatively instead of doing raw literal equality against the
truncated key (which would silently prune correct partitions and lose
data). PartitionPruner is extended to plumb partitionExprs down and
skips the binarySearchFiltering fast path when function partitions are
present -- that path compares raw predicate values against stored key
literals and would trigger BIGINT-vs-VARCHAR type errors otherwise.
- SHOW CREATE: ListPartitionInfo.toSql now honors partitionExprs so AUTO
LIST tables with function expressions round-trip through SHOW CREATE
correctly instead of downgrading to bare columns.
- Guardrails: a new assertPartitionFormatAcceptable helper is invoked
from the sole DDL-path chokepoint (InternalCatalog) to reject
sub-hour granularities (date_trunc 'second'/'minute', from_unixtime
formats containing %s/%i or HH:...:ss) that would otherwise create
86400+ partitions per day. from_unixtime also requires an explicit
string-literal format for the same reason.
### 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]