Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.18.1
Description
In the Row class in PyFlink I cannot do a membership check for field names. This minimal example will show the unexpected behavior:
```
from pyflink.common import Row
row = Row(name="Alice", age=11)
- Expected to be True, but is False
print("name" in row)
person = Row("name", "age")
- This is True, as expected
print('name' in person)
```
The related code in the Row class is:
```
def _contains_(self, item):
return item in self._values
```
It should be relatively easy to fix with the following code:
```
def _contains_(self, item):
if hasattr(self, "_fields"):
return item in self._fields
else:
return item in self._values
```
Attachments
Issue Links
- links to