随笔分类 -  avro

摘要:在Thrift,Protobuf和avro序列化框架中,不约而同使用了zigzag编码来对数字进行编码,从而达到减少数据传输量的目的。 zigzag算法的核心主要是去除二进制数字中的前导0,因为在绝大多数情况下,我们使用到的整数,往往是比较小的。 参考:小而巧的数字压缩算法:zigzag 在avro 阅读全文
posted @ 2021-05-21 13:57 tonglin0325 阅读(264) 评论(0) 推荐(0) 编辑
摘要:对比thrift使用TCompactProtocol协议,protobuf使用,以及avro使用AvroKeyOutputFormat格式进行序列化对数据进行序列化后数据量大小 由于thrift的binary数据类型不能再次序列化化成二进制,所以测试的schema中没有binary类型的字段 1.a 阅读全文
posted @ 2016-05-05 21:30 tonglin0325 阅读(259) 评论(0) 推荐(0) 编辑
摘要:1.DataFrame API读取avro文件 https://sparkbyexamples.com/spark/read-write-avro-file-spark-dataframe/ pom引入,spark2.4.0之后可以使用apache的spark-avro包,之前需要使用databri 阅读全文
posted @ 2016-03-26 22:50 tonglin0325 阅读(471) 评论(0) 推荐(0) 编辑
摘要:1.引入依赖 <!--parquet--> <dependency> <groupId>org.apache.parquet</groupId> <artifactId>parquet-avro</artifactId> <version>1.10.0</version> </dependency> 阅读全文
posted @ 2016-03-26 20:36 tonglin0325 阅读(206) 评论(0) 推荐(0) 编辑
摘要:1.下载avro-tools.jar https://archive.apache.org/dist/avro/avro-1.10.1/java/ avro-tools.jar常用命令:Working with Apache Avro files in Amazon S3 也可以查看help jav 阅读全文
posted @ 2016-03-20 17:12 tonglin0325 阅读(1534) 评论(0) 推荐(1) 编辑
摘要:和thrift这种每个字段有id的序列化框架不同,avro在schema变更(schema evolution)的时候,需要注意不能 阅读全文
posted @ 2016-03-11 23:12 tonglin0325 阅读(275) 评论(0) 推荐(0) 编辑
摘要:Hive支持使用avro serde作为序列化的方式,参考: https://cwiki.apache.org/confluence/display/hive/avroserde https://www.docs4dev.com/docs/zh/apache-hive/3.1.1/reference 阅读全文
posted @ 2016-03-04 14:15 tonglin0325 阅读(248) 评论(0) 推荐(0) 编辑
摘要:avro-protobuf项目提供ProtobufDatumReader类,可以用于从protobuf定义生成的java class中获得avro schema 使用方法如下: 1.引入依赖 <dependency> <groupId>org.apache.avro</groupId> <artif 阅读全文
posted @ 2015-08-09 13:23 tonglin0325 阅读(304) 评论(0) 推荐(0) 编辑
摘要:confleunt提供了一些方法,可以将protobuf schema转换成avro schema,用于支持将kafka protobuf序列化的message落盘成avro格式的文件 1.引入依赖 <repositories> <repository> <id>cloudera</id> <url 阅读全文
posted @ 2015-07-13 13:10 tonglin0325 阅读(337) 评论(0) 推荐(0) 编辑
摘要:1.使用java语言来实现avro序列化和反序列化 使用DatumWriter和DatumReader对avro进行序列化和反序列化 public static <T> byte[] binarySerializable(T t) { ByteArrayOutputStream out = new 阅读全文
posted @ 2015-07-10 22:00 tonglin0325 阅读(263) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示