[ 
https://issues.apache.org/jira/browse/FLINK-35112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17845526#comment-17845526
 ] 

Dian Fu edited comment on FLINK-35112 at 5/11/24 2:56 AM:
----------------------------------------------------------

Fix in 
- master via b4d71144de8e3772257804b6ed8ad688076430d6

- release-1.19 via d16b20e4fb4fb906927188ca11af599edd0953c1


was (Author: dianfu):
Fix in master via b4d71144de8e3772257804b6ed8ad688076430d6

> Membership for Row class does not include field names
> -----------------------------------------------------
>
>                 Key: FLINK-35112
>                 URL: https://issues.apache.org/jira/browse/FLINK-35112
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Python
>    Affects Versions: 1.18.1
>            Reporter: Wouter Zorgdrager
>            Assignee: Wouter Zorgdrager
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.20.0
>
>
> 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
> ```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to