You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2023/01/20 06:27:20 UTC

[GitHub] [kyuubi] pan3793 commented on a diff in pull request #4144: [KYUUBI #4106] Introduce resource file uploading in batch creation via REST API

pan3793 commented on code in PR #4144:
URL: https://github.com/apache/kyuubi/pull/4144#discussion_r1082138491


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/Utils.scala:
##########
@@ -147,6 +163,36 @@ object Utils extends Logging {
     dir
   }
 
+  /**
+   * write InputStream to temp file in directory
+   * @param is inputstream for file
+   * @param dir dir path for temp file creation
+   * @param fileName original file name with suffix
+   * @return created new temp file in dir in file name with random path
+   */
+  def writeToTempFile(is: InputStream, dir: Path, fileName: String): File = {

Review Comment:
   Please clearly document WHO is responsible to close the `is`, the caller, or this method? and what will happen if the thing goes wrong?



##########
kyuubi-common/src/main/scala/org/apache/kyuubi/Utils.scala:
##########
@@ -147,6 +163,36 @@ object Utils extends Logging {
     dir
   }
 
+  /**
+   * write InputStream to temp file in directory
+   * @param is inputstream for file
+   * @param dir dir path for temp file creation
+   * @param fileName original file name with suffix
+   * @return created new temp file in dir in file name with random path
+   */
+  def writeToTempFile(is: InputStream, dir: Path, fileName: String): File = {

Review Comment:
   please document WHO is responsible to close the `is`, caller, or this method? what will happen if things go wrong?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org