博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Spark保存HDFS示例
阅读量:7099 次
发布时间:2019-06-28

本文共 692 字,大约阅读时间需要 2 分钟。

hot3.png

  def saveAsNewAPIHadoopFile(

      path: String,
      keyClass: Class[_],
      valueClass: Class[_],
      outputFormatClass: Class[_ <: NewOutputFormat[_, _]],
      conf: Configuration = self.context.hadoopConfiguration): Unit = self.withScope {
    // Rename this as hadoopConf internally to avoid shadowing (see SPARK-2038).
    val hadoopConf = conf
    val job = NewAPIHadoopJob.getInstance(hadoopConf)
    job.setOutputKeyClass(keyClass)
    job.setOutputValueClass(valueClass)
    job.setOutputFormatClass(outputFormatClass)
    val jobConfiguration = job.getConfiguration
    jobConfiguration.set("mapreduce.output.fileoutputformat.outputdir", path)
    saveAsNewAPIHadoopDataset(jobConfiguration)
  }
 

转载于:https://my.oschina.net/u/778683/blog/2982869

你可能感兴趣的文章
SEO基础知识
查看>>
手机通讯录导入工具
查看>>
Java虚拟机精讲之内存分配与垃圾回收
查看>>
hadoop常见命令
查看>>
each用法(网络摘抄)
查看>>
菜鸟也可以自己封装万能ghost系统
查看>>
路由心生
查看>>
【python】 倒序输出字符串
查看>>
Spark 2.x kafka LocationStrategies 的几种方式
查看>>
EntboostChat 1.3发布,iOS开源手机IM,恩布IM
查看>>
细粒度的线程控制?使用Lock Condition~
查看>>
把非透明swf动画dreamweaver做成透明背景flash动画方法
查看>>
Servlet个人学习笔记
查看>>
不使用中间变量交换两数的值
查看>>
solr相关查询参数
查看>>
Opencv cvThreshould 函数
查看>>
Oracle_052_lesson_p7
查看>>
PHP设计模式学习笔记: 模版方法
查看>>
实现虚拟机linux共享上网(利用NAT)
查看>>
【MyBatis框架】查询缓存-一级缓存原理
查看>>