本文整理汇总了Scala中org.apache.parquet.hadoop.metadata.CompressionCodecName类的典型用法代码示例。如果您正苦于以下问题:Scala CompressionCodecName类的具体用法?Scala CompressionCodecName怎么用?Scala CompressionCodecName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompressionCodecName类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ParquetWriterConfig
//设置package包名称以及导入依赖的类
package io.eels.component.parquet
import com.sksamuel.exts.Logging
import com.sksamuel.exts.config.ConfigSupport
import com.typesafe.config.{Config, ConfigFactory}
import org.apache.parquet.hadoop.ParquetWriter
import org.apache.parquet.hadoop.metadata.CompressionCodecName
case class ParquetWriterConfig(blockSize: Int,
pageSize: Int,
compressionCodec: CompressionCodecName,
enableDictionary: Boolean,
validating: Boolean)
object ParquetWriterConfig extends Logging with ConfigSupport {
def apply(): ParquetWriterConfig = apply(ConfigFactory.load())
def apply(config: Config): ParquetWriterConfig = {
val blockSize: Int = config.getIntOrElse("eel.parquet.blockSize", ParquetWriter.DEFAULT_BLOCK_SIZE)
val pageSize: Int = config.getIntOrElse("eel.parquet.pageSize", ParquetWriter.DEFAULT_PAGE_SIZE)
val compressionCodec = config.getString("eel.parquet.compressionCodec").toLowerCase() match {
case "gzip" => CompressionCodecName.GZIP
case "lzo" => CompressionCodecName.LZO
case "snappy" => CompressionCodecName.SNAPPY
case _ => CompressionCodecName.UNCOMPRESSED
}
logger.debug(s"Parquet writer will use blockSize = $blockSize; pageSize = $pageSize; compressionCodec = $compressionCodec")
ParquetWriterConfig(blockSize, pageSize, compressionCodec, true, true)
}
}