smaheshwar-pltr opened a new issue, #2179:
URL: https://github.com/apache/iceberg-python/issues/2179

   ### Apache Iceberg version
   
   None
   
   ### Please describe the bug 🐞
   
   See 
[here](https://github.com/apache/iceberg-python/compare/main...smaheshwar-pltr:iceberg-python:show-failing-test-for-bug?expand=1)
 and the description below for a failing test.
   
   ```py
       table = catalog.load_table(f"default.{identifier}")
   
       scan = table.scan()
       # assert len(scan.to_arrow()) > 0
   
       scan = scan.filter("ts >= '2023-03-05T00:00:00+00:00'")
       assert len(scan.to_arrow()) > 0
   ```
   
   This code works fine, but uncommenting the first assertion causes the 
`filter` call to throw. The stack trace is immediately helpful:
   
   ```
   pyiceberg/table/__init__.py:1710: in filter
       return self.update(row_filter=And(self.row_filter, 
_parse_row_filter(expr)))
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _
   
   self = <pyiceberg.table.DataScan object at 0x11c065cd0>
   overrides = {'row_filter': GreaterThanOrEqual(term=Reference(name='ts'), 
literal=literal('2023-03-05T00:00:00+00:00'))}
   
       def update(self: S, **overrides: Any) -> S:
           """Create a copy of this table scan with updated fields."""
   >       return type(self)(**{**self.__dict__, **overrides})
   E       TypeError: TableScan.__init__() got an unexpected keyword argument 
'partition_filters'
   
   pyiceberg/table/__init__.py:1694: TypeError
   ```
   
   `DataScan` has a `cached_property` `partition_filters` (see 
[here](https://github.com/apache/iceberg-python/blob/045dd10a45cbf0b82b095b5bde47f4731a3bf88b/pyiceberg/table/__init__.py#L1808-L1810))
 that will turn up in `self.__dict__` below in the `update` method: 
https://github.com/apache/iceberg-python/blob/045dd10a45cbf0b82b095b5bde47f4731a3bf88b/pyiceberg/table/__init__.py#L1692-L1694
   
   This will happen if the cache property has been accessed once - i.e. if the 
scan has already had `plan_files` called on it (essentially, if it's been read).
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


-- 
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]

Reply via email to