From 254355ec8f30ce6b62072b60bbf094faa90f6ed9 Mon Sep 17 00:00:00 2001 From: huangzhaowei Date: Fri, 20 Sep 2024 15:55:41 +0800 Subject: [PATCH] fix ray sink error when there are no data to write --- python/python/lance/ray/sink.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/python/lance/ray/sink.py b/python/python/lance/ray/sink.py index debf956ee9..8b39d56273 100644 --- a/python/python/lance/ray/sink.py +++ b/python/python/lance/ray/sink.py @@ -137,6 +137,10 @@ def on_write_complete( fragment = pickle.loads(fragment_str) fragments.append(fragment) schema = pickle.loads(schema_str) + # Check weather writer has fragments or not. + # Skip commit when there are no fragments. + if not schema: + return if self.mode in set(["create", "overwrite"]): op = lance.LanceOperation.Overwrite(schema, fragments) elif self.mode == "append":