adriangb opened a new issue, #10267:
URL: https://github.com/apache/datafusion/issues/10267
### Is your feature request related to a problem or challenge?
```python
from pathlib import Path
import shutil
import polars as pl
from deltalake import DeltaTable
import pyarrow.dataset as ds
import duckdb
from datafusion import SessionContext
DIR = Path("data/records")
shutil.rmtree(DIR, ignore_errors=True)
df = pl.DataFrame({'project_id': [1, 2, 3, 1, 2, 3], 'x': [1, 2, 3, 1, 2,
3]})
df.write_delta(DIR, delta_write_options={'partition_by': ['project_id'],
'engine': 'rust'})
table = DeltaTable(DIR)
dataset = table.to_pyarrow_dataset()
filtered = dataset.filter(ds.field('project_id').isin([1, 2]))
db = duckdb.arrow(filtered)
con = duckdb.connect()
df = pl.from_arrow(con.execute("SELECT * FROM filtered").arrow())
print(df)
df = pl.from_arrow(con.execute("SELECT * FROM filtered WHERE project_id =
3").arrow())
print(df)
df = pl.scan_pyarrow_dataset(filtered)
print(df.collect())
ctx = SessionContext()
ctx.register_dataset("records", filtered)
df = ctx.sql("SELECT * FROM records")
print(df)
```
```
shape: (4, 2)
┌────────────┬─────┐
│ project_id ┆ x │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞════════════╪═════╡
│ 1 ┆ 1 │
│ 1 ┆ 1 │
│ 2 ┆ 2 │
│ 2 ┆ 2 │
└────────────┴─────┘
shape: (0, 2)
┌────────────┬─────┐
│ project_id ┆ x │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞════════════╪═════╡
└────────────┴─────┘
shape: (4, 2)
┌────────────┬─────┐
│ project_id ┆ x │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞════════════╪═════╡
│ 1 ┆ 1 │
│ 1 ┆ 1 │
│ 2 ┆ 2 │
│ 2 ┆ 2 │
└────────────┴─────┘
Traceback (most recent call last):
File "/Users/adriangb/GitHub/platform/test.py", line 39, in <module>
print(df)
Exception: External error: Python error PyErr { type: <class 'ValueError'>,
value: ValueError('Retrieving fragments of a filtered or projected dataset is
not allowed. Remove the filtering.'), traceback: Some(<traceback object at
0x134a09680>) }
```
### Describe the solution you'd like
_No response_
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
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]