Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3119#discussion_r19909185
  
    --- Diff: core/src/main/scala/org/apache/spark/io/CompressionCodec.scala ---
    @@ -42,28 +43,52 @@ trait CompressionCodec {
       def compressedOutputStream(s: OutputStream): OutputStream
     
       def compressedInputStream(s: InputStream): InputStream
    -}
     
    +  def isAvailable() : Boolean = true
    +}
     
    -private[spark] object CompressionCodec {
    +private[spark] object CompressionCodec extends Logging {
     
    +  private val configKey = "spark.io.compression.codec"
       private val shortCompressionCodecNames = Map(
         "lz4" -> classOf[LZ4CompressionCodec].getName,
         "lzf" -> classOf[LZFCompressionCodec].getName,
         "snappy" -> classOf[SnappyCompressionCodec].getName)
     
       def createCodec(conf: SparkConf): CompressionCodec = {
    -    createCodec(conf, conf.get("spark.io.compression.codec", 
DEFAULT_COMPRESSION_CODEC))
    +    conf.getOption(configKey)
    +        .map(createCodec(conf, _))
    +        .orElse(createCodecFromName(conf, DEFAULT_COMPRESSION_CODEC))
    --- End diff --
    
    So, I know I suggested this, but I think this doesn't do the same thing as 
the PR description says.
    
    If the config option exists and the requested codec is not available, this 
will always try the default codecs. Instead, this should probably be something 
like:
    
        if (conf.contains(configKey)) {
           createCodec(...).getOrElse(throw new Blah("requested codec cannot be 
loaded"))
        } else
           createCodec(DEFAULT).orElse(createCodec(FALLBACK)).getOrElse(throw 
new Blah("cannot load defaults"))
        }


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to