[fix](Outfile) Infer the column name if the column is expression in select into outfile (#25854)

This pr do two things:
1. Infer the column name if the column is expression in `select into outfile`. The rule for column name generation can be refered in pr: #24990 
2. fix bug that it will core dump if the `_schema` fails to build in the open phase in vorc_transformer.cpp


TODO:
1. Support infer the column name if the column is expression in `select into outfile` in new optimizer(Nereids).
This commit is contained in:
Tiewei Fang
2023-10-25 22:49:04 +08:00
committed by GitHub
parent e783ef716f
commit 7f66be84d5
5 changed files with 540 additions and 3 deletions

View File

@ -545,7 +545,8 @@ public class SelectStmt extends QueryStmt {
resultExprs.add(rewriteQueryExprByMvColumnExpr(item.getExpr(), analyzer));
String columnLabel = null;
Class<? extends StatementBase> statementClazz = analyzer.getRootStatementClazz();
if (statementClazz != null && !QueryStmt.class.isAssignableFrom(statementClazz)) {
if (statementClazz != null
&& (!QueryStmt.class.isAssignableFrom(statementClazz) || hasOutFileClause())) {
// Infer column name when item is expr
columnLabel = item.toColumnLabel(i);
}