From 84930fa7782041673ec84889d192d40315c4cbb5 Mon Sep 17 00:00:00 2001 From: Sam Ansmink Date: Wed, 15 May 2024 13:02:25 +0200 Subject: [PATCH] switch to IOExceptions to avoid invalidating database on errors --- src/functions/delta_scan.cpp | 6 +++--- src/include/delta_utils.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/functions/delta_scan.cpp b/src/functions/delta_scan.cpp index 27d18bc..0f2cb30 100644 --- a/src/functions/delta_scan.cpp +++ b/src/functions/delta_scan.cpp @@ -190,7 +190,7 @@ string DeltaSnapshot::GetFile(idx_t i) { // The kernel scan visitor should have resolved a file OR returned if(i >= resolved_files.size()) { - throw InternalException("Delta Kernel seems to have failed to resolve a new file"); + throw IOException("Delta Kernel seems to have failed to resolve a new file"); } return resolved_files[i]; @@ -403,7 +403,7 @@ void DeltaMultiFileReaderGlobalState::SetColumnIdx(const string &column, idx_t i delta_file_number_idx = idx; return; } - throw InternalException("Unknown column '%s' found as required by the DeltaMultiFileReader"); + throw IOException("Unknown column '%s' found as required by the DeltaMultiFileReader"); } unique_ptr DeltaMultiFileReader::InitializeGlobalState(duckdb::ClientContext &context, @@ -488,7 +488,7 @@ void DeltaMultiFileReader::CreateNameMapping(const string &file_name, const vect // Lookup the required column in the local map auto entry = name_map.find("file_row_number"); if (entry == name_map.end()) { - throw InternalException("Failed to find the file_row_number column"); + throw IOException("Failed to find the file_row_number column"); } // Register the column to be scanned from this file diff --git a/src/include/delta_utils.hpp b/src/include/delta_utils.hpp index 32f7bf2..f0cf962 100644 --- a/src/include/delta_utils.hpp +++ b/src/include/delta_utils.hpp @@ -189,15 +189,15 @@ static T unpack_result_or_throw(ffi::ExternResult result, const string &from_ auto message = error_cast->error_message; delete error_cast; - throw InternalException("Hit DeltaKernel FFI error (from: %s): Hit error: %u (%s) with message (%s)", + throw IOException("Hit DeltaKernel FFI error (from: %s): Hit error: %u (%s) with message (%s)", from_where.c_str(), etype, kernel_error_to_string(etype), message); } else { - throw InternalException("Hit DeltaKernel FFI error (from: %s): Hit error, but error was nullptr", from_where.c_str()); + throw IOException("Hit DeltaKernel FFI error (from: %s): Hit error, but error was nullptr", from_where.c_str()); } } else if (result.tag == ffi::ExternResult::Tag::Ok) { return result.ok._0; } - throw InternalException("Invalid error ExternResult tag found!"); + throw IOException("Invalid error ExternResult tag found!"); } template @@ -207,7 +207,7 @@ bool result_is_ok(ffi::ExternResult result) { } else if (result.tag == ffi::ExternResult::Tag::Err) { return false; } - throw InternalException("Invalid error ExternResult tag found!"); + throw IOException("Invalid error ExternResult tag found!"); } ffi::KernelStringSlice to_delta_string_slice(const string &str) {