Timo Walther created FLINK-4270: ----------------------------------- Summary: 'as' in front of join does not work Key: FLINK-4270 URL: https://issues.apache.org/jira/browse/FLINK-4270 Project: Flink Issue Type: Bug Components: Table API & SQL Reporter: Timo Walther
The following example passes the validation but fails during toRexNode phase: {code} val customers = getCustomerDataSet(env).toTable(tEnv) .as('id, 'mktSegment) val orders = getOrdersDataSet(env).toTable(tEnv) .as('orderId, 'custId, 'orderDate, 'shipPrio) val items = orders.join(customers) .where('custId === 'id) items.printOnTaskManager("ok") {code} Leads to {code} Exception in thread "main" java.lang.IllegalArgumentException: field [custId] not found; input fields are: [id, mktSegment, id0, mktSegment0] at org.apache.calcite.tools.RelBuilder.field(RelBuilder.java:299) at org.apache.calcite.tools.RelBuilder.field(RelBuilder.java:284) at org.apache.flink.api.table.expressions.ResolvedFieldReference.toRexNode(fieldExpression.scala:59) at org.apache.flink.api.table.expressions.BinaryComparison$$anonfun$toRexNode$1.apply(comparison.scala:34) at org.apache.flink.api.table.expressions.BinaryComparison$$anonfun$toRexNode$1.apply(comparison.scala:34) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) at scala.collection.AbstractTraversable.map(Traversable.scala:105) at org.apache.flink.api.table.expressions.BinaryComparison.toRexNode(comparison.scala:34) at org.apache.flink.api.table.plan.logical.Filter.construct(operators.scala:158) at org.apache.flink.api.table.plan.logical.LogicalNode.toRelNode(LogicalNode.scala:78) at org.apache.flink.api.table.Table.getRelNode(table.scala:66) at org.apache.flink.api.table.BatchTableEnvironment.translate(BatchTableEnvironment.scala:243) at org.apache.flink.api.scala.table.BatchTableEnvironment.toDataSet(BatchTableEnvironment.scala:139) at org.apache.flink.api.scala.table.package$.table2RowDataSet(package.scala:77) at org.apache.flink.examples.scala.TPCHQuery3Table$.main(TPCHQuery3Table.scala:119) at org.apache.flink.examples.scala.TPCHQuery3Table.main(TPCHQuery3Table.scala) {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)