kunwp1 commented on code in PR #4876:
URL: https://github.com/apache/texera/pull/4876#discussion_r3178882635


##########
amber/src/main/scala/org/apache/texera/web/service/ExecutionResultService.scala:
##########
@@ -98,17 +98,15 @@ object ExecutionResultService {
                     value match {
                       case byteArray: Array[Byte] =>
                         val totalSize = byteArray.length
-                        val hexString = byteArrayToHexString(byteArray)
-
-                        // 39 = 30 (leading bytes) + 9 (trailing bytes)
-                        // 30 bytes = space for 10 hex values (each hex value 
takes 2 chars + 1 space)
-                        // 9 bytes = space for 3 hex values at the end (2 
chars each + 1 space)
-                        if (hexString.length < 39) {
-                          s"bytes'$hexString' (length: $totalSize)"
+                        // Slice the byte array before hex-encoding to avoid 
materializing
+                        // an O(N) string for large blobs (e.g. 50 MB -> ~150 
MB hex string).
+                        // 13 bytes is the threshold: hex length = 3*N-1, so 
13 bytes = 38 chars < 39.
+                        if (totalSize <= 13) {

Review Comment:
   The number of bytes previewed (10 leading + 3 trailing) is unchanged from 
the original code. If we want to revisit the byte count defaults, better to 
track that in a follow-up.



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