Skip to content

Commit

Permalink
Merge branch 'delta-code-cleanup' into bump-kernel-to-0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
samansmink committed Dec 19, 2024
2 parents 9478771 + 0c87fd6 commit 2a001d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/delta_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,15 @@ uintptr_t SchemaVisitor::MakeFieldListImpl(uintptr_t capacity_hint) {
void SchemaVisitor::AppendToList(uintptr_t id, ffi::KernelStringSlice name, LogicalType &&child) {
auto it = inflight_lists.find(id);
if (it == inflight_lists.end()) {
// TODO... some error...
throw InternalException("WEIRD SHIT");
} else {
it->second->emplace_back(std::make_pair(string(name.ptr, name.len), std::move(child)));
throw InternalException("Unhandled error in SchemaVisitor::AppendToList child");
}
it->second->emplace_back(std::make_pair(string(name.ptr, name.len), std::move(child)));
}

unique_ptr<SchemaVisitor::FieldList> SchemaVisitor::TakeFieldList(uintptr_t id) {
auto it = inflight_lists.find(id);
if (it == inflight_lists.end()) {
// TODO: Raise some kind of error.
throw InternalException("WEIRD SHIT 2");
throw InternalException("Unhandled error in SchemaVisitor::TakeFieldList");
}
auto rval = std::move(it->second);
inflight_lists.erase(it);
Expand Down
13 changes: 2 additions & 11 deletions src/functions/delta_scan.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "functions/delta_scan.hpp"
#include "storage/delta_catalog.hpp"

#include "delta_functions.hpp"
#include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
Expand All @@ -16,13 +17,9 @@
#include "duckdb/planner/binder.hpp"
#include "duckdb/planner/operator/logical_get.hpp"
#include "duckdb/main/query_profiler.hpp"
#include "duckdb/main/client_data.hpp"

#include <duckdb/main/client_data.hpp>
#include <numeric>
#include <regex>
#include <duckdb/main/attached_database.hpp>
#include <duckdb/main/client_data.hpp>
#include <storage/delta_catalog.hpp>

namespace duckdb {

Expand Down Expand Up @@ -477,11 +474,6 @@ string DeltaSnapshot::GetFileInternal(idx_t i) {
}
}

// The kernel scan visitor should have resolved a file OR returned
if (i >= resolved_files.size()) {
throw IOException("Delta Kernel seems to have failed to resolve a new file");
}

return resolved_files[i];
}

Expand Down Expand Up @@ -799,7 +791,6 @@ static SelectionVector DuckSVFromDeltaSV(const ffi::KernelBoolSlice &dv, Vector
for (idx_t i = 0; i < count; i++) {
auto row_id = row_ids[data.sel->get_index(i)];

// TODO: why are deletion vectors not spanning whole data?
if (row_id >= dv.len || dv.ptr[row_id]) {
result.data()[current_select] = i;
current_select++;
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,11 +189,11 @@ struct KernelUtils {
if (result.err._0) {
auto error_cast = static_cast<DuckDBEngineError *>(result.err._0);
error_cast->Throw(from_where);
} else {
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) {
throw IOException("Hit DeltaKernel FFI error (from: %s): Hit error, but error was nullptr",
from_where.c_str());
}
if (result.tag == ffi::ExternResult<T>::Tag::Ok) {
return result.ok._0;
}
throw IOException("Invalid error ExternResult tag found!");
Expand Down

0 comments on commit 2a001d5

Please sign in to comment.