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

dask-expr planning causes incorrect merge behavior at compute time after dropna #1060

Closed
zmbc opened this issue May 8, 2024 · 0 comments · Fixed by #1062
Closed

dask-expr planning causes incorrect merge behavior at compute time after dropna #1060

zmbc opened this issue May 8, 2024 · 0 comments · Fixed by #1062

Comments

@zmbc
Copy link

zmbc commented May 8, 2024

Describe the issue: With query planning turned on, a dropna-then-merge that results in overlapping columns will correctly determine what columns it should create but they don't actually exist when that merge is computed.

Minimal Complete Verifiable Example:

import dask
# If you uncomment this, it works
# dask.config.set({"dataframe.query-planning": False})

import dask.dataframe as dd
import pandas as pd

sample_df = dd.from_pandas(pd.DataFrame({'foo': ["1", "2", "3"], 'bar': ["4", "5", "6"]}), npartitions=1)
sample_df_dropna = sample_df.dropna(subset=["foo"], how="any")

print(sample_df.merge(
    sample_df,
    on=["foo"], how="left"
).columns)

print(sample_df.merge(
    sample_df,
    on=["foo"], how="left"
).compute().columns)

print(sample_df_dropna.merge(
    sample_df_dropna,
    on=["foo"], how="left"
).columns)

print(sample_df_dropna.merge(
    sample_df_dropna,
    on=["foo"], how="left"
).compute().columns)

The last print statement shows that when the expression is actually computed, bar_x and bar_y aren't created by the merge as they should be.

Anything else we need to know?:

Environment:

  • Dask version: 2024.5.0
  • Python version: 3.10.14
  • Operating System: Linux
  • Install method (conda, pip, source): pip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant