zhengruifeng commented on code in PR #48137:
URL: https://github.com/apache/spark/pull/48137#discussion_r1764360448
##########
python/pyspark/sql/connect/expressions.py:
##########
@@ -477,8 +477,20 @@ def to_plan(self, session: "SparkConnectClient") ->
"proto.Expression":
def __repr__(self) -> str:
if self._value is None:
return "NULL"
- else:
- return f"{self._value}"
+ elif isinstance(self._dataType, DateType):
+ dt = DateType().fromInternal(self._value)
+ if dt is not None and isinstance(dt, datetime.date):
+ return dt.strftime("%Y-%m-%d")
+ elif isinstance(self._dataType, TimestampType):
+ ts = TimestampType().fromInternal(self._value)
+ if ts is not None and isinstance(ts, datetime.datetime):
+ return ts.strftime("%Y-%m-%d %H:%M:%S.%f")
+ elif isinstance(self._dataType, TimestampNTZType):
+ ts = TimestampNTZType().fromInternal(self._value)
+ if ts is not None and isinstance(ts, datetime.datetime):
+ return ts.strftime("%Y-%m-%d %H:%M:%S.%f")
+ # TODO(SPARK-49693): Refine the string representation of timedelta
Review Comment:
I haven't find a standard method to convert `timedelta` to a ISO string like
the JVM side
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]