Skip to content

Slice after filter no longer pushed #26816

@nameexhaustion

Description

@nameexhaustion

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

q = (
    pl.LazyFrame({"a": [0, 1, 2]})
    .with_columns(s=pl.sum_horizontal("*"))
    .filter(pl.col("a") > 1)
    .head(10)
)

print(q.explain())

# 1.37.1
#  WITH_COLUMNS:
#  [col("a").sum_horizontal().alias("s")]
#   SLICE[offset: 0, len: 10]
#     FILTER [(col("a")) > (1)]
#     FROM
#       DF ["a"]; PROJECT */1 COLUMNS

# 1.38.1
# SLICE[offset: 0, len: 10]
#    WITH_COLUMNS:
#    [col("a").sum_horizontal().alias("s")]
#     FILTER [(col("a")) > (1)]
#     FROM
#       DF ["a"]; PROJECT */1 COLUMNS

Log output

Issue description

Due to changing optimizer order for filter/slice pushdown

Expected behavior

Slice is pushed

Installed versions

1.38.1 / (vs. 1.37.1)

Metadata

Metadata

Labels

A-optimizerArea: plan optimizationP-mediumPriority: mediumacceptedReady for implementationbugSomething isn't workingperformancePerformance issues or improvementspythonRelated to Python PolarsregressionIssue introduced by a new release

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions