imay closed pull request #383: Fix cast error in BrokerScanNode
URL: https://github.com/apache/incubator-doris/pull/383
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/planner/BrokerScanNode.java
b/fe/src/main/java/org/apache/doris/planner/BrokerScanNode.java
index b773cf29..6c1a47b9 100644
--- a/fe/src/main/java/org/apache/doris/planner/BrokerScanNode.java
+++ b/fe/src/main/java/org/apache/doris/planner/BrokerScanNode.java
@@ -411,25 +411,6 @@ private void finalizeParams(ParamCreateContext context)
throws UserException, An
context.tupleDescriptor.computeMemLayout();
}
- private Expr castToSlot(SlotDescriptor slotDesc, Expr expr) throws
AnalysisException {
- PrimitiveType destType = slotDesc.getType().getPrimitiveType();
- PrimitiveType srcType = expr.getType().getPrimitiveType();
-
- if (destType.isStringType()) {
- if (srcType.isStringType()) {
- return expr;
- } else {
- CastExpr castExpr = (CastExpr)expr.castTo(Type.VARCHAR);
- return castExpr;
- }
- } else if (destType != srcType) {
- CastExpr castExpr = (CastExpr)expr.castTo(slotDesc.getType());
- return castExpr;
- }
-
- return expr;
- }
-
private TScanRangeLocations newLocations(TBrokerScanRangeParams params,
String brokerName)
throws UserException {
List<Backend> candidateBes = Lists.newArrayList();
diff --git a/fe/src/main/java/org/apache/doris/planner/ScanNode.java
b/fe/src/main/java/org/apache/doris/planner/ScanNode.java
index 209cfc03..3410d1ac 100644
--- a/fe/src/main/java/org/apache/doris/planner/ScanNode.java
+++ b/fe/src/main/java/org/apache/doris/planner/ScanNode.java
@@ -62,6 +62,19 @@ public void setSortColumn(String column) {
sortColumn = column;
}
+ /**
+ * cast expr to SlotDescriptor type
+ */
+ protected Expr castToSlot(SlotDescriptor slotDesc, Expr expr) throws
UserException {
+ PrimitiveType dstType = slotDesc.getType().getPrimitiveType();
+ PrimitiveType srcType = expr.getType().getPrimitiveType();
+ if (dstType != srcType) {
+ return expr.castTo(slotDesc.getType());
+ } else {
+ return expr;
+ }
+ }
+
/**
* Returns all scan ranges plus their locations. Needs to be preceded by a
call to
* finalize().
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 d7469964..08cfaef4 100644
--- a/fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java
+++ b/fe/src/main/java/org/apache/doris/planner/StreamLoadScanNode.java
@@ -328,16 +328,6 @@ private void finalizeParams() throws UserException {
srcTupleDesc.computeMemLayout();
}
- private Expr castToSlot(SlotDescriptor slotDesc, Expr expr) throws
UserException {
- PrimitiveType dstType = slotDesc.getType().getPrimitiveType();
- PrimitiveType srcType = expr.getType().getPrimitiveType();
- if (dstType != srcType) {
- return expr.castTo(slotDesc.getType());
- } else {
- return expr;
- }
- }
-
@Override
protected void toThrift(TPlanNode planNode) {
planNode.setNode_type(TPlanNodeType.BROKER_SCAN_NODE);
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]