Reputation: 1161
How to read avro
from Flink
in scala
?
Is it the same for batch/stream/table: StreamExecutionEnvironment
/ ExecutionEnvironment
/ TableEnvironment
?
would it be sth like: val custTS: TableSource = new AvroInputFormat("/path/to/file", ...)
Below is java avro implementation ref (connectors), but can't find scala ref anywhere:
AvroInputFormat<User> users = new AvroInputFormat<User>(in, User.class);
DataSet<User> usersDS = env.createInput(users);
Upvotes: 1
Views: 394
Reputation: 13346
You can use Flink's InputFormats
, including the AvroInputFormat
, from the Java as well as the Scala API:
val avroInputStream = env.createInput(new AvroInputFormat[User](in, classOf[User]))
tableEnv.registerTable("table", avroInputStream.toTable)
Upvotes: 3