feat(partition): add expression split utility (#7822)

* feat(partition): add expression split utility

Implement MVP split logic with checker-safe degrade paths and move module under utils/split with aligned split naming and tests.

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor: minor

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: header

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: styling

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): degrade split when branch becomes unsatisfiable

Detect empty conjunction branches after split and return EmptyBranch instead of silently succeeding. This keeps split behavior aligned with expected partition semantics and adds regression tests for contradictory cuts.

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): tighten empty-branch split detection

Handle Eq/NotEq contradictions and discrete-gap unsatisfiable ranges in split empty-branch checks. Add regression tests for equality conflicts and impossible int/date intervals.

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): degrade singleton and uint impossible split branches

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): enforce finite float bounds in split degradation

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): drop date and timestamp support from expr split

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): reject nan and infinity in expr split

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor(partition): reuse conjunction bound collection in expr split

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: fmt

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: add comments

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix(partition): respect null-first semantics in empty branch checks

Signed-off-by: WenyXu <wenymedia@gmail.com>

* refactor(partition): restrict expr split to range-only shapes

Signed-off-by: WenyXu <wenymedia@gmail.com>

* docs(partition): clarify split helper scope and test names

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: add comments

Signed-off-by: WenyXu <wenymedia@gmail.com>

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
This commit is contained in:
Weny Xu
2026-03-27 15:22:02 +08:00
committed by GitHub
parent b57dfc18dc
commit 6f2ec12059
3 changed files with 1279 additions and 0 deletions

View File

@@ -27,5 +27,6 @@ pub mod partition;
pub mod simplify;
pub mod splitter;
pub mod subtask;
pub mod utils;
pub use crate::partition::{PartitionRule, PartitionRuleRef};

View File

@@ -0,0 +1,15 @@
// Copyright 2023 Greptime Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pub mod split;

File diff suppressed because it is too large Load Diff