diff --git a/CMakeLists.txt b/CMakeLists.txt index daccecc..c43cddd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ include_directories(delta-kernel-rs/target/ffi-headers) set(CMAKE_OSX_DEPLOYMENT_TARGET 13.3 CACHE STRING "Minimum OS X deployment version" FORCE) # Add the default client -add_compile_definitions(DEFINE_DEFAULT_CLIENT) +add_compile_definitions(DEFINE_DEFAULT_ENGINE) # Link delta-kernal-rs to static lib target_link_libraries(${EXTENSION_NAME} @@ -105,4 +105,4 @@ install( TARGETS ${EXTENSION_NAME} EXPORT "${DUCKDB_EXPORT_SET}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}") \ No newline at end of file + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}") diff --git a/delta-kernel-rs b/delta-kernel-rs index b995f6f..b9aa38c 160000 --- a/delta-kernel-rs +++ b/delta-kernel-rs @@ -1 +1 @@ -Subproject commit b995f6f8f94ce596399ff51301d279c055fe9819 +Subproject commit b9aa38cd69e2a7e5045c63d5b238d889e8eb83aa diff --git a/src/functions/deltatable_scan.cpp b/src/functions/deltatable_scan.cpp index 17a67f7..e1a8c75 100644 --- a/src/functions/deltatable_scan.cpp +++ b/src/functions/deltatable_scan.cpp @@ -75,12 +75,12 @@ static void visit_data(void *engine_context, struct ffi::EngineDataHandle *engin ffi::visit_scan_data(engine_data, selection_vec, engine_context, visit_callback); } -static ffi::EngineInterfaceBuilder* CreateBuilder(ClientContext &context, const string &path) { - ffi::EngineInterfaceBuilder* builder; +static ffi::EngineBuilder* CreateBuilder(ClientContext &context, const string &path) { + ffi::EngineBuilder* builder; // For "regular" paths we early out with the default builder config if (!StringUtil::StartsWith(path, "s3://")) { - auto interface_builder_res = ffi::get_engine_interface_builder(to_delta_string_slice(path), error_allocator); + auto interface_builder_res = ffi::get_engine_builder(to_delta_string_slice(path), error_allocator); return unpack_result_or_throw(interface_builder_res, "get_engine_interface_builder for path " + path); } @@ -92,7 +92,7 @@ static ffi::EngineInterfaceBuilder* CreateBuilder(ClientContext &context, const auto bucket = path.substr(5, end_of_container-5); auto path_in_bucket = path.substr(end_of_container); - auto interface_builder_res = ffi::get_engine_interface_builder(to_delta_string_slice(path), error_allocator); + auto interface_builder_res = ffi::get_engine_builder(to_delta_string_slice(path), error_allocator); builder = unpack_result_or_throw(interface_builder_res, "get_engine_interface_builder for path " + path); // ffi::set_builder_option(builder, to_delta_string_slice("aws_bucket"), to_delta_string_slice(bucket)); @@ -179,14 +179,6 @@ string DeltaTableSnapshot::GetFile(idx_t i) { auto have_scan_data_res = ffi::kernel_scan_data_next(scan_data_iterator.get(), this, visit_data); - // TODO: weird workaround required to not get "Json error: Encountered unexpected 'c' whilst parsing value" - if (have_scan_data_res.tag == ffi::ExternResult::Tag::Err) { - if (have_scan_data_res.err._0) { - files_exhausted = true; - return ""; - } - } - auto have_scan_data = unpack_result_or_throw(have_scan_data_res, "kernel_scan_data_next in DeltaTableSnapshot GetFile"); // TODO: shouldn't the kernel always return false here? diff --git a/src/include/delta_utils.hpp b/src/include/delta_utils.hpp index e63e114..3806206 100644 --- a/src/include/delta_utils.hpp +++ b/src/include/delta_utils.hpp @@ -172,7 +172,7 @@ static T unpack_result_or_throw(ffi::ExternResult result, const string &from_ auto error_cast = static_cast(result.err._0); auto etype = error_cast->etype; auto message = error_cast->error_message; - free(error_cast); + delete error_cast; throw InternalException("Hit DeltaKernel FFI error (from: %s): Hit error: %u (%s) with message (%s)", from_where.c_str(), etype, kernel_error_to_string(etype), message); diff --git a/src/include/functions/deltatable_scan.hpp b/src/include/functions/deltatable_scan.hpp index c4c2c75..a6dae8c 100644 --- a/src/include/functions/deltatable_scan.hpp +++ b/src/include/functions/deltatable_scan.hpp @@ -54,7 +54,7 @@ struct DeltaTableSnapshot : public MultiFileList { //! Delta Kernel Structures const ffi::SnapshotHandle *snapshot; - const ffi::ExternEngineInterfaceHandle *table_client; + const ffi::ExternEngineHandle *table_client; ffi::Scan* scan; ffi::GlobalScanState *global_state; UniqueKernelPointer scan_data_iterator;