[英]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:
val avroInputStream = env.createInput(new AvroInputFormat[User](in, classOf[User]))
val avroInputStream = env.createInput(new AvroInputFormat[User](in, classOf[User]))
tableEnv.registerTable("table", avroInputStream.toTable)
tableEnv.registerTable("table", avroInputStream.toTable)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.