[
https://issues.apache.org/jira/browse/DRILL-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16956975#comment-16956975
]
ASF GitHub Bot commented on DRILL-5674:
---------------------------------------
arina-ielchiieva commented on pull request #1879: DRILL-5674: Support ZIP
compression
URL: https://github.com/apache/drill/pull/1879#discussion_r337452079
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/ZipCodec.java
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.store.dfs;
+
+import org.apache.hadoop.io.compress.CompressionInputStream;
+import org.apache.hadoop.io.compress.CompressionOutputStream;
+import org.apache.hadoop.io.compress.DefaultCodec;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * ZIP codec implementation which cna read or create single entry.
+ * <p/>
+ * Note: Do not rename this class. Class naming must be 'ZipCodec' so it can
be mapped by
+ * {@link org.apache.hadoop.io.compress.CompressionCodecFactory} to the 'zip'
extension.
+ */
+public class ZipCodec extends DefaultCodec {
+
+ private static final String EXTENSION = ".zip";
Review comment:
`org.apache.hadoop.io.compress` supports gzip, bzip2 out of box. We are
adding only zip codec implementation since it is missing in
`org.apache.hadoop.io.compress` library.
Regarding `.tar.gz`, I am not sure how to support since it basically two
compressions one over another and mostly is used for folders. Since Drill
allows only to read compressed files not folders, I think for now we don't need
it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Drill should support .zip compression
> -------------------------------------
>
> Key: DRILL-5674
> URL: https://issues.apache.org/jira/browse/DRILL-5674
> Project: Apache Drill
> Issue Type: Improvement
> Components: Storage - Text & CSV
> Affects Versions: 1.10.0
> Reporter: Paul Rogers
> Assignee: Arina Ielchiieva
> Priority: Major
> Labels: doc-impacting
> Fix For: 1.17.0
>
>
> Zip is a very common compression format. Create a compressed CSV file with
> column headers: data.csv.zip.
> Define a storage plugin config for the file, call it "dfs.myws", set
> delimiter = ",", extract header = true, skip header = false.
> Run a simple query:
> SELECT * FROM dfs.myws.`data.csv.zip`
> The result is garbage as the CSV reader is trying to parse Zipped data as if
> it were text.
> DRILL-5506 asks how to do this; the responder said to add a library to the
> path. Better would be to simply support zip out-of-the-box as a default
> format.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)