Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_sorted(COL) before head blocks N_ROWS pushdown, also seems to drop the setting column as sorted #13887

Closed
2 tasks done
kszlim opened this issue Jan 21, 2024 · 0 comments · Fixed by #13896
Closed
2 tasks done
Assignees
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer P-medium Priority: medium python Related to Python Polars

Comments

@kszlim
Copy link
Contributor

kszlim commented Jan 21, 2024

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl
from tempfile import TemporaryDirectory
from pathlib import Path

df = pl.DataFrame({"a": list(range(10000))})
with TemporaryDirectory() as tmp:
    tmp = Path(tmp)
    for x in range(5):
        df.write_parquet(tmp / f"{x}.parquet")

    ldf = pl.scan_parquet(tmp / "*.parquet")
    ldf_sort_first = ldf.set_sorted("a").head(5)
    print(ldf.explain())

    ldf_sort_later = ldf.head(5).set_sorted("a")
    print(ldf_sort_later.explain())

Log output

Parquet SCAN 5 files: first file: /tmp/tmp486vqawl/0.parquet
  PROJECT */1 COLUMNS
 WITH_COLUMNS:
 [col("a").set_sorted()]

    Parquet SCAN 5 files: first file: /tmp/tmp486vqawl/0.parquet
    PROJECT */1 COLUMNS
    N_ROWS: 5


### Issue description

As described in title

### Expected behavior

Should have identical query plans

### Installed versions




--------Version info---------
Polars: 0.20.3
Index type: UInt32
Platform: Linux-6.2.6-76060206-generic-x86_64-with-glibc2.35
Python: 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]

----Optional dependencies----
adbc_driver_manager:
cloudpickle: 2.2.1
connectorx:
deltalake: 0.10.0
fsspec: 2023.4.0
gevent:
hvplot: 0.8.4
matplotlib: 3.7.1
numpy: 1.24.3
openpyxl:
pandas: 1.5.3
pyarrow: 12.0.1
pydantic: 1.10.9
pyiceberg:
pyxlsb:
sqlalchemy:
xlsx2csv:
xlsxwriter: ```

@kszlim kszlim added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jan 21, 2024
@ritchie46 ritchie46 added the P-medium Priority: medium label Jan 22, 2024
@ritchie46 ritchie46 self-assigned this Jan 22, 2024
@c-peters c-peters added the accepted Ready for implementation label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer P-medium Priority: medium python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants