What can be Streamed
What can be Streamed
Flink用于Java和Scala的DataStream APIs将允许传输他们可以序列化的任何内容。
Flink的序列化器用于:
- 简单类型:String,Long,integer,Boolean,Array
- 复合类型:Tuples,POJOs,Scala case classes
而Flink对于其他类型则回归于Kryo。
Java
Tuples
对于Java而言,Flink定义了Tuple1到Tuple25类型。
Tuple2<String, Integer> person = new Tuple2<>("Fred", 35); // zero based index! String name = person.f0; Integer age = person.f1
POJOs
一个POJOs(普通的旧Java对象)是任何Java类:
- 有一个空的默认构造函数
- 所有域都是以下之一:
- public
- 有一个默认的getter和setter
例如:
public class Person { public String name; public Integer age; public Person() {}; public Person(String name, Integer age) { ... }; } Person person = new Person("Fred Flintstone", 35);
Scala tuples和 case classes
这些工作正如您所期望的那样。
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
hive连接eclipse
1、在Hadoop/etc/core-site.xml中新增 <property> <name>hadoop.proxyuser.qiqi.hosts</name> <value>主节点地址</value> </property> <property> <name>hadoop.proxyuser.qiqi.groups</name> <value>*</value> </property> 修改后重启Hadoop 测试:./beeline -u 'jdbc:hive2://localhost:10000/userdb' -n doutao 2、到hive/conf/hive-site.xml文件下,修改文件 <configuration> <property> <name>hive.server2.thrift.port</name> <value>10000</value&g...
- 下一篇
A Complete Example
A Complete Example 这个例子将关于人员的记录流作为输入,并将其过滤为只包含成人。 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.api.common.functions.FilterFunction; public class Example { public static void main(String[] args) throws Exception { final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Person> flintstones = env.fromElements( new Person("Fred", ...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2全家桶,快速入门学习开发网站教程
- Hadoop3单机部署,实现最简伪集群
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- CentOS关闭SELinux安全模块
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS7,CentOS8安装Elasticsearch6.8.6
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- CentOS8安装Docker,最新的服务器搭配容器使用