You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2018/11/29 07:40:06 UTC

[GitHub] imay closed pull request #359: Fix stream load failure and insert failure in regression testing.

imay closed pull request #359: Fix stream load failure and insert failure in regression testing.
URL: https://github.com/apache/incubator-doris/pull/359
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/fe/src/main/java/org/apache/doris/analysis/StmtRewriter.java b/fe/src/main/java/org/apache/doris/analysis/StmtRewriter.java
index d41e0232..c92d95a0 100644
--- a/fe/src/main/java/org/apache/doris/analysis/StmtRewriter.java
+++ b/fe/src/main/java/org/apache/doris/analysis/StmtRewriter.java
@@ -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());
diff --git a/fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java b/fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java
index e17a3fc0..d7469964 100644
--- a/fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java
+++ b/fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java
@@ -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) {
+            return expr.castTo(slotDesc.getType());
+        } else {
+            return expr;
         }
-
-        return expr;
     }
 
     @Override


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org