zhengruifeng commented on code in PR #37173:
URL: https://github.com/apache/spark/pull/37173#discussion_r921990449
##########
python/pyspark/sql/types.py:
##########
@@ -181,6 +182,29 @@ class StringType(AtomicType, metaclass=DataTypeSingleton):
pass
+class VarcharType(AtomicType):
Review Comment:
I firstly tried this, but it cause initialization error due to the
`__call__` in `DataTypeSingleton`:
a type mixin with `DataTypeSingleton` should support constructor without
parameters.
##########
python/pyspark/sql/types.py:
##########
@@ -1659,8 +1698,8 @@ def verify_acceptable_types(obj: Any) -> None:
new_msg("%s can not accept object %r in type %s" % (dataType,
obj, type(obj)))
)
- if isinstance(dataType, StringType):
- # StringType can work with any types
+ if isinstance(dataType, StringType) or isinstance(dataType, VarcharType):
Review Comment:
nice!
--
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]