Fix stream load failure when target table contains HLL and insert failure when it contains subquery (#359)
This commit is contained in:
@ -48,6 +48,11 @@ public class StmtRewriter {
|
||||
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());
|
||||
|
||||
@ -329,24 +329,13 @@ public class StreamLoadScanNode extends ScanNode {
|
||||
}
|
||||
|
||||
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) {
|
||||
return expr.castTo(slotDesc.getType());
|
||||
} else {
|
||||
return expr;
|
||||
}
|
||||
|
||||
return expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user