You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Andi (JIRA)" <ji...@apache.org> on 2017/07/09 21:36:00 UTC

[jira] [Created] (HIVE-17064) GZipCoded doesn't handle zip files

Andi created HIVE-17064:
---------------------------

             Summary: GZipCoded doesn't handle zip files 
                 Key: HIVE-17064
                 URL: https://issues.apache.org/jira/browse/HIVE-17064
             Project: Hive
          Issue Type: Bug
          Components: Compression
    Affects Versions: 2.2.0
         Environment: OSX 10.12.5
Native Libraries
Hadoop 2.8 (Hive 2.2.0)

            Reporter: Andi


Attempting to read a zip file using GZip Coded created by:
 >echo "abcdef" | zip > /tmp/a.zip 
fails, while the same gzip succeeds.

Code below is scala, run in spark-shell ( 2.1):

import org.apache.hadoop.io.compress.zlib._
org.apache.hadoop.io.compress.zlib.ZlibFactory.isNativeZlibLoaded(spark.sparkContext.hadoopConfiguration)

val in = new java.io.FileInputStream("/tmp/a.zip")
val gcode = new org.apache.hadoop.io.compress.GzipCodec
gcode.setConf(spark.sparkContext.hadoopConfiguration)

val giz = gcode.createInputStream(in)
val lr = new org.apache.hadoop.util.LineReader(giz)

val text = new org.apache.hadoop.io.Text
scala> lr.readLine(text)
java.io.IOException: incorrect header check
  at org.apache.hadoop.io.compress.zlib.ZlibDecompressor.inflateBytesDirect(Native Method)
  at org.apache.hadoop.io.compress.zlib.ZlibDecompressor.decompress(ZlibDecompressor.java:227)
  at org.apache.hadoop.io.compress.DecompressorStream.decompress(DecompressorStream.java:91)
  at org.apache.hadoop.io.compress.DecompressorStream.read(DecompressorStream.java:85)
  at java.io.InputStream.read(InputStream.java:101)
  at org.apache.hadoop.util.LineReader.readDefaultLine(LineReader.java:211)
  at org.apache.hadoop.util.LineReader.readLine(LineReader.java:174)
  at org.apache.hadoop.util.LineReader.readLine(LineReader.java:365)
  ... 43 elided


Repeating the same with file created by:
echo "abcdef" |  gzip > /tmp/a.gz 
Works as expected



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)