zero323 commented on a change in pull request #29935:
URL: https://github.com/apache/spark/pull/29935#discussion_r562216651
##########
File path: python/pyspark/sql/types.py
##########
@@ -186,6 +186,30 @@ def fromInternal(self, ts):
return datetime.datetime.fromtimestamp(ts //
1000000).replace(microsecond=ts % 1000000)
+class CalendarIntervalType(DataType, metaclass=DataTypeSingleton):
+ """Calendar Interval type
+ """
+ @classmethod
+ def typeName(cls):
+ return "interval"
+
+ def needConversion(self):
+ return True
+
+ def simpleString(self):
+ return "interval"
+
+ def toInternal(self, di):
+ raise NotImplementedError(
+ "Conversion from external Python types to interval not supported"
+ )
Review comment:
For full support we might need both Python and JVM component. If I
recall correctly `timedelta` has razrovine mapping to their internal
`net.razorvine.pickle.objects.TimeDelta`.
In the opposite direction we could, if I am not mistaken, start with making
`CalendarInterval` bean compatible, but there is compatibility issue ‒ we'd
have to map from Spark's months to Python's days.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]