Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengruifeng committed Jul 15, 2022
1 parent 4dce80b commit 4889243
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions python/pyspark/sql/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ def test_varchar_type(self):
self.assertNotEqual(v1, v2)
v3 = VarcharType(10)
self.assertEqual(v1, v3)
self.assertFalse(v1 is v3)

# regression test for SPARK-10392
def test_datetype_equal_zero(self):
Expand Down
5 changes: 2 additions & 3 deletions python/pyspark/sql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ class VarcharType(AtomicType):
Parameters
----------
length : int
the length limitation. Data writing will fail if the input
string exceeds the length limitation.
the length limitation.
"""

def __init__(self, length: int):
Expand Down Expand Up @@ -1698,7 +1697,7 @@ 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) or isinstance(dataType, VarcharType):
if isinstance(dataType, (StringType, VarcharType)):
# StringType and VarcharType can work with any types
def verify_value(obj: Any) -> None:
pass
Expand Down

0 comments on commit 4889243

Please sign in to comment.