Uncompress hadoop compatible snappy file

僤鯓⒐⒋嵵緔 提交于 2020-01-16 02:55:08

问题


Firehose is pushing data to s3 in snappy compressed form and its framing format is hadoop compatible. I am downloading that snappy file and trying to uncompress in scala using this library.

val input: Array[Byte] = Files.readAllBytes(Paths.get("/path/to/prod-a8d272bb-b7af-4141-bdba-6965b343a75f.snappy"))

val uncompressed: Array[Byte] = Snappy.uncompress(input)

Which throws error

Exception in thread "main" java.io.IOException: FAILED_TO_UNCOMPRESS(5)
    at org.xerial.snappy.SnappyNative.throw_error(SnappyNative.java:98)

It is possible to generate Hadoop Snappy compatible compressed stream using SnappyHadoopCompatibleOutputStream, but in my case, I need to uncompress an already generated compressed file. Is it possible with this library ? or if not, is there any other library I could use ?

来源:https://stackoverflow.com/questions/59612261/uncompress-hadoop-compatible-snappy-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!