如何在hdfs hadoop中将多个zip文件合并到一个zip文件中

i86rm4rw  于 2021-06-02  发布在  Hadoop
关注(0)|答案(0)|浏览(245)

我正在运行一个mapreduce作业,为每一行键创建几个zip文件。我不能为所有记录创建一个zip文件,所以在hadoopmapreduce中有没有办法将多个所有zip文件合并到一个zip文件中呢。这就是我为每一行键创建zip文件的方法

@Override
        public void write(K key, V value) throws IOException {
            final String valueStr = value.toString();
            String strFullFileName[] = valueStr.split("\\|\\^\\|");
            String strKey = strFullFileName[0] + strFullFileName[1];

            ZipEntry ze = new ZipEntry(strKey);
            zipOut.closeEntry();
            zipOut.putNextEntry(ze);

            if (value instanceof BytesWritable) {
                zipOut.write(((BytesWritable) value).getBytes(), 0,
                        ((BytesWritable) value).getLength());
            } else {
                zipOut.write(value.toString().getBytes());
            }

        }

我们可以在mapreduce中合并多个zip文件吗?如果不能,请建议使用命令合并。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题