spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] HeartSaVioR commented on a change in pull request #27747: [SPARK-30993][SQL] Use its sql type for UDT when checking the type of length (fixed/var) or mutable
Date Mon, 02 Mar 2020 00:09:29 GMT
HeartSaVioR commented on a change in pull request #27747: [SPARK-30993][SQL] Use its sql type
for UDT when checking the type of length (fixed/var) or mutable
URL: https://github.com/apache/spark/pull/27747#discussion_r386155382
 
 

 ##########
 File path: sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
 ##########
 @@ -95,6 +95,10 @@ public static int calculateBitSetWidthInBytes(int numFields) {
   }
 
   public static boolean isFixedLength(DataType dt) {
+    if (dt instanceof UserDefinedType) {
+      return isFixedLength(((UserDefinedType) dt).sqlType());
+    }
+
 
 Review comment:
   Ordering doesn't matter by syntax, but it affects readability.
   
   Assume we are reading the code line by line when UDT parameter comes in here, we can simply
find that it does recursive call with sqlType - then we can just go through with its sqlType
without going back. If it is placed in the middle, once we read how UDT is handled like this
we have to go back on first to follow how the sqlType is handled. That's why I previously
put it separately, to represent "early-return".
   
   One alternative approach: maybe it is more verbose, but adding while loop to extract the
data type till the data type is UDT would be showing intention cleaner. WDYT?

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


Mime
View raw message