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

[Datasets] Add logical operator for map() #31912

Merged
merged 3 commits into from
Jan 26, 2023
Merged

Conversation

c21
Copy link
Contributor

@c21 c21 commented Jan 25, 2023

Signed-off-by: Cheng Su [email protected]

Why are these changes needed?

This PR is to add logical operator for map(), with change:
(1).introduce AbstractMap abstract logical operator, that MapBatches, MapRows, etc to extend.
(2).rename existing plan_map_batches_op to plan_map_op, to make it more general.

Related issue number

Closes #31937.

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Copy link
Contributor

@jianoaix jianoaix left a comment

Choose a reason for hiding this comment

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

LG mostly.

@@ -22,44 +23,99 @@
from typing_extensions import Literal


class MapBatches(LogicalOperator):
"""Logical operator for map_batches."""
class BaseMapLike(LogicalOperator):
Copy link
Contributor

Choose a reason for hiding this comment

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

This name looks strange, maybe LogicalMap or AbstractMap or MapInterface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jianoaix - sure, changed to AbstractMap.

self._zero_copy_batch = zero_copy_batch


class Map(BaseMapLike):
Copy link
Contributor

Choose a reason for hiding this comment

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

s/Map/MapRow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm still want to keep Map, to be consistent as Dataset API name, to reduce our mental overhead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think need to use the same as public API though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, renamed to MapRows, to be consistent with MapBatches operator.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I think the iteration API names are quite intuitive: iter_rows and iter_batches. The map has been leading users to take it as the primary mapping API whereas map_batches is recommended.

@ericl ericl merged commit bb5098a into ray-project:master Jan 26, 2023
@c21 c21 deleted the map-ops branch January 26, 2023 00:15
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.

[Datasets] Add logical operator for map()
5 participants