You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/07/04 07:23:48 UTC

[GitHub] [flink] dawidwys commented on a change in pull request #8977: [FLINK-13071][table-planner-blink] QueryOperationConverter in Blink planner support add kinds of QueryOperations.

dawidwys commented on a change in pull request #8977: [FLINK-13071][table-planner-blink] QueryOperationConverter in Blink planner support add kinds of QueryOperations.
URL: https://github.com/apache/flink/pull/8977#discussion_r300258539
 
 

 ##########
 File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/expressions/RexNodeConverter.java
 ##########
 @@ -125,13 +328,127 @@ private RexNode translateScalarCall(FunctionDefinition def, List<Expression> chi
 							type.getOutputDataType().getLogicalType().copy(child.getType().isNullable())),
 					child,
 					checkOverflow);
+		} else if (BuiltInFunctionDefinitions.IN.equals(def)) {
+			Expression headExpr = children.get(1);
+			if (headExpr instanceof TableReferenceExpression) {
+				QueryOperation tableOperation = ((TableReferenceExpression) headExpr).getQueryOperation();
+				RexNode child = children.get(0).accept(this);
+				return RexSubQuery.in(
+						((FlinkRelBuilder) relBuilder).queryOperation(tableOperation).build(),
+						ImmutableList.of(child));
+			} else {
+				List<RexNode> child = convertCallChildren(children);
+				return relBuilder.call(FlinkSqlOperatorTable.IN, child);
+			}
+		} else if (BuiltInFunctionDefinitions.GET.equals(def)) {
+			RexNode child = children.get(0).accept(this);
 
 Review comment:
   How about extracting methods like `convertGet/In/Trim`. A method of hundreds of lines is extremely hard to read.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services