@@ -1063,7 +1063,7 @@ static Status on_partitions_created(void* writer, TCreatePartitionResult* result
10631063 return static_cast <VTabletWriter*>(writer)->on_partitions_created (result);
10641064}
10651065
1066- void VTabletWriter::_init_row_distribution () {
1066+ Status VTabletWriter::_init_row_distribution () {
10671067 VRowDistributionContext ctx;
10681068
10691069 ctx.state = _state;
@@ -1080,6 +1080,9 @@ void VTabletWriter::_init_row_distribution() {
10801080 ctx.schema = _schema;
10811081
10821082 _row_distribution.init (&ctx);
1083+
1084+ RETURN_IF_ERROR (_row_distribution.open (_output_row_desc));
1085+ return Status::OK ();
10831086}
10841087
10851088Status VTabletWriter::_init (RuntimeState* state, RuntimeProfile* profile) {
@@ -1218,19 +1221,13 @@ Status VTabletWriter::_init(RuntimeState* state, RuntimeProfile* profile) {
12181221 RETURN_IF_ERROR (_channels.back ()->init (state, tablets));
12191222 }
12201223
1221- // prepare for auto partition functions
1222- if (_vpartition->is_auto_partition ()) {
1223- auto [part_ctx, part_func] = _get_partition_function ();
1224- RETURN_IF_ERROR (part_ctx->prepare (_state, *_output_row_desc));
1225- RETURN_IF_ERROR (part_ctx->open (_state));
1226- }
12271224 if (_group_commit) {
12281225 RETURN_IF_ERROR (_state->exec_env ()->wal_mgr ()->add_wal_path (_db_id, _tb_id, _wal_id,
12291226 _state->import_label ()));
12301227 RETURN_IF_ERROR (_state->exec_env ()->wal_mgr ()->create_wal_writer (_wal_id, _wal_writer));
12311228 }
12321229
1233- _init_row_distribution ();
1230+ RETURN_IF_ERROR ( _init_row_distribution () );
12341231
12351232 _inited = true ;
12361233 return Status::OK ();
@@ -1287,11 +1284,6 @@ Status VTabletWriter::_incremental_open_node_channel(
12871284 return Status::OK ();
12881285}
12891286
1290- std::pair<vectorized::VExprContextSPtr, vectorized::VExprSPtr>
1291- VTabletWriter::_get_partition_function () {
1292- return {_vpartition->get_part_func_ctx (), _vpartition->get_partition_function ()};
1293- }
1294-
12951287Status VTabletWriter::_cancel_channel_and_check_intolerable_failure (
12961288 Status status, const std::string& err_msg, const std::shared_ptr<IndexChannel> ich,
12971289 const std::shared_ptr<VNodeChannel> nch) {
0 commit comments