mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-16 04:50:38 +00:00
feat: partition rule simplifier (#7622)
* basic impl Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * reuse collider Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * simplify range helpers Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * notes Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update unit test resule Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -1386,12 +1386,21 @@ impl StatementExecutor {
|
||||
.map(|expr| convert_one_expr(expr, &column_name_and_type, &timezone))
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
|
||||
let into_partition_exprs = request
|
||||
let mut into_partition_exprs = request
|
||||
.into_exprs
|
||||
.iter()
|
||||
.map(|expr| convert_one_expr(expr, &column_name_and_type, &timezone))
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
|
||||
// `MERGE PARTITION` (and some `REPARTITION`) generates a single `OR` expression from
|
||||
// multiple source partitions; try to simplify it for better readability and stability.
|
||||
if from_partition_exprs.len() > 1
|
||||
&& into_partition_exprs.len() == 1
|
||||
&& let Some(expr) = into_partition_exprs.pop()
|
||||
{
|
||||
into_partition_exprs.push(partition::simplify::simplify_merged_partition_expr(expr));
|
||||
}
|
||||
|
||||
// Parse existing partition expressions from region routes.
|
||||
let mut existing_partition_exprs =
|
||||
Vec::with_capacity(physical_table_route.region_routes.len());
|
||||
|
||||
Reference in New Issue
Block a user