pralabhkumar commented on code in PR #417:
URL: https://github.com/apache/incubator-livy/pull/417#discussion_r1313868739


##########
server/src/main/scala/org/apache/livy/utils/SparkProcessBuilder.scala:
##########
@@ -154,6 +154,12 @@ class SparkProcessBuilder(livyConf: LivyConf) extends 
Logging {
     this
   }
 
+  def escapeBackTicks(arg: String): String = {
+    // Unescape the args first then escape it again to avoid double escaping
+    val tmp = arg.replace("\\`", "`")

Review Comment:
   Nit : Better naming for the tmp variable 



##########
server/src/main/scala/org/apache/livy/utils/SparkProcessBuilder.scala:
##########
@@ -154,6 +154,12 @@ class SparkProcessBuilder(livyConf: LivyConf) extends 
Logging {
     this
   }
 
+  def escapeBackTicks(arg: String): String = {

Review Comment:
   Please add scala doc for the method 



##########
server/src/test/scala/org/apache/livy/utils/SparkProcessBuilderSuite.scala:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.livy.utils
+
+import org.apache.livy.{LivyBaseUnitTestSuite, LivyConf}
+import org.scalatest.{BeforeAndAfter, FunSpec}
+
+class SparkProcessBuildSuite
+  extends FunSpec
+    with BeforeAndAfter
+    with org.scalatest.Matchers
+    with LivyBaseUnitTestSuite {
+
+  it("should only escape unescaped backticks") {

Review Comment:
   Please add the Jira number 
([LIVY-988](https://issues.apache.org/jira/browse/LIVY-988))  in the comments .



##########
server/src/main/scala/org/apache/livy/utils/SparkProcessBuilder.scala:
##########
@@ -154,6 +154,12 @@ class SparkProcessBuilder(livyConf: LivyConf) extends 
Logging {
     this
   }
 
+  def escapeBackTicks(arg: String): String = {

Review Comment:
   If this method is used only in SparkProcessBuilder , can u please make its 
access specification as private . Also please add check for arg , (what if its 
null/ None) 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to