You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/10/07 15:58:16 UTC

[GitHub] [doris] morningman commented on a diff in pull request #13129: jsonb parse function and load

morningman commented on code in PR #13129:
URL: https://github.com/apache/doris/pull/13129#discussion_r990241069


##########
fe/fe-core/src/main/java/org/apache/doris/planner/LoadScanNode.java:
##########
@@ -206,7 +206,23 @@ protected void finalizeParams(Map<String, SlotDescriptor> slotDescByName,
                 expr = new ArithmeticExpr(ArithmeticExpr.Operator.MULTIPLY, expr, new IntLiteral(-1));
                 expr.analyze(analyzer);
             }
-            expr = castToSlot(destSlotDesc, expr);
+
+            PrimitiveType dstType = destSlotDesc.getType().getPrimitiveType();
+            PrimitiveType srcType = expr.getType().getPrimitiveType();
+            if (srcType == PrimitiveType.VARCHAR && dstType == PrimitiveType.JSONB) {
+                List<Expr> args = Lists.newArrayList();
+                args.add(expr);
+                String nullable = "notnull";
+                if (destSlotDesc.getIsNullable() || expr.isNullable()) {
+                    nullable = "nullable";
+                }
+                String name = "jsonb_parse_" + nullable + "_error_to_invalid";
+                expr = new FunctionCallExpr(name, args);
+                expr.analyze(analyzer);
+                System.out.println("xk debug use function " + name + " " + expr);

Review Comment:
   Remove this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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