woudygao commented on a change in pull request #24494: [SPARK-27586][SQL]
Improve binary comparison: replace Scala's for-comprehension if statements with
while loop
URL: https://github.com/apache/spark/pull/24494#discussion_r279727316
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala
##########
@@ -73,7 +73,7 @@ object TypeUtils {
}
def compareBinary(x: Array[Byte], y: Array[Byte]): Int = {
- val limit = math.min(x.length, y.length)
+ val limit = if (x.length <= y.length) x.length else y.length
Review comment:
no need to use val keep the array length
`val al = a.length; val bl = b.length; val limit = if (al <= bl) al else bl`
convert to 13 instructions
`if (x.length <= y.length) x.length else y.length` convert to 11 instructions
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]