li = (id, line) } li }).partitionBy(new HashPartitioner(30)).saveAsHadoopFile("D:\\caIJIBAO\\out3.0\\out15\\"+"/multi",classOf[String],classOf[String],classOf[RDDMultipleOutPutFormat ]) } } class RDDMultipleOutPutFormat extends MultipleTextOutputFormat[Any, Any]{ override def generateFileNameForKeyValue(key: Any, value: Any, name: String): String = (key+"/"+name) } object MultiOutFormat { def asNumber(a: Any) = a.asInstanceOf[AnyRef] match { case n: Number => true case _ => false } }
spark 按id 分区多目录输出
最新推荐文章于 2023-01-14 15:15:17 发布