Skip to content

Commit

Permalink
bump delta kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
samansmink committed May 7, 2024
1 parent 15b4b04 commit 6b83593
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -105,4 +105,4 @@ install(
TARGETS ${EXTENSION_NAME}
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
2 changes: 1 addition & 1 deletion delta-kernel-rs
16 changes: 4 additions & 12 deletions src/functions/deltatable_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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));
Expand Down Expand Up @@ -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<bool>::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?
Expand Down
2 changes: 1 addition & 1 deletion src/include/delta_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static T unpack_result_or_throw(ffi::ExternResult<T> result, const string &from_
auto error_cast = static_cast<DuckDBEngineError*>(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);
Expand Down
2 changes: 1 addition & 1 deletion src/include/functions/deltatable_scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ffi::KernelScanDataIterator> scan_data_iterator;
Expand Down

0 comments on commit 6b83593

Please sign in to comment.