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

Bug in summary reduction using multiple where reductions with the same selector #1270

Closed
ianthomas23 opened this issue Aug 15, 2023 · 0 comments · Fixed by #1271
Closed

Bug in summary reduction using multiple where reductions with the same selector #1270

ianthomas23 opened this issue Aug 15, 2023 · 0 comments · Fixed by #1271
Assignees
Labels
Milestone

Comments

@ianthomas23
Copy link
Member

Using a summary reduction containing multiple where reductions that use the same selector gives an error. Code to reproduce:

import datashader as ds
import pandas as pd

df = pd.DataFrame(dict(x=[0, 1], y=[0, 1], value=[0, 1], other=[1, 0]))

reduction = ds.summary(
    name1=ds.where(ds.max("value"), "other"),
    name2=ds.where(ds.max("value")),
)

canvas = ds.Canvas(plot_height=3, plot_width=3)
agg = canvas.points(source=df, x="x", y="y", agg=reduction)

Error produced is

  File "/Users/iant/github/datashader/datashader/compiler.py", line 137, in compile_components
    append, any_uses_cuda_mutex = make_append(bases, cols, calls, glyph, antialias)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/iant/github/datashader/datashader/compiler.py", line 415, in make_append
    exec(code, namespace)
  File "<string>", line 4
    _10 =     _7(x, y, _1, _4[i0], _8)
    ^
IndentationError: expected an indented block after 'if' statement on line 3

The cause of the error is the ds.max("value") which is used in both where reductions and only needs to be calculated once, but its reuse in the second where is not correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant