walterddr commented on a change in pull request #7460:
URL: https://github.com/apache/pinot/pull/7460#discussion_r714070904



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/exception/QueryException.java
##########
@@ -144,17 +153,29 @@ public static ProcessingException 
getException(ProcessingException processingExc
     return copiedProcessingException;
   }
 
-  public static String getTruncatedStackTrace(Exception exception) {
+  public static String getTruncatedStackTrace(Throwable exception) {
     StringWriter stringWriter = new StringWriter();
     exception.printStackTrace(new PrintWriter(stringWriter));
     String fullStackTrace = stringWriter.toString();
     String[] lines = fullStackTrace.split("\n");
-    int numLinesOfStackTrace = Math.min(lines.length, _maxLinesOfStackTrace);
-    int lengthOfStackTrace = numLinesOfStackTrace - 1;
-    for (int i = 0; i < numLinesOfStackTrace; i++) {
-      lengthOfStackTrace += lines[i].length();
+    // exception should at least have one line, no need to check here.
+    StringBuilder sb = new StringBuilder(lines[0]);
+    int lengthOfStackTrace = 1;

Review comment:
       technically not the same thing. i specifically dont want to name them 
the same since the _maxNumLineOfStackTrace actually was meant for 
_maxNumLineOfStackTrace per frame. I will adjust the whole naming




-- 
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: commits-unsubscr...@pinot.apache.org

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



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

Reply via email to