Flink 可以支持以下的数据类型
基础数据类型
Flink 支持所有的Java和Scala基础数据类型,Int,Double,String …
val numbers: DataStream
[Long
] = env.fromElements
(1L,2L,3L,4L
)
Java 和 Scala元组(Tuples)
val numbers: DataStream
[(String,Integer
)] = env.fromElements
(
("张三",12
),
("李四",23
)
)
Scala 样例类(case classes)
case class Person
(name:String,age:Int
)
val numbers: DataStream
[(String,Integer
)] = env.fromElements
(
Person
("张三",12
),
Person
("李四",23
)
)
Java 简单对象(POJOS)
public class Person
{
public String name
;
public int age
;
public Person
(){}
public Person
(String name,int age
){
this.name
=name
;
this.age
=age
;
}
}
val numbers: DataStream
[(String,Integer
)] = env.fromElements
(
new Person
("张三",12
),
new Person
("李四",23
)
)
其它
Arrays, Lists, Maps 等,Flink都是支持的。