flink.api.table.TableException:不支持Type

时间:2016-06-23 13:06:50

标签: scala apache-flink flink-streaming

我正在尝试在scala中使用Flink Table API。编译时没有错误,但是我正在我的flink集群中运行作业:flink.api.table.TableException: Type is not supported:<GenericType<java.lang.Object>

我的maven依赖项:

<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-scala_2.11</artifactId>
    <version>${flink.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-streaming-scala_2.11</artifactId>
    <version>${flink.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.flink</groupId>
    <artifactId>flink-table_2.11</artifactId>
    <version>1.1-SNAPSHOT</version>
</dependency>

我的进口商品:

import org.apache.flink.streaming.api.scala._
import org.apache.flink.api.scala.table._
import org.apache.flink.api.table.{Row, Table, TableEnvironment}

我的代码:

// odo[(Long,String,Double,Long)]
val inputTable = odo.toTable(tableEnv,'ts,'ty, 'vl, 'dv)
val resultStream: Table = inputTable.where('ty === "Odometer").select('dv)
resultStream.toDataStream[Row].print

更新:我认为这可能与Flink版本(1.0.3)有关,因为当我这样做时:

val inputTable = odo.toTable(tableEnv, 'ts, 'ty, 'vl, 'dv)
val result = inputTable.select('dv,'vl.sum).where('dv == 111)
result.toDataStream[Row].print()

我有另一个例外:org.apache.flink.api.table.TableException: Aggregate on stream tables is currently not supported.

感谢任何帮助。谢谢。

1 个答案:

答案 0 :(得分:1)

Flink的Table API不支持GenericType中包含1.1-SNAPSHOT的字段。有Pull Request实现此功能。它很可能会包含在Flink 1.1版本中。

关于你的第二个异常:异常基本上是自我解释。到目前为止,您无法对流进行聚合。但是,StreamSQL位于development