Code review comment: put the code block back to `run` method and remove these functions

Code before review:
public void run(ConnectContext ctx, StmtExecutor executor) throws Exception {
if (ctx.isTxnModel()) {
throw new AnalysisException("insert into table command is not supported in txn model");
}
checkDatabaseAndTable(ctx);
getColumns();
getPartition();
ctx.getStatementContext().getInsertIntoContext().setTargetSchema(targetColumns);
LogicalPlanAdapter logicalPlanAdapter = new LogicalPlanAdapter(extractPlan(logicalQuery),
ctx.getStatementContext());
planner = new NereidsPlanner(ctx.getStatementContext());
planner.plan(logicalPlanAdapter, ctx.getSessionVariable().toThrift());
getTupleDesc();
addUnassignedColumns();
if (ctx.getMysqlChannel() != null) {
ctx.getMysqlChannel().reset();
}
String label = this.labelName;
if (label == null) {
label = String.format("label_%x_%x", ctx.queryId().hi, ctx.queryId().lo);
}
Transaction txn;
PlanFragment root = planner.getFragments().get(0);
DataSink sink = createDataSink(ctx, root);
Preconditions.checkArgument(sink instanceof OlapTableSink, "olap table sink is expected when"
+ " running insert into select");
txn = new Transaction(ctx, database, table, label, planner);
OlapTableSink olapTableSink = ((OlapTableSink) sink);
olapTableSink.init(ctx.queryId(), txn.getTxnId(), database.getId(), ctx.getExecTimeout(),
ctx.getSessionVariable().getSendBatchParallelism(), false);
olapTableSink.complete();
root.resetSink(olapTableSink);
if (isExplain()) {
executor.handleExplainStmt(((ExplainCommand) logicalQuery).getExplainString(planner));
return;
}
txn.executeInsertIntoSelectCommand(executor);
}

Line under review: getPartition();

Code after addressing the review:
public void run(ConnectContext ctx, StmtExecutor executor) throws Exception {
if (ctx.isTxnModel()) {
throw new AnalysisException("insert into table command is not supported in txn model");
}
LogicalPlanAdapter logicalPlanAdapter = new LogicalPlanAdapter(logicalQuery, ctx.getStatementContext());
planner = new NereidsPlanner(ctx.getStatementContext());
planner.plan(logicalPlanAdapter, ctx.getSessionVariable().toThrift());
if (ctx.getMysqlChannel() != null) {
ctx.getMysqlChannel().reset();
}
String label = this.labelName;
if (label == null) {
label = String.format("label_%x_%x", ctx.queryId().hi, ctx.queryId().lo);
}
PhysicalOlapTableSink<?> physicalOlapTableSink = ((PhysicalOlapTableSink) planner.getPhysicalPlan());
OlapTableSink sink = ((OlapTableSink) planner.getFragments().get(0).getSink());
Preconditions.checkArgument(!isTxnBegin, "an insert command cannot create more than one txn");
Transaction txn = new Transaction(ctx,
physicalOlapTableSink.getDatabase(),
physicalOlapTableSink.getTargetTable(), label, planner);
isTxnBegin = true;
sink.init(ctx.queryId(), txn.getTxnId(),
physicalOlapTableSink.getDatabase().getId(),
ctx.getExecTimeout(),
ctx.getSessionVariable().getSendBatchParallelism(), false);
sink.complete();
TransactionState state = Env.getCurrentGlobalTransactionMgr().getTransactionState(
physicalOlapTableSink.getDatabase().getId(),
txn.getTxnId());
if (state == null) {
throw new DdlException("txn does not exist: " + txn.getTxnId());
}
state.addTableIndexes(physicalOlapTableSink.getTargetTable());
executor.setProfileType(ProfileType.LOAD);
LOG.info("Nereids start to execute the insert command, query id: {}, txn id: {}",
ctx.queryId(), txn.getTxnId());
txn.executeInsertIntoTableCommand(executor);
if (ctx.getState().getStateType() == MysqlStateType.ERR) {
try {
String errMsg = Strings.emptyToNull(ctx.getState().getErrorMessage());
Env.getCurrentGlobalTransactionMgr().abortTransaction(
physicalOlapTableSink.getDatabase().getId(), txn.getTxnId(),
(errMsg == null ? "unknown reason" : errMsg));
} catch (Exception abortTxnException) {
LOG.warn("errors when abort txn. {}", ctx.getQueryIdentifier(), abortTxnException);
}
}
}