You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/05 06:09:00 UTC

[GitHub] [spark] itsvikramagr commented on a change in pull request #24922: [SPARK-28120][SS] Rocksdb state storage implementation

itsvikramagr commented on a change in pull request #24922: [SPARK-28120][SS]  Rocksdb state storage implementation
URL: https://github.com/apache/spark/pull/24922#discussion_r300551254
 
 

 ##########
 File path: core/src/main/java/org/apache/spark/io/FileUtility.java
 ##########
 @@ -0,0 +1,102 @@
+/*
+ * Licensed 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.spark.io;
+
+import org.apache.commons.compress.archivers.ArchiveException;
+import org.apache.commons.compress.archivers.ArchiveStreamFactory;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
+import org.apache.commons.compress.utils.IOUtils;
+
+import java.io.*;
+
+public class FileUtility {
+
+    /**
+     * Untar an input file into an output file.
+     *
+     * The output file is created in the output folder, having the same name as
+     * the input file, minus the '.tar' extension.
+     *
+     * @param inputFile the input .tar file
+     * @throws IOException
+     *
+     * @throws ArchiveException
+     */
+    public static void unTar(final File inputFile)
 
 Review comment:
   I have used the default encoding. If you look at the ZipEncodingHelper, you will find that 
   
   `    static final ZipEncoding UTF8_ZIP_ENCODING = new FallbackZipEncoding(UTF8);
    /**
        * Instantiates a zip encoding.
        * 
        * @param name The name of the zip encoding. Specify {@code null} for
        *             the platform's default encoding.
        * @return A zip encoding for the given encoding name.
        */
       public static ZipEncoding getZipEncoding(String name) {
    
           // fallback encoding is good enough for UTF-8.
           if (isUTF8(name)) {
               return UTF8_ZIP_ENCODING;
           }
         // fallback encoding is good enough for UTF-8.
           if (isUTF8(name)) {
               return UTF8_ZIP_ENCODING;
           } 
   `
   UTF-8 is the default encoding in spark (see [here](https://github.com/apache/spark/blob/master/pom.xml#L116)
   
   I will make changes to pass "utf-8" explicitly while creating the TarArchiveInputStream object instead of passing it "null" 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org