YufeiLiu created FLINK-18234:
--------------------------------
Summary: Implicit type conversion in join condition
Key: FLINK-18234
URL:
https://issues.apache.org/jira/browse/FLINK-18234 Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 1.10.1
Reporter: YufeiLiu
Execute sql "SELECT a1, b1 FROM A JOIN B ON a2 = b4", a2(BIGINT) b4(VARCHAR) will throw exception
{code}
org.apache.flink.table.api.TableException: VARCHAR(2147483647) and INTEGER does not have common type now
at org.apache.flink.table.planner.plan.rules.logical.JoinConditionTypeCoerceRule$$anonfun$onMatch$1.apply(JoinConditionTypeCoerceRule.scala:76)
at org.apache.flink.table.planner.plan.rules.logical.JoinConditionTypeCoerceRule$$anonfun$onMatch$1.apply(JoinConditionTypeCoerceRule.scala:65)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at org.apache.flink.table.planner.plan.rules.logical.JoinConditionTypeCoerceRule.onMatch(JoinConditionTypeCoerceRule.scala:65)
at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:328)
at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:562)
at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:427)
at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:264)
at org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:223)
at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:210)
at org.apache.flink.table.planner.plan.optimize.program.FlinkHepProgram.optimize(FlinkHepProgram.scala:69)
{code}
Should we do some implicit type coercion in this case? It works on old version, and also can use in WHERE condition like "WHERE a4 = 3"
--
This message was sent by Atlassian Jira
(v8.3.4#803005)