maropu commented on a change in pull request #25615: 
[SPARK-28495][SQL][FOLLOW-UP] Disallow conversions between timestamp and long 
in ASNI mode
URL: https://github.com/apache/spark/pull/25615#discussion_r318905292
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/types/DataTypeWriteCompatibilitySuite.scala
 ##########
 @@ -133,6 +133,18 @@ class ANSIDataTypeWriteCompatibilitySuite extends 
DataTypeWriteCompatibilityBase
       assert(err.contains("Cannot safely cast"))
     }
   }
+
+  test("Conversions between timestamp and long are not allowed") {
+    assertSingleError(LongType, TimestampType, "longToTimestamp",
+      "Should not allow long to timestamp") { err =>
+      assert(err.contains("Cannot safely cast 'longToTimestamp': LongType to 
TimestampType"))
+    }
+
+    assertSingleError(TimestampType, LongType, "timestampToLong",
+      "Should not allow timestamp to long") { err =>
+      assert(err.contains("Cannot safely cast 'timestampToLong': TimestampType 
to LongType"))
+    }
+  }
 
 Review comment:
   btw, we don't have any existing test for these cast case, right? (I just a 
bit worried about forgetting to add tests for the other cast cases in the ANSI 
mode...

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

Reply via email to