fix(datasink): correct write-result payload types and guard missing URIs - #5272
Open
jonasdedden wants to merge 1 commit into
Open
fix(datasink): correct write-result payload types and guard missing URIs#5272jonasdedden wants to merge 1 commit into
jonasdedden wants to merge 1 commit into
Conversation
Type-hint the Ray Datasink/Datasource implementations. Two real defects surfaced while doing so: - `on_write_complete` declared the per-fragment payloads as `tuple[str, str]`, but they are `pickle.dumps` output, i.e. `bytes`. The datasink is now `Datasink[WriteReturn]` with `WriteReturn = list[tuple[bytes, bytes]]`. - `self.uri` is `Optional[str]` (the namespace protocol marks the table location optional), yet every write and commit path passed it where `str` is required. A `dataset_uri` property now raises a clear ValueError instead of failing deeper inside pylance. - `_read_fragments` raises instead of dereferencing `None`: `take_blobs` returns `List[Optional[BlobFile]]`. - The `ReadTask` lambda-with-default-args capture is now `functools.partial` with the same eager binding and argument order. The empty-result ordering in `on_write_complete` is deliberately unchanged so both warning messages still fire in the same situations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type-hint the Ray Datasink/Datasource implementations (Fixing parts of #65.).
Two real defects surfaced while doing so:
on_write_completedeclared the per-fragment payloads astuple[str, str], but they arepickle.dumpsoutput, i.e.bytes. The datasink is nowDatasink[WriteReturn]withWriteReturn = list[tuple[bytes, bytes]].self.uriisOptional[str](the namespace protocol marks the table location optional), yet every write and commit path passed it wherestris required. Adataset_uriproperty now raises a clear ValueError instead of failing deeper inside pylance._read_fragmentsraises instead of dereferencingNone:take_blobsreturnsList[Optional[BlobFile]].ReadTasklambda-with-default-args capture is nowfunctools.partialwith the same eager binding and argument order.The empty-result ordering in
on_write_completeis deliberately unchanged so both warning messages still fire in the same situations.