diff --git a/python/python/lance/ray/sink.py b/python/python/lance/ray/sink.py index 7cde7eada1..9e8f1062fc 100644 --- a/python/python/lance/ray/sink.py +++ b/python/python/lance/ray/sink.py @@ -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. please check ray version " "or internal error", + DeprecationWarning, + ) + return + fragments = [] schema = None for batch in write_results: