Skip to content

Commit 50f1402

Browse files
authored
Merge pull request #81707 from ClickHouse/bump-delta-kernel
Bump `delta-kernel-rs` to v0.12.1
2 parents 72dec4f + e480354 commit 50f1402

File tree

10 files changed

+61
-64
lines changed

10 files changed

+61
-64
lines changed

contrib/delta-kernel-rs

Submodule delta-kernel-rs updated 128 files

contrib/delta-kernel-rs-cmake/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ endif()
2222

2323
# Ideally we would disable all features to remove dependencies but:
2424
# * default-engine: Needed for its s3 client (we can't pass our own s3 client via ffi)
25-
# * delta_kernel/cloud: s3 client
2625
clickhouse_import_crate(
2726
MANIFEST_PATH "${DELTA_KERNEL_RS_SOURCE_DIR}/ffi/Cargo.toml"
28-
FEATURES "default-engine, delta_kernel/cloud"
27+
FEATURES "default-engine"
2928
)
3029
clickhouse_config_crate_flags(delta_kernel_ffi)
3130

contrib/rust_vendor

Submodule rust_vendor updated 6633 files

rust/workspace/Cargo.lock

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Storages/ObjectStorage/DataLakes/DeltaLake/TableSnapshot.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "getSchemaFromSnapshot.h"
1818
#include "PartitionPruner.h"
1919
#include "KernelUtils.h"
20+
#include <delta_kernel_ffi.hpp>
2021
#include <fmt/ranges.h>
2122

2223
namespace fs = std::filesystem;
@@ -386,13 +387,13 @@ void TableSnapshot::initSnapshotImpl() const
386387
LOG_TRACE(log, "Snapshot version: {}", snapshot_version);
387388

388389
scan = KernelUtils::unwrapResult(ffi::scan(snapshot.get(), engine.get(), /* predicate */{}), "scan");
389-
scan_state = ffi::get_global_scan_state(scan.get());
390+
390391
LOG_TRACE(log, "Initialized scan state");
391392

392393
std::tie(table_schema, physical_names_map) = getTableSchemaFromSnapshot(snapshot.get());
393394
LOG_TRACE(log, "Table logical schema: {}", fmt::join(table_schema.getNames(), ", "));
394395

395-
read_schema = getReadSchemaFromSnapshot(scan_state.get());
396+
read_schema = getReadSchemaFromSnapshot(scan.get());
396397
LOG_TRACE(log, "Table read schema: {}", fmt::join(read_schema.getNames(), ", "));
397398

398399
partition_columns = getPartitionColumnsFromSnapshot(snapshot.get());

src/Storages/ObjectStorage/DataLakes/DeltaLake/TableSnapshot.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class TableSnapshot
6161
using KernelExternEngine = KernelPointerWrapper<ffi::SharedExternEngine, ffi::free_engine>;
6262
using KernelSnapshot = KernelPointerWrapper<ffi::SharedSnapshot, ffi::free_snapshot>;
6363
using KernelScan = KernelPointerWrapper<ffi::SharedScan, ffi::free_scan>;
64-
using KernelGlobalScanState = KernelPointerWrapper<ffi::SharedGlobalScanState, ffi::free_global_scan_state>;
6564

6665
const KernelHelperPtr helper;
6766
const DB::ObjectStoragePtr object_storage;
@@ -70,7 +69,6 @@ class TableSnapshot
7069
mutable KernelExternEngine engine;
7170
mutable KernelSnapshot snapshot;
7271
mutable KernelScan scan;
73-
mutable KernelGlobalScanState scan_state;
7472
mutable size_t snapshot_version;
7573

7674
mutable DB::NamesAndTypesList table_schema;

src/Storages/ObjectStorage/DataLakes/DeltaLake/getSchemaFromSnapshot.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ class SchemaVisitorData
137137
const LoggerPtr log = getLogger("SchemaVisitor");
138138

139139
using KernelScan = KernelPointerWrapper<ffi::SharedScan, ffi::free_scan>;
140-
using KernelGlobalScanState = KernelPointerWrapper<ffi::SharedGlobalScanState, ffi::free_global_scan_state>;
141-
142140
};
143141

144142
/**
@@ -161,10 +159,10 @@ class SchemaVisitor
161159
}
162160

163161
static void visitReadSchema(
164-
ffi::SharedGlobalScanState * scan_state,
162+
ffi::SharedScan * scan,
165163
SchemaVisitorData & data)
166164
{
167-
KernelSharedSchema schema(ffi::get_global_read_schema(scan_state));
165+
KernelSharedSchema schema(ffi::scan_physical_schema(scan));
168166
auto visitor = createVisitor(data);
169167
[[maybe_unused]] size_t result = ffi::visit_schema(schema.get(), &visitor);
170168
chassert(result == 0, "Unexpected result: " + DB::toString(result));
@@ -475,10 +473,10 @@ std::pair<DB::NamesAndTypesList, DB::NameToNameMap> getTableSchemaFromSnapshot(f
475473
return {result.names_and_types, result.physical_names_map};
476474
}
477475

478-
DB::NamesAndTypesList getReadSchemaFromSnapshot(ffi::SharedGlobalScanState * scan_state)
476+
DB::NamesAndTypesList getReadSchemaFromSnapshot(ffi::SharedScan * scan)
479477
{
480478
SchemaVisitorData data;
481-
SchemaVisitor::visitReadSchema(scan_state, data);
479+
SchemaVisitor::visitReadSchema(scan, data);
482480
return data.getSchemaResult().names_and_types;
483481
}
484482

src/Storages/ObjectStorage/DataLakes/DeltaLake/getSchemaFromSnapshot.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#if USE_DELTA_KERNEL_RS
66

77
#include <Core/NamesAndTypes.h>
8+
#include <delta_kernel_ffi.hpp>
89

910
namespace ffi
1011
{
@@ -22,7 +23,7 @@ std::pair<DB::NamesAndTypesList, DB::NameToNameMap> getTableSchemaFromSnapshot(f
2223

2324
/// Get read schema.
2425
/// Represents read schema based on data files.
25-
DB::NamesAndTypesList getReadSchemaFromSnapshot(ffi::SharedGlobalScanState * scan_state);
26+
DB::NamesAndTypesList getReadSchemaFromSnapshot(ffi::SharedScan * scan);
2627

2728
/// Get list of partition columns.
2829
/// Read schema does not contain partition columns,

tests/integration/test_storage_delta/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ def test_session_token(started_cluster):
13321332
)
13331333

13341334
assert (
1335-
"Received DeltaLake kernel error ReqwestError: Error interacting with object store"
1335+
"Received DeltaLake kernel error ObjectStoreError: Error interacting with object store"
13361336
in instance2.query_and_get_error(
13371337
f"""
13381338
SELECT count() FROM deltaLake(

0 commit comments

Comments
 (0)