Repository: flink Updated Branches: refs/heads/master e9b865793 -> c2a404386
[FLINK-4270] [table] 'as' in front of join does not work This closes #2306. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/c2a40438 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/c2a40438 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/c2a40438 Branch: refs/heads/master Commit: c2a4043861c7595ee9d24bdce4a3236735af9bd9 Parents: e9b8657 Author: Jark Wu <wuchong...@alibaba-inc.com> Authored: Thu Jul 28 17:33:53 2016 +0800 Committer: twalthr <twal...@apache.org> Committed: Thu Aug 11 12:23:22 2016 +0200 ---------------------------------------------------------------------- .../org/apache/flink/api/table/plan/logical/operators.scala | 9 +++++---- .../org/apache/flink/api/scala/batch/table/JoinITCase.scala | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/c2a40438/flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/logical/operators.scala ---------------------------------------------------------------------- diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/logical/operators.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/logical/operators.scala index 79c3cb1..48da6c5 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/logical/operators.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/logical/operators.scala @@ -86,10 +86,11 @@ case class Project(projectList: Seq[NamedExpression], child: LogicalNode) extend if (allAlias) { // Calcite's RelBuilder does not translate identity projects even if they rename fields. // Add a projection ourselves (will be automatically removed by translation rules). - relBuilder.push( - LogicalProject.create(relBuilder.peek(), - projectList.map(_.toRexNode(relBuilder)).asJava, - projectList.map(_.name).asJava)) + val project = LogicalProject.create(relBuilder.peek(), + projectList.map(_.toRexNode(relBuilder)).asJava, + projectList.map(_.name).asJava) + relBuilder.build() // pop previous relNode + relBuilder.push(project) } else { relBuilder.project(projectList.map(_.toRexNode(relBuilder)): _*) } http://git-wip-us.apache.org/repos/asf/flink/blob/c2a40438/flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/table/JoinITCase.scala ---------------------------------------------------------------------- diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/table/JoinITCase.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/table/JoinITCase.scala index db629e6..f6e6081 100644 --- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/table/JoinITCase.scala +++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/batch/table/JoinITCase.scala @@ -55,8 +55,8 @@ class JoinITCase(mode: TestExecutionMode) extends MultipleProgramsTestBase(mode) val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment val tEnv = TableEnvironment.getTableEnvironment(env) - val ds1 = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv, 'a, 'b, 'c) - val ds2 = CollectionDataSets.get5TupleDataSet(env).toTable(tEnv, 'd, 'e, 'f, 'g, 'h) + val ds1 = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv).as('a, 'b, 'c) + val ds2 = CollectionDataSets.get5TupleDataSet(env).toTable(tEnv).as('d, 'e, 'f, 'g, 'h) val joinT = ds1.join(ds2).where('b === 'e && 'b < 2).select('c, 'g)