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/05/21 13:06:52 UTC

[GitHub] [flink] godfreyhe commented on a change in pull request #8440: [FLINK-12509] [table-planner-blink] Introduce planner rules about non semi/anti join

godfreyhe commented on a change in pull request #8440: [FLINK-12509] [table-planner-blink] Introduce planner rules about non semi/anti join
URL: https://github.com/apache/flink/pull/8440#discussion_r286013468
 
 

 ##########
 File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/rules/logical/JoinConditionTypeCoerceRule.scala
 ##########
 @@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.plan.rules.logical
+
+import org.apache.flink.table.api.TableException
+import org.apache.flink.table.plan.util.FlinkRexUtil
+
+import org.apache.calcite.plan.RelOptRule.{any, operand}
+import org.apache.calcite.plan.{RelOptRule, RelOptRuleCall, RelOptUtil}
+import org.apache.calcite.rel.`type`.RelDataTypeFactory
+import org.apache.calcite.rel.core.Join
+import org.apache.calcite.rex.{RexCall, RexInputRef, RexNode}
+import org.apache.calcite.sql.SqlKind
+import org.apache.calcite.sql.`type`.SqlTypeUtil
+
+import scala.collection.JavaConversions._
+import scala.collection.mutable
+
+/**
+  * Planner rule that coerces the both sides of EQUALS(`=`) operator in Join condition
+  * to the same type while sans nullability.
+  *
+  * <p>For most cases, we already did the type coercion during type validation by implicit
+  * type coercion or during sqlNode to relNode conversion, this rule just does a rechecking
+  * to ensure a strongly uniform equals type, so that during a HashJoin shuffle we can have
+  * the same hashcode of the same value.
+  */
+class JoinConditionTypeCoerceRule extends RelOptRule(
 
 Review comment:
   for non SEMI/ANTI join, type coerce is done in Calcite;  and for the SEMI/ANTI join, type coerce is done in this rule because Calcite does not check SubQuery.

----------------------------------------------------------------
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