flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 刘 文 <thinktothi...@yahoo.com>
Subject flink tableapi inner join exception
Date Fri, 15 Mar 2019 13:03:27 GMT
Exception in thread "main" org.apache.flink.table.api.ValidationException: join relations with
ambiguous names: id, name, value
	at org.apache.flink.table.plan.logical.LogicalNode.failValidation(LogicalNode.scala:156)
	at org.apache.flink.table.plan.logical.Join.validate(operators.scala:463)
	at org.apache.flink.table.api.Table.join(table.scala:589)
	at org.apache.flink.table.api.Table.join(table.scala:397)
	at com.opensourceteams.module.bigdata.flink.example.tableapi.operation.innerJoin.Run$.main(Run.scala:26)
	at com.opensourceteams.module.bigdata.flink.example.tableapi.operation.innerJoin.Run.main(Run.scala)



————————————————————————————————————————————————————


package com.opensourceteams.module.bigdata.flink.example.tableapi.operation.innerJoin

import org.apache.flink.api.scala.{ExecutionEnvironment, _}
import org.apache.flink.table.api.TableEnvironment
import org.apache.flink.table.api.scala._

object Run {


  def main(args: Array[String]): Unit = {

    val env = ExecutionEnvironment.getExecutionEnvironment
    val tableEnv = TableEnvironment.getTableEnvironment(env)

    val dataSet = env.fromElements( (1,"a",10),(2,"b",20), (3,"c",30) )
    val dataSet2 = env.fromElements( (1,"a",10),(20,"b",20), (30,"c",30) )



    //从dataset转化为 table
    val table = tableEnv.fromDataSet(dataSet,'id,'name,'value)
    val table2 = tableEnv.fromDataSet(dataSet2,'id,'name,'value)



   table.join(table2).where(" id = id ").first(1000).print()






  }

}






Best,
thinktothings




Mime
View raw message