Skip to content

Commit e44605b

Browse files
authored
fix: Handle undeclared aggregator column in _resolve_agg_column_name (#6908)
1 parent 514e3be commit e44605b

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

holoviews/operation/datashader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def _resolve_agg_column_name(element, inner_element, column, is_wide, ydims):
171171
dimension = inner_element.get_dimension(column)
172172
if dimension is None and isinstance(element, NdOverlay):
173173
dimension = element.get_dimension(column)
174+
if dimension is None:
175+
return column
174176
return dimension.label if is_wide and dimension in ydims else dimension.name
175177

176178
@classmethod

holoviews/tests/operation/test_datashader.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,18 @@ def test_rasterize_where_agg_with_column(point_plot, agg_input_fn):
15261526
np.testing.assert_array_equal(img["s"], img_no_column["s"])
15271527

15281528

1529+
@pytest.mark.parametrize("agg_input_fn", [ds.first, ds.last, ds.min, ds.max])
1530+
def test_rasterize_where_agg_with_undeclared_selector_column(point_data, agg_input_fn):
1531+
points = hv.Points(point_data, kdims=["x", "y"], vdims=["val"])
1532+
agg_fn = ds.where(agg_input_fn("s"), "val")
1533+
rast_input = dict(dynamic=False, x_range=(-1, 1), y_range=(-1, 1), width=2, height=2)
1534+
img = rasterize(points, aggregator=agg_fn, **rast_input)
1535+
1536+
assert list(img.data) == ["val"]
1537+
img_full = rasterize(hv.Points(point_data), aggregator=agg_fn, **rast_input)
1538+
np.testing.assert_array_equal(img["val"], img_full["val"])
1539+
1540+
15291541
def test_rasterize_summarize(point_plot):
15301542
agg_fn_count, agg_fn_first = ds.count(), ds.first("val")
15311543
agg_fn = ds.summary(count=agg_fn_count, first=agg_fn_first)

0 commit comments

Comments
 (0)