Skip to content

Commit

Permalink
fix: fix ray lance sink error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-ju committed Jan 7, 2025
1 parent c237bcb commit 8cd692e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions python/python/lance/ray/sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,37 @@ def on_write_complete(
self,
write_results: List[List[Tuple[str, str]]],
):
import warnings

if not write_results:
warnings.warn(
"write_results is empty.",
DeprecationWarning,
)
return
if (
not isinstance(write_results, list)
or not isinstance(write_results[0], list)
) and not hasattr(write_results, "write_returns"):
warnings.warn(
"write_results type is wrong. please check version, "
"upgrade or downgrade your ray version. ray versions >= 2.38 "
"and < 2.41 are unable to write Lance datasets, check ray PR "
"https://github.com/ray-project/ray/pull/49251 in your "
"ray version. ",
DeprecationWarning,
)
return
if hasattr(write_results, "write_returns"):
write_results = write_results.write_returns

if len(write_results) == 0:
warnings.warn(
"write results is empty. maybe contain none object",
DeprecationWarning,
)
return

fragments = []
schema = None
for batch in write_results:
Expand Down

0 comments on commit 8cd692e

Please sign in to comment.