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/03/12 06:07:35 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #23958: [SPARK-27045][SQL] SQL tab in UI shows actual SQL instead of callsite

dongjoon-hyun commented on a change in pull request #23958: [SPARK-27045][SQL] SQL tab in UI shows actual SQL instead of callsite
URL: https://github.com/apache/spark/pull/23958#discussion_r264532289
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
 ##########
 @@ -71,13 +74,22 @@ object SQLExecution {
       // streaming queries would give us call site like "run at <unknown>:0"
       val callSite = sc.getCallSite()
 
+      val truncateLength = sc.conf.get(SQL_EVENT_TRUNCATE_LENGTH)
+
+      val desc = Option(sc.getLocalProperty(SparkContext.SPARK_JOB_DESCRIPTION))
+        .filter(_ => truncateLength > 0)
+        .map { sqlStr =>
+          Utils.redact(sparkSession.sessionState.conf.stringRedactionPattern, sqlStr)
+            .substring(0, Math.min(truncateLength, sqlStr.length))
 
 Review comment:
   Ur, this line is unsafe because it will throw `IndexOutOfBoundsException` if redacted string is smaller than the original. We need to the length of redacted string to call `substring`.

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