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

feat: support Ellipsis as first arg in multi arg getitem #217

Merged

Conversation

douglasdavis
Copy link
Collaborator

No description provided.

@douglasdavis douglasdavis enabled auto-merge (squash) April 5, 2023 17:51
@douglasdavis douglasdavis merged commit fe84b2a into dask-contrib:main Apr 5, 2023
@@ -892,6 +892,9 @@ def _getitem_tuple(self, where: tuple[Any, ...]) -> Array:
if issubclass(dtype, (np.bool_, bool, np.int64, np.int32, int)):
return self._getitem_outer_bool_or_int_lazy_array(where)

elif where[0] is Ellipsis:
return self._getitem_trivial_map_partitions(where)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not the case that ellipsis can evaluate to zero indices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes for something not deeply nested we can end up with something like

In [25]: a = ak.Array({"x": [1, 2, 3]})

In [26]: a
Out[26]: <Array [{x: 1}, {x: 2}, {x: 3}] type='3 * {x: int64}'>

In [27]: a[..., 0]
Out[27]: <Record {x: 1} type='{x: int64}'>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we'll need more than just a trivial map partitions call

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be what is desired in most sensible user code. We, again, need to know the number of possible axes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think a check on ndim vs len(where) will give us info we need to determine if we're good to use the trivial case

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 this pull request may close these issues.

2 participants