简体   繁体   English

Avro对Flink的支持 - scala

[英]Avro support in Flink - scala

How to read avro from Flink in scala ? 如何在scala阅读Flink中的avro

Is it the same for batch/stream/table: StreamExecutionEnvironment / ExecutionEnvironment / TableEnvironment ? 批处理/流/表是否相同: StreamExecutionEnvironment / ExecutionEnvironment / TableEnvironment

would it be sth like: val custTS: TableSource = new AvroInputFormat("/path/to/file", ...) 它会是这样的: val custTS: TableSource = new AvroInputFormat("/path/to/file", ...)

Below is java avro implementation ref ( connectors ), but can't find scala ref anywhere: 下面是java avro实现ref( 连接器 ),但无法在任何地方找到scala ref:

  AvroInputFormat<User> users = new AvroInputFormat<User>(in, User.class);
  DataSet<User> usersDS = env.createInput(users);

You can use Flink's InputFormats , including the AvroInputFormat , from the Java as well as the Scala API: 您可以使用Flink的InputFormats ,包括Java中的AvroInputFormat以及Scala API:

  • Streaming & batch: val avroInputStream = env.createInput(new AvroInputFormat[User](in, classOf[User])) 流和批处理: val avroInputStream = env.createInput(new AvroInputFormat[User](in, classOf[User]))
  • Table API: tableEnv.registerTable("table", avroInputStream.toTable) 表API: tableEnv.registerTable("table", avroInputStream.toTable)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM