Skip to content

Commit

Permalink
switch to IOExceptions to avoid invalidating database on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
samansmink committed May 15, 2024
1 parent 1db23dc commit 84930fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/functions/delta_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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<MultiFileReaderGlobalState> DeltaMultiFileReader::InitializeGlobalState(duckdb::ClientContext &context,
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/include/delta_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ static T unpack_result_or_throw(ffi::ExternResult<T> 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<T>::Tag::Ok) {
return result.ok._0;
}
throw InternalException("Invalid error ExternResult tag found!");
throw IOException("Invalid error ExternResult tag found!");
}

template <class T>
Expand All @@ -207,7 +207,7 @@ bool result_is_ok(ffi::ExternResult<T> result) {
} else if (result.tag == ffi::ExternResult<T>::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) {
Expand Down

0 comments on commit 84930fa

Please sign in to comment.