You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to have an Enum-like class with the same functionality as python Enum but with an ability to use pyspark.sql.Column as a type of values. The existed built-in Enum uses __eq__ method to check that a new added value is an alias to existed one:
# If another member with the same value was already defined, the# new member becomes an alias to the existing one.try:
try:
# try to do a fast lookup to avoid the quadratic loopenum_member=enum_class._value2member_map_[value]
exceptTypeError:
forname, canonical_memberinenum_class._member_map_.items():
ifcanonical_member._value_==value:
enum_member=canonical_memberbreakelse:
raiseKeyError
But for pyspark.sql.Column method __eq__ returns not bool but Column and we are getting an error here: ValueError: Cannot convert column into bool: please use '&' for 'and', '|' for 'or', '~' for 'not' when building DataFrame boolean expressions.
The text was updated successfully, but these errors were encountered:
I want to have an Enum-like class with the same functionality as python Enum but with an ability to use
pyspark.sql.Column
as a type of values. The existed built-in Enum uses__eq__
method to check that a new added value is an alias to existed one:But for
pyspark.sql.Column
method__eq__
returns notbool
butColumn
and we are getting an error here:ValueError: Cannot convert column into bool: please use '&' for 'and', '|' for 'or', '~' for 'not' when building DataFrame boolean expressions.
The text was updated successfully, but these errors were encountered: