You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "bowenliang123 (via GitHub)" <gi...@apache.org> on 2023/02/09 12:37:42 UTC

[GitHub] [kyuubi] bowenliang123 commented on a diff in pull request #4246: [KYUUBI #4245][SPARK] Support UserDefinedType for Spark 3.2 and above

bowenliang123 commented on code in PR #4246:
URL: https://github.com/apache/kyuubi/pull/4246#discussion_r1101408795


##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/schema/SchemaHelper.scala:
##########
@@ -41,6 +41,24 @@ object SchemaHelper {
    */
   final val YEAR_MONTH_INTERVAL = "YearMonthIntervalType"
 
+  /**
+   * SPARK-7768: UDT API has been public since Spark 3.2.0.
+   * Here we distinguish the UDT if the datatype is subClass of UserDefinedType
+   * that is available in public since Spark 3.2.0
+   */
+  final private val isUserDefinedType = (dt: DataType) => {
+    val dataType = "org.apache.spark.sql.types.DataType"
+    // Canonical name of Spark 3.2.0 DataType UserDefinedType.
+    val userDefinedType = "org.apache.spark.sql.types.UserDefinedType"
+
+    var curClass: Class[_] = dt.getClass

Review Comment:
   ```suggestion
       var curClass: Class[_] = dt.getClass
   ```
   `currentClass` is more prefered as `cur` is not common abbreviation for `current`



-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org