Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions fe/src/main/java/org/apache/doris/analysis/StmtRewriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public static void rewrite(Analyzer analyzer, StatementBase parsedStmt)
QueryStmt analyzedStmt = (QueryStmt) parsedStmt;
Preconditions.checkNotNull(analyzedStmt.analyzer);
rewriteQueryStatement(analyzedStmt, analyzer);
} else if (parsedStmt instanceof InsertStmt) {
final InsertStmt insertStmt = (InsertStmt)parsedStmt;
final QueryStmt analyzedStmt = (QueryStmt)insertStmt.getQueryStmt();
Preconditions.checkNotNull(analyzedStmt.analyzer);
rewriteQueryStatement(analyzedStmt, analyzer);
} else {
throw new AnalysisException("Unsupported statement containing subqueries: "
+ parsedStmt.toSql());
Expand Down
19 changes: 4 additions & 15 deletions fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,24 +329,13 @@ private void finalizeParams() throws UserException {
}

private Expr castToSlot(SlotDescriptor slotDesc, Expr expr) throws UserException {
if (slotDesc.getType().isNull()) {
return expr;
}
PrimitiveType dstType = slotDesc.getType().getPrimitiveType();
PrimitiveType srcType = expr.getType().getPrimitiveType();
if (dstType.isStringType()) {
if (srcType.isStringType()) {
return expr;
} else {
CastExpr castExpr = (CastExpr)expr.castTo(Type.VARCHAR);
return castExpr;
}
} else if (dstType != srcType) {
CastExpr castExpr = (CastExpr)expr.castTo(slotDesc.getType());
return castExpr;
if (dstType != srcType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you delete origin stringType check

stringType check is used to make work with char and varchar, do you have test your path with char and varchar type with convert function which return is not these type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't produce CastExpr, when source and target are char or varchar, they are all treated as String in CastFunction. Expr has handled it in member function 'castTo'. And i have tested cases that table's attribute types contain char or varchar.

return expr.castTo(slotDesc.getType());
} else {
return expr;
}

return expr;
}

@Override
Expand Down