[Opt](load) use batching to optimize auto partition (#26915)
use batching to optimize auto partition
This commit is contained in:
@ -368,23 +368,30 @@ public class OlapTableSink extends DataSink {
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean enableAutomaticPartition = partitionInfo.enableAutomaticPartition();
|
||||
boolean enableAutomaticPartition = partitionInfo.enableAutomaticPartition();
|
||||
// for auto create partition by function expr, there is no any partition firstly,
|
||||
// But this is required in thrift struct.
|
||||
if (enableAutomaticPartition && partitionIds.isEmpty()) {
|
||||
partitionParam.setDistributedColumns(getDistColumns(table.getDefaultDistributionInfo()));
|
||||
partitionParam.setPartitions(new ArrayList<TOlapTablePartition>());
|
||||
}
|
||||
ArrayList<Expr> exprs = partitionInfo.getPartitionExprs();
|
||||
if (enableAutomaticPartition && exprs != null && analyzer != null) {
|
||||
|
||||
ArrayList<Expr> exprSource = partitionInfo.getPartitionExprs();
|
||||
if (enableAutomaticPartition && exprSource != null && analyzer != null) {
|
||||
Analyzer funcAnalyzer = new Analyzer(analyzer.getEnv(), analyzer.getContext());
|
||||
tupleDescriptor.setTable(table);
|
||||
funcAnalyzer.registerTupleDescriptor(tupleDescriptor);
|
||||
// we must clone the exprs. otherwise analyze will influence the origin exprs.
|
||||
ArrayList<Expr> exprs = new ArrayList<Expr>();
|
||||
for (Expr e : exprSource) {
|
||||
exprs.add(e.clone());
|
||||
}
|
||||
for (Expr e : exprs) {
|
||||
e.analyze(funcAnalyzer);
|
||||
}
|
||||
partitionParam.setPartitionFunctionExprs(Expr.treesToThrift(exprs));
|
||||
}
|
||||
|
||||
partitionParam.setEnableAutomaticPartition(enableAutomaticPartition);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user