栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

12. GeoMesa数据保存篇之HDFS存储

12. GeoMesa数据保存篇之HDFS存储

一.简介 1.基于hdfs进行shape文件的读取
  1. 实现local shapefile 到 hdfs shape文件的写入
  2. 实现hdfs shape 文件的读取
2.hdfs shape文件的写入时比较麻烦的
  1. 指定schema: schema 支持AttributeSchema,CompositeSchema,DateTimeSchema,FlatSchema,SpatialSchema,SZ2Schema,Z2Schema
  2. 指定encoding: encoding 支持convert,orc,parquet 三种格式,具体代码建 ParquetFileSystemStorage,其他俩个类似
二.代码 1.写入RDD到HDFS目录
//写入hdfs shape文件
    def write_hdfs(inputRdd: SpatialRDD, hdfsHost: String, hdfsPath: String, hdfsFile: String)
                  (implicit sparkContext: SparkContext) = {

        println("默认分区数:".concat(inputRdd.getNumPartitions.toString))
        //        val shpCount = inputRdd.count();
        //        var rddCount = shpCount / 2000;
        //        if (shpCount - rddCount * 2000 > 0) {
        //            rddCount = r
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/281745.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号