Github user Stibbons commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14180#discussion_r76073814
  
    --- Diff: 
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala ---
    @@ -68,6 +100,135 @@ private[spark] class PythonWorkerFactory(pythonExec: 
String, envVars: Map[String
         }
       }
     
    +
    +  def unzipWheelhouse(zipFile: String, outputFolder: String): Unit = {
    +
    +    val buffer = new Array[Byte](1024)
    +
    +    try {
    +
    +      // output directory
    +      val folder = new File(outputFolder);
    +      if (!folder.exists()) {
    +        folder.mkdir();
    +      }
    +
    +      // zip file content
    +      val zis: ZipInputStream = new ZipInputStream(new 
FileInputStream(zipFile));
    +      // get the zipped file list entry
    +      var ze: ZipEntry = zis.getNextEntry();
    +
    +      while (ze != null) {
    +        breakable {
    +
    +          if (ze.isDirectory()) {
    +            // continue
    +            break;
    +          }
    +
    +          val fileName = ze.getName();
    +          val newFile = new File(outputFolder + File.separator + fileName);
    +
    +          logDebug("file unzip : " + newFile.getAbsoluteFile());
    +
    +          // create folders
    +          new File(newFile.getParent()).mkdirs();
    +
    +          val fos = new FileOutputStream(newFile);
    +
    +          var len: Int = zis.read(buffer);
    +
    +          while (len > 0) {
    +
    +            fos.write(buffer, 0, len)
    +            len = zis.read(buffer)
    +          }
    +
    --- End diff --
    
    Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to