Fokko commented on a change in pull request #26644: [SPARK-30004][SQL] Allow merge UserDefinedType into a native DataType URL: https://github.com/apache/spark/pull/26644#discussion_r350213677
########## File path: sql/catalyst/src/test/scala/org/apache/spark/sql/types/DataTypeSuite.scala ########## @@ -478,4 +479,33 @@ class DataTypeSuite extends SparkFunSuite { assert(result === expected) } + + test("Allow UserDefinedType to be merged into a native DateType") { + // In this testcase we have stored the XMLGregorianCalendar as a Timestamp + // And we want to read this later on as a regular TimestampType + val left = StructType( + StructField("a", TimestampType) :: Nil) + + // We should be able to merge these types since the + // CustomXMLGregorianCalendarType maps to a TimestampTypes + val right = StructType( + StructField("a", new MyXMLGregorianCalendarUDT) :: Nil) + + // We expect the DataType to be returned instead of the UserDefinedType + assert(left.merge(right) === left) + } + + test("Disallow DataType to be merged into UserDefinedType") { + val right = StructType( + StructField("a", TimestampType) :: Nil) Review comment: Sure ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org