【问题标题】:getting error while using table(Data stream) in flink在 flink 中使用表(数据流)时出错
【发布时间】:2019-10-05 15:22:33
【问题描述】:

我使用的是 flink 1.9.0,无法导入或获取表文件

我尝试过导入与之相关的不同 SBT

  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val tEnv = StreamTableEnvironment.create(env)

    val tempSource = CsvTableSource.builder()
      .path("/home/amulya/Desktop/csvForBroadcast/CSV.csv")
      .fieldDelimiter(",")
      .field("locationID", Types.STRING())
      .field("temp", Types.DOUBLE())
      .build()

    tEnv.registerTableSource("Temperatures", tempSource)

    val askTable = tEnv
      .scan("Temperatures")
      .where(" 'Temperature >= 50")
      .select("'locationID, 'temp")

    val stream = tEnv.toAppendStream[Events](askTable)
      .print()
    env.execute()


  }
  case class Events(locationID: String, temp: Long)
}


我有一个简单的CSV格式数据:-

locationID,temp
"1",25
"2",25
"3",35
"4",45
"5",55

这是错误:-

Error:scalac: missing or invalid dependency detected while loading class file 'ScalaCaseClassSerializer.class'.
Could not access type SelfResolvingTypeSerializer in object org.apache.flink.api.common.typeutils.TypeSerializerConfigSnapshot,
because it (or its dependencies) are missing. Check your build definition for
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
A full rebuild may help if 'ScalaCaseClassSerializer.class' was compiled against an incompatible version of org.apache.flink.api.common.typeutils.TypeSerializerConfigSnapshot.

我正在尝试对这些基本数据执行 CEP,以便开始使用 apache flink,非常感谢任何形式的帮助

【问题讨论】:

    标签: scala csv sbt apache-flink flink-cep


    【解决方案1】:

    试试 flink-table-api-java-bridge。

    目前scala桥模块只提供表和数据集/数据流之间的基本转换。

    【讨论】:

    • 非常感谢,我会尽力让您知道它是否适合我
    • 它工作了,但在使用过滤器时还有更多问题,cannot resolve overloaded method filter
    • 如果您在描述中添加您的代码会更好。我在图片中没有看到任何过滤器。
    • 完成,请立即查看
    • 删除过滤器中表达式末尾的“。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-26
    • 1970-01-01
    • 2016-12-06
    • 1970-01-01
    • 2019-07-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多