jonathan-albrecht-ibm commented on code in PR #49773:
URL: https://github.com/apache/spark/pull/49773#discussion_r1949341193


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/UnsafeRowUtils.scala:
##########
@@ -74,23 +92,23 @@ object UnsafeRowUtils {
       case (field, index) if UnsafeRow.isFixedLength(field.dataType) && 
!row.isNullAt(index) =>
         field.dataType match {
           case BooleanType =>
-            if ((row.getLong(index) >> 1) != 0L) {
+            if (getPaddingBoolean(row, index) != 0L) {

Review Comment:
   Thanks for the review @MaxGekk! 
   
   The `getPadding*` functions are actually created outside of the loop 
already. They are declared as `val` members and `UnsafeRowUtils` is a top level 
`object` which makes it a singleton so the `getPadding*` functions are 
initialized only once for the entire program; not every time they are called. 
They are initialized with one of the anonymous functions returned by the `if` 
statement. So when the `getPadding*` functions are called, only the anonymous 
function chosen at initialization is executed. Only a single instance of the 
chosen anonymous function is ever created.
   
   It's a really nice concise short form for creating separate classes like 
`UnsafeRowBeUtils` and `UnsafeRowLeUtils` and choosing one of those to use 
ahead of time.



-- 
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: reviews-unsubscr...@spark.apache.org

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


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

Reply via email to