Skip to content

[Data] Fix write_results type - #33936

Merged
ericl merged 3 commits into
ray-project:masterfrom
bveeramani:fix-write-results
Apr 3, 2023
Merged

[Data] Fix write_results type#33936
ericl merged 3 commits into
ray-project:masterfrom
bveeramani:fix-write-results

Conversation

@bveeramani

@bveeramani bveeramani commented Mar 30, 2023

Copy link
Copy Markdown
Member

Why are these changes needed?

Dataset.write_datasource passes a list[list[WriteResult]] to Datasource.on_write_complete instead of a list[WriteResult]. This PR fixes the bug.

Related issue number

Fixes #33935

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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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 :(

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
@c21

c21 commented Mar 30, 2023

Copy link
Copy Markdown
Contributor

I think we need to fix https://github.com/ray-project/ray/blob/master/python/ray/data/_internal/planner/write.py#L16:

from:

return [[datasource.write(blocks, ctx, **write_args)]]

to:

return [datasource.write(blocks, ctx, **write_args)]

@jianoaix - the above double [[]] looks like a mistake, right?

@c21 c21 assigned c21 and jianoaix Mar 30, 2023
@bveeramani

Copy link
Copy Markdown
Member Author

I think we need to fix https://github.com/ray-project/ray/blob/master/python/ray/data/_internal/planner/write.py#L16:

from:

return [[datasource.write(blocks, ctx, **write_args)]]

to:

return [datasource.write(blocks, ctx, **write_args)]

@jianoaix - the above double [[]] looks like a mistake, right?

I think it's correct as is.

Without the double brackets, we return an Iterable[WriteResult] instead of an Iterable[Block]. In this case, blocks are List[WriteResult].

@c21

c21 commented Mar 30, 2023

Copy link
Copy Markdown
Contributor

@bveeramani - ah sorry you are right. A Python list is a valid Block.

@jianoaix

Copy link
Copy Markdown
Contributor

I think we need to fix https://github.com/ray-project/ray/blob/master/python/ray/data/_internal/planner/write.py#L16:
from:

return [[datasource.write(blocks, ctx, **write_args)]]

to:

return [datasource.write(blocks, ctx, **write_args)]

@jianoaix - the above double [[]] looks like a mistake, right?

I think it's correct as is.

Without the double brackets, we return an Iterable[WriteResult] instead of an Iterable[Block]. In this case, blocks are List[WriteResult].

Yep, the output of write op is a list of blocks with block type being a List.

@c21

c21 commented Mar 30, 2023

Copy link
Copy Markdown
Contributor

@bveeramani - can you also add a comment in https://github.com/ray-project/ray/blob/master/python/ray/data/_internal/planner/write.py ? Something like

# NOTE: return a nested list to conform the Block type (a Python list) 
return [[datasource.write(blocks, ctx, **write_args)]]

Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
Signed-off-by: Balaji Veeramani <balaji@anyscale.com>
@c21

c21 commented Apr 1, 2023

Copy link
Copy Markdown
Contributor

cc @zhe-thoughts to approve, this is to fix a bug in Dataset write path. Would be low-risky surgical fix.

@c21 c21 assigned ericl Apr 1, 2023

@zhe-thoughts zhe-thoughts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved for merging into master

@ericl
ericl merged commit a74e563 into ray-project:master Apr 3, 2023
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
`Dataset.write_datasource` passes a `list[list[WriteResult]]` to `Datasource.on_write_complete` instead of a `list[WriteResult]`. This PR fixes the bug.

Signed-off-by: elliottower <elliot@elliottower.com>
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
`Dataset.write_datasource` passes a `list[list[WriteResult]]` to `Datasource.on_write_complete` instead of a `list[WriteResult]`. This PR fixes the bug.

Signed-off-by: Jack He <jackhe2345@gmail.com>
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.

[Data] write_results have wrong type in on_write_complete

5 participants