You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2025/11/13 10:39:28 UTC

[PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Xuanwo opened a new pull request, #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   - Part of https://github.com/apache/iceberg-rust/issues/1819
   
   ## What changes are included in this PR?
   
   Add RFC for iceberg-kernel
   
   ## Are these changes tested?
   
   <!--
   Specify what test covers (unit test, integration test, etc.).
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2522898305


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,178 @@
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers

Review Comment:
   ```suggestion
   <!--
     ~ Licensed to the Apache Software Foundation (ASF) under one
     ~ or more contributor license agreements.  See the NOTICE file
     ~ distributed with this work for additional information
     ~ regarding copyright ownership.  The ASF licenses this file
     ~ to you under the Apache License, Version 2.0 (the
     ~ "License"); you may not use this file except in compliance
     ~ with the License.  You may obtain a copy of the License at
     ~
     ~   http://www.apache.org/licenses/LICENSE-2.0
     ~
     ~ Unless required by applicable law or agreed to in writing,
     ~ software distributed under the License is distributed on an
     ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     ~ KIND, either express or implied.  See the License for the
     ~ specific language governing permissions and limitations
     ~ under the License.
   -->
   
   # RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
   ```
   <!-- license-eye hidden identification -->



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "CTTY (via GitHub)" <gi...@apache.org>.
CTTY commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2548056949


##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers
+  catalog/*              # catalog adapters (REST, HMS, Glue, etc.)
+  integrations/
+    datafusion/          # combines core + implementations for DF
+    cache-moka/
+    playground/
+```
+
+- `crates/iceberg` no longer depends on opendal, Tokio, Arrow, or DataFusion.
+- Implementation crates depend on `iceberg` to get the trait surfaces they implement.
+- Higher-level crates (e.g., `iceberg-datafusion`) pull in the required runtime/FileIO/executor crates and expose an opinionated combination.
+
+### Core Trait Surfaces (within `iceberg`)
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- `FileRead` / `FileWrite` remain Iceberg-specific traits (range reads, metrics hooks, abort/commit) and live inside `iceberg`.
+- Concrete implementations (opendal, local FS, custom stores) live in companion crates and return trait objects.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- The trait lives in `iceberg`; crates like `iceberg-runtime-tokio` implement it and expose constructors.
+
+#### Catalog / Table / Transaction / Scan
+
+- All existing traits and data structures remain in `crates/iceberg`.
+- `TableScan` continues to emit pure plan descriptors; executors interpret them.
+- `Transaction` uses injected `Runtime` for retry/backoff but otherwise stays unchanged.
+
+### Usage Modes
+
+- **Custom stacks**: depend solely on `iceberg` plus self-authored implementations that satisfy the traits.
+- **Pre-built stacks**: depend on crates such as `iceberg-datafusion` that bundle `iceberg` with `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and `iceberg-engine-arrow` (and expose higher-level APIs).
+- `iceberg` itself does not re-export any of the companion crates; users compose them explicitly.
+
+## Migration Plan
+
+1. **Phase 1 – Slim down `crates/iceberg`**
+   - Remove direct dependencies on opendal, Tokio, Arrow, and DataFusion from `iceberg`.
+   - Move the concrete implementations into new crates (while keeping the same code initially).
+
+2. **Phase 2 – Stabilize trait surfaces**

Review Comment:
   I was confused about this as well
   
   Take `FileIO`/`Storage` for example, in my imagination, since we currently don't have a trait for them, the actual phase 1 will be adding traits to `iceberg` crate and stabilize it if needed, then we can continue to move opendal dependencies to a new crate like `iceberg-storage`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "CTTY (via GitHub)" <gi...@apache.org>.
CTTY commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2535957474


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.

Review Comment:
   Should this be `Storage` trait rather than `FileIO` trait? 
   
   From the code example below it seems like `FileIO` is a struct container for `Storage` and registry



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3536673500

   btw #1857 should resolve the CI issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3532030505

   > I'm thinking is reasonable to split out `spec` part as a single minimum module? It just provide the memory representation of iceberg spec and de/serialize way. It can be evolve quickly and as a minimum module reuse by external user or inner module.
   
   I think that's an interesting idea. It’s fine to just expose a spec crate, but how useful would it be? For reading snapshots, manifest lists, and manifests, users still need a FileIO. Is there a use case that users just want to ser/de a manifest file?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "liurenjie1024 (via GitHub)" <gi...@apache.org>.
liurenjie1024 merged PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2533364420


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn spawn_blocking<F, T>(&self, f: F) -> Self::JoinHandle<T>

Review Comment:
   Just want to align the current implementation, I'm fine removing them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2537358539


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- `TableScan` planning, metadata refresh, and `Transaction::commit` depend only on this trait.
+- Crates such as `iceberg-runtime-tokio` provide concrete schedulers; consumers pick whichever runtime crate fits their stack.
+
+#### Catalog / Table / Transaction
+
+- The `Catalog` trait moves into the kernel and returns lightweight `TableHandle` objects (metadata + FileIO + Runtime).
+- `TableHandle` no longer embeds Arrow helpers; Arrow-specific logic lives in engine crates.
+- Transactions and their actions remain in the kernel, but rely on injected `Runtime` for retries/backoff.
+
+#### Scan / Planner
+
+- The kernel produces pure `TableScanPlan` descriptions (manifests, data-files, predicates, task graph).
+- Engines provide executors (e.g., `ArrowExecutor`) that transform plans into record batches or other runtime-specific artifacts.
+
+### Facade Behavior
+
+- The top-level `iceberg` crate becomes a facade (`pub use iceberg_kernel::*`) that enables a *composition* of default crates (e.g. `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and a reference executor) behind feature flags.
+- Existing convenience APIs (`Table::scan().to_arrow()`, `MemoryCatalog`, etc.) stay available but internally assemble the kernel with those default building blocks.
+
+## Migration Plan
+
+1. **Phase 1 – Create the kernel crate**
+   - Add `crates/kernel` and move `spec`, `expr`, `catalog`, `table`, `transaction`, `scan`, and supporting modules.
+   - Introduce temporary shim modules in the facade so existing imports keep working (mark them deprecated).
+
+2. **Phase 2 – Abstract runtime & IO**
+   - Define the `Runtime` and `FileIO` traits inside the kernel.
+   - Remove direct `tokio`/`opendal` dependencies from kernel modules.
+   - Introduce standalone crates (`iceberg-runtime-tokio`, `iceberg-fileio-opendal`, etc.) that implement the new traits.
+
+3. **Phase 3 – Detach Arrow/execution**
+   - Move `arrow` helpers and `ArrowReaderBuilder` into a reference executor crate (e.g. `iceberg-engine-arrow`).

Review Comment:
   Yep, I expect everything to keep working after this refactor, just allowing our community to do more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2535591646


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- `TableScan` planning, metadata refresh, and `Transaction::commit` depend only on this trait.
+- Crates such as `iceberg-runtime-tokio` provide concrete schedulers; consumers pick whichever runtime crate fits their stack.
+
+#### Catalog / Table / Transaction
+
+- The `Catalog` trait moves into the kernel and returns lightweight `TableHandle` objects (metadata + FileIO + Runtime).
+- `TableHandle` no longer embeds Arrow helpers; Arrow-specific logic lives in engine crates.
+- Transactions and their actions remain in the kernel, but rely on injected `Runtime` for retries/backoff.
+
+#### Scan / Planner
+
+- The kernel produces pure `TableScanPlan` descriptions (manifests, data-files, predicates, task graph).
+- Engines provide executors (e.g., `ArrowExecutor`) that transform plans into record batches or other runtime-specific artifacts.
+
+### Facade Behavior
+
+- The top-level `iceberg` crate becomes a facade (`pub use iceberg_kernel::*`) that enables a *composition* of default crates (e.g. `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and a reference executor) behind feature flags.
+- Existing convenience APIs (`Table::scan().to_arrow()`, `MemoryCatalog`, etc.) stay available but internally assemble the kernel with those default building blocks.
+
+## Migration Plan
+
+1. **Phase 1 – Create the kernel crate**
+   - Add `crates/kernel` and move `spec`, `expr`, `catalog`, `table`, `transaction`, `scan`, and supporting modules.
+   - Introduce temporary shim modules in the facade so existing imports keep working (mark them deprecated).
+
+2. **Phase 2 – Abstract runtime & IO**
+   - Define the `Runtime` and `FileIO` traits inside the kernel.
+   - Remove direct `tokio`/`opendal` dependencies from kernel modules.
+   - Introduce standalone crates (`iceberg-runtime-tokio`, `iceberg-fileio-opendal`, etc.) that implement the new traits.
+
+3. **Phase 3 – Detach Arrow/execution**
+   - Move `arrow` helpers and `ArrowReaderBuilder` into a reference executor crate (e.g. `iceberg-engine-arrow`).

Review Comment:
   It sounds like this is the abstraction where DataFusion Comet would continue to live, which seems reasonable to me.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2555047408


##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers
+  catalog/*              # catalog adapters (REST, HMS, Glue, etc.)
+  integrations/
+    datafusion/          # combines core + implementations for DF
+    cache-moka/
+    playground/
+```
+
+- `crates/iceberg` no longer depends on opendal, Tokio, Arrow, or DataFusion.
+- Implementation crates depend on `iceberg` to get the trait surfaces they implement.
+- Higher-level crates (e.g., `iceberg-datafusion`) pull in the required runtime/FileIO/executor crates and expose an opinionated combination.
+
+### Core Trait Surfaces (within `iceberg`)
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- `FileRead` / `FileWrite` remain Iceberg-specific traits (range reads, metrics hooks, abort/commit) and live inside `iceberg`.
+- Concrete implementations (opendal, local FS, custom stores) live in companion crates and return trait objects.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- The trait lives in `iceberg`; crates like `iceberg-runtime-tokio` implement it and expose constructors.
+
+#### Catalog / Table / Transaction / Scan
+
+- All existing traits and data structures remain in `crates/iceberg`.
+- `TableScan` continues to emit pure plan descriptors; executors interpret them.
+- `Transaction` uses injected `Runtime` for retry/backoff but otherwise stays unchanged.
+
+### Usage Modes
+
+- **Custom stacks**: depend solely on `iceberg` plus self-authored implementations that satisfy the traits.
+- **Pre-built stacks**: depend on crates such as `iceberg-datafusion` that bundle `iceberg` with `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and `iceberg-engine-arrow` (and expose higher-level APIs).
+- `iceberg` itself does not re-export any of the companion crates; users compose them explicitly.
+
+## Migration Plan
+
+1. **Phase 1 – Slim down `crates/iceberg`**
+   - Remove direct dependencies on opendal, Tokio, Arrow, and DataFusion from `iceberg`.
+   - Move the concrete implementations into new crates (while keeping the same code initially).
+
+2. **Phase 2 – Stabilize trait surfaces**

Review Comment:
   Updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3569453248

   cc @liurenjie1024 and @kevinjqliu please review again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2533363000


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;

Review Comment:
   Yes, just for convenience. Sometimes we don’t care about streaming writes and just want to write content to a path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "liurenjie1024 (via GitHub)" <gi...@apache.org>.
liurenjie1024 commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2545186195


##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers
+  catalog/*              # catalog adapters (REST, HMS, Glue, etc.)
+  integrations/
+    datafusion/          # combines core + implementations for DF
+    cache-moka/
+    playground/
+```
+
+- `crates/iceberg` no longer depends on opendal, Tokio, Arrow, or DataFusion.
+- Implementation crates depend on `iceberg` to get the trait surfaces they implement.
+- Higher-level crates (e.g., `iceberg-datafusion`) pull in the required runtime/FileIO/executor crates and expose an opinionated combination.
+
+### Core Trait Surfaces (within `iceberg`)
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- `FileRead` / `FileWrite` remain Iceberg-specific traits (range reads, metrics hooks, abort/commit) and live inside `iceberg`.
+- Concrete implementations (opendal, local FS, custom stores) live in companion crates and return trait objects.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- The trait lives in `iceberg`; crates like `iceberg-runtime-tokio` implement it and expose constructors.
+
+#### Catalog / Table / Transaction / Scan
+
+- All existing traits and data structures remain in `crates/iceberg`.
+- `TableScan` continues to emit pure plan descriptors; executors interpret them.
+- `Transaction` uses injected `Runtime` for retry/backoff but otherwise stays unchanged.
+
+### Usage Modes
+
+- **Custom stacks**: depend solely on `iceberg` plus self-authored implementations that satisfy the traits.
+- **Pre-built stacks**: depend on crates such as `iceberg-datafusion` that bundle `iceberg` with `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and `iceberg-engine-arrow` (and expose higher-level APIs).
+- `iceberg` itself does not re-export any of the companion crates; users compose them explicitly.
+
+## Migration Plan
+
+1. **Phase 1 – Slim down `crates/iceberg`**
+   - Remove direct dependencies on opendal, Tokio, Arrow, and DataFusion from `iceberg`.

Review Comment:
   I think we already have datafusion out of the `iceberg` crate. Moving `arrow` related things maybe not that easy, arrow has been used in several places: 
   
   1. Transform function implementation.
   2. File reader/writers.
   3. A local parallel scan engine, e.g. `to_arrow` method in `TableScan`.
   
   I think the first step would be moving 3 out. To move 2 out, we need sth similar to https://github.com/apache/iceberg/pull/12774 . I think we could move 1 out after 2 is done.



##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers
+  catalog/*              # catalog adapters (REST, HMS, Glue, etc.)
+  integrations/
+    datafusion/          # combines core + implementations for DF
+    cache-moka/
+    playground/
+```
+
+- `crates/iceberg` no longer depends on opendal, Tokio, Arrow, or DataFusion.
+- Implementation crates depend on `iceberg` to get the trait surfaces they implement.
+- Higher-level crates (e.g., `iceberg-datafusion`) pull in the required runtime/FileIO/executor crates and expose an opinionated combination.
+
+### Core Trait Surfaces (within `iceberg`)
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- `FileRead` / `FileWrite` remain Iceberg-specific traits (range reads, metrics hooks, abort/commit) and live inside `iceberg`.
+- Concrete implementations (opendal, local FS, custom stores) live in companion crates and return trait objects.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- The trait lives in `iceberg`; crates like `iceberg-runtime-tokio` implement it and expose constructors.
+
+#### Catalog / Table / Transaction / Scan
+
+- All existing traits and data structures remain in `crates/iceberg`.
+- `TableScan` continues to emit pure plan descriptors; executors interpret them.
+- `Transaction` uses injected `Runtime` for retry/backoff but otherwise stays unchanged.
+
+### Usage Modes
+
+- **Custom stacks**: depend solely on `iceberg` plus self-authored implementations that satisfy the traits.
+- **Pre-built stacks**: depend on crates such as `iceberg-datafusion` that bundle `iceberg` with `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and `iceberg-engine-arrow` (and expose higher-level APIs).
+- `iceberg` itself does not re-export any of the companion crates; users compose them explicitly.
+
+## Migration Plan
+
+1. **Phase 1 – Slim down `crates/iceberg`**
+   - Remove direct dependencies on opendal, Tokio, Arrow, and DataFusion from `iceberg`.
+   - Move the concrete implementations into new crates (while keeping the same code initially).
+
+2. **Phase 2 – Stabilize trait surfaces**

Review Comment:
   Hmm, I think this should be first step?



##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers

Review Comment:
   Should we consider the name of this engine to be mini or local? It seems odd to me since `arrow` is more like an in memory format.



##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers
+  catalog/*              # catalog adapters (REST, HMS, Glue, etc.)
+  integrations/
+    datafusion/          # combines core + implementations for DF
+    cache-moka/
+    playground/
+```
+
+- `crates/iceberg` no longer depends on opendal, Tokio, Arrow, or DataFusion.
+- Implementation crates depend on `iceberg` to get the trait surfaces they implement.
+- Higher-level crates (e.g., `iceberg-datafusion`) pull in the required runtime/FileIO/executor crates and expose an opinionated combination.
+
+### Core Trait Surfaces (within `iceberg`)
+
+#### FileIO

Review Comment:
   As we said before, this may not be a good place to discuss details about `FileIO`.  We should have another rfc to discuss this.



##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers

Review Comment:
   Also, should we consider moving this to integrations? The position of this local engine is similar to datafusion, which provides a relatively high level api.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "JarroVGIT (via GitHub)" <gi...@apache.org>.
JarroVGIT commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2538714249


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.

Review Comment:
   The point of this RFC (iiuc) is to make a IO-agnostic core of the Iceberg specification. Sometimes this is referred to as sans-io. This core would encapsulate the core logic and workings of Iceberg, without a dependency. 
   
   The module that you refer to is an example of the opposite of this model. At present, the current crate (`iceberg`) supports Tokio or Smol, but no other runtime. If you want to add a runtime, you would have to change this crate. With a sans-io approach, you can add runtimes by adding other crates. I could create my own runtime, and then publish a `iceberg-runtime-mysuperruntime` crate, without the `iceberg-kernel` crate ever being aware of its existence. 
   
   So, I don't think it is possible (or at least, wise) to just split the current module in another crate in the spirit of this RFC, and have the kernel depend on it. The kernel defines the abstraction, and the "plugin" crate implements that abstraction (and therefor, depends on the kernel, not the other way around). 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2545291104


##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers

Review Comment:
   Makes sense to me,



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "lonless9 (via GitHub)" <gi...@apache.org>.
lonless9 commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2553042310


##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,196 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Modularize `iceberg` Implementations
+
+## Background
+
+Issue #1819 highlighted that the current `iceberg` crate mixes the Iceberg protocol abstractions (catalog/table/plan/transaction) with concrete runtime, storage, and execution implementations (Tokio runtime wrappers, opendal-based `FileIO`, Arrow readers, DataFusion helpers, etc.). This makes the crate heavy, couples unrelated dependencies, and prevents users from bringing their own engines or storage stacks.
+
+After recent maintainer discussions we agreed on two principles:
+1. The `iceberg` crate itself remains the single source of truth for all protocol traits and data structures.
+2. All concrete integrations (Tokio runtime, opendal `FileIO`, Arrow/DataFusion executors, catalog adapters, etc.) move out of `iceberg` into dedicated companion crates. Users who need a ready-made execution path can depend on those crates (for example `iceberg-datafusion`) while users building custom stacks can depend solely on `iceberg`.
+
+This RFC describes the plan to slim down `iceberg` into a pure protocol crate and to reorganize the workspace around pluggable companion crates.
+
+## Goals and Scope
+
+- **Keep `iceberg` as the protocol crate**: it exposes all traits (`Catalog`, `Table`, `Transaction`, `FileIO`, `Runtime`, `ScanPlan`, etc.) plus metadata/plan logic, but no longer ships concrete runtimes or storage adapters.
+- **Detach embedded implementations**: move opendal-based IO, Tokio runtime helpers, Arrow converters, and similar code into separate crates under `crates/fileio/*`, `crates/runtime/*`, `crates/engine/*`, or existing integration crates.
+- **Enable composable combinations**: users assemble the stack they need by combining `iceberg` with specific implementation crates (e.g., `iceberg-fileio-opendal`, `iceberg-runtime-tokio`, `iceberg-engine-arrow`, `iceberg-datafusion`).
+- **Minimize breaking surfaces**: trait APIs stay in `iceberg`; downstream crates only adjust their dependency graph.
+
+Out of scope: changing the Iceberg table specification or rewriting catalog adapters’ external behavior.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  iceberg/                # core traits, metadata, planning, transactions
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  engine/
+    arrow/               # Arrow executor & schema helpers
+  catalog/*              # catalog adapters (REST, HMS, Glue, etc.)
+  integrations/
+    datafusion/          # combines core + implementations for DF
+    cache-moka/
+    playground/
+```
+
+- `crates/iceberg` no longer depends on opendal, Tokio, Arrow, or DataFusion.
+- Implementation crates depend on `iceberg` to get the trait surfaces they implement.
+- Higher-level crates (e.g., `iceberg-datafusion`) pull in the required runtime/FileIO/executor crates and expose an opinionated combination.
+
+### Core Trait Surfaces (within `iceberg`)
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- `FileRead` / `FileWrite` remain Iceberg-specific traits (range reads, metrics hooks, abort/commit) and live inside `iceberg`.
+- Concrete implementations (opendal, local FS, custom stores) live in companion crates and return trait objects.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- The trait lives in `iceberg`; crates like `iceberg-runtime-tokio` implement it and expose constructors.
+
+#### Catalog / Table / Transaction / Scan
+
+- All existing traits and data structures remain in `crates/iceberg`.
+- `TableScan` continues to emit pure plan descriptors; executors interpret them.
+- `Transaction` uses injected `Runtime` for retry/backoff but otherwise stays unchanged.
+
+### Usage Modes
+
+- **Custom stacks**: depend solely on `iceberg` plus self-authored implementations that satisfy the traits.
+- **Pre-built stacks**: depend on crates such as `iceberg-datafusion` that bundle `iceberg` with `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and `iceberg-engine-arrow` (and expose higher-level APIs).
+- `iceberg` itself does not re-export any of the companion crates; users compose them explicitly.
+
+## Migration Plan
+
+1. **Phase 1 – Slim down `crates/iceberg`**
+   - Remove direct dependencies on opendal, Tokio, Arrow, and DataFusion from `iceberg`.

Review Comment:
   The migration difficulty of the mentioned dependencies varies, and they should be prioritized. Some have already been implemented, while others require significant modifications. Furthermore, I guess that migrating the arrow dependency is not urgent; remaining in an intermediate migration state for an extended period is acceptable, and this could ideally be considered a final goal.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2541353796


##########
docs/rfcs/0001_modularize_iceberg_implementations.md:
##########
@@ -0,0 +1,177 @@
+# RFC: Modularize `iceberg` Implementations

Review Comment:
   ```suggestion
   <!--
     ~ Licensed to the Apache Software Foundation (ASF) under one
     ~ or more contributor license agreements.  See the NOTICE file
     ~ distributed with this work for additional information
     ~ regarding copyright ownership.  The ASF licenses this file
     ~ to you under the Apache License, Version 2.0 (the
     ~ "License"); you may not use this file except in compliance
     ~ with the License.  You may obtain a copy of the License at
     ~
     ~   http://www.apache.org/licenses/LICENSE-2.0
     ~
     ~ Unless required by applicable law or agreed to in writing,
     ~ software distributed under the License is distributed on an
     ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     ~ KIND, either express or implied.  See the License for the
     ~ specific language governing permissions and limitations
     ~ under the License.
   -->
   
   # RFC: Modularize `iceberg` Implementations
   ```
   <!-- license-eye hidden identification -->



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "liurenjie1024 (via GitHub)" <gi...@apache.org>.
liurenjie1024 commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3574759984

   Let's keep this for a while to have more eyes on it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3551894607

   I had an offline discussion with @liurenjie1024 and we’ve agreed to refactor our efforts to modularize the `iceberg` implementations instead of adding a new `iceberg-kernel` crate. 
   
   In short, we’ll expose all our core traits in `iceberg` and make it modular so users can plug in whatever they need. At the same time, we’ll provide a pre-built stack to make it easier for users to start scanning an iceberg table.
   
   In the past, we thought it was better to split into more crates, but we realized it just added to our maintenance burden keeping those tiny crates up to date and most of the time we need to use them all at once.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2529856759


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn spawn_blocking<F, T>(&self, f: F) -> Self::JoinHandle<T>
+    where
+        F: FnOnce() -> T + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- `TableScan` planning, metadata refresh, and `Transaction::commit` depend only on this trait.
+- Crates such as `iceberg-runtime-tokio` provide concrete schedulers; consumers pick whichever runtime crate fits their stack.
+
+#### Catalog / Table / Transaction
+
+- The `Catalog` trait moves into the kernel and returns lightweight `TableHandle` objects (metadata + FileIO + Runtime).
+- `TableHandle` no longer embeds Arrow helpers; Arrow-specific logic lives in engine crates.
+- Transactions and their actions remain in the kernel, but rely on injected `Runtime` for retries/backoff.
+
+#### Scan / Planner
+
+- The kernel produces pure `TableScanPlan` descriptions (manifests, data-files, predicates, task graph).
+- Engines provide executors (e.g., `ArrowExecutor`) that transform plans into record batches or other runtime-specific artifacts.

Review Comment:
   👍 



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;

Review Comment:
   if this returns a writer already, what is the benefit to also allowing a direct `write`? is it just convenience?



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.

Review Comment:
   makes sense to me



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn spawn_blocking<F, T>(&self, f: F) -> Self::JoinHandle<T>

Review Comment:
   when woudl spawn_blocking be called? Avoiding blocking IO might be a nice design for the kernel -- and since all the IO traits are `async` I am not sure what the kernel would be calling that was blocking 🤔 



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,197 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by delta-kernel-rs. Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.

Review Comment:
   ```suggestion
   Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "liurenjie1024 (via GitHub)" <gi...@apache.org>.
liurenjie1024 commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2537005375


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)

Review Comment:
   Move this part to storage crate?



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.

Review Comment:
   I agree that we should keep public api as stable as possible, but it maybe not practical before we reach 1.0. Currently we reply on review to ensure it, but after reaching 1.0 we should use some autonomous checks to ensure that.



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO

Review Comment:
   I don't think we should discuss details of `FileIO` crate here. @CTTY already have a draft pr and design doc, we should discuss it there.



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine
+  catalog/*               # depend on kernel (+ chosen FileIO/Runtime crates)
+  integrations/*          # e.g. datafusion using facade or composing crates
+```
+
+### Trait Surfaces
+
+#### FileIO
+
+```rust
+pub struct FileMetadata {
+    pub size: u64,
+    ...
+}
+
+pub type FileReader = Box<dyn FileRead>;
+
+#[async_trait::async_trait]
+pub trait FileRead: Send + Sync + 'static {
+    async fn read(&self, range: Range<u64>) -> Result<Bytes>;
+}
+
+pub type FileWriter = Box<dyn FileWrite>;
+
+#[async_trait::async_trait]
+pub trait FileWrite: Send + Unpin + 'static {
+    async fn write(&mut self, bs: Bytes) -> Result<()>;
+    async fn close(&mut self) -> Result<FileMetadata>;
+}
+
+pub type StorageFactory = fn(attrs: HashMap<String, String> -> Result<Arc<dyn Storage>>);
+
+#[async_trait::async_trait]
+pub trait Storage: Clone + Send + Sync {
+    async fn reader(&self, path: &str) -> Result<FileReader>;
+    async fn writer(&self, path: &str) -> Result<FileWriter>;
+    async fn delete(&self, path: &str) -> Result<()>;
+    async fn exists(&self, path: &str) -> Result<bool>;
+
+    ...
+}
+
+pub struct FileIO {
+    registry: DashMap<String, StorageFactory>,
+}
+
+impl FileIO {
+    fn register(scheme: &str, factory: StorageFactory);
+
+    async fn read(path: &str) -> Result<Bytes>;
+    async fn reader(path: &str) -> Result<FileReader>;
+    async fn write(path: &str, bs: Bytes) -> Result<FileMetadata>;
+    async fn writer(path: &str) -> Result<FileWriter>;
+
+    async fn delete(&self, path: &str) -> Result<()>;
+    ...
+}
+```
+
+- The kernel only defines the trait and error types.
+- `iceberg-fileio-opendal` (new crate) ships an opendal-based implementation; other backends can publish their own crates.
+
+#### Runtime
+
+```rust
+pub trait Runtime: Send + Sync + 'static {
+    type JoinHandle<T>: Future<Output = T> + Send + 'static;
+
+    fn spawn<F, T>(&self, fut: F) -> Self::JoinHandle<T>
+    where
+        F: Future<Output = T> + Send + 'static,
+        T: Send + 'static;
+
+    fn sleep(&self, dur: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
+}
+```
+
+- `TableScan` planning, metadata refresh, and `Transaction::commit` depend only on this trait.
+- Crates such as `iceberg-runtime-tokio` provide concrete schedulers; consumers pick whichever runtime crate fits their stack.
+
+#### Catalog / Table / Transaction
+
+- The `Catalog` trait moves into the kernel and returns lightweight `TableHandle` objects (metadata + FileIO + Runtime).
+- `TableHandle` no longer embeds Arrow helpers; Arrow-specific logic lives in engine crates.
+- Transactions and their actions remain in the kernel, but rely on injected `Runtime` for retries/backoff.
+
+#### Scan / Planner
+
+- The kernel produces pure `TableScanPlan` descriptions (manifests, data-files, predicates, task graph).
+- Engines provide executors (e.g., `ArrowExecutor`) that transform plans into record batches or other runtime-specific artifacts.
+
+### Facade Behavior
+
+- The top-level `iceberg` crate becomes a facade (`pub use iceberg_kernel::*`) that enables a *composition* of default crates (e.g. `iceberg-runtime-tokio`, `iceberg-fileio-opendal`, and a reference executor) behind feature flags.
+- Existing convenience APIs (`Table::scan().to_arrow()`, `MemoryCatalog`, etc.) stay available but internally assemble the kernel with those default building blocks.
+
+## Migration Plan
+
+1. **Phase 1 – Create the kernel crate**
+   - Add `crates/kernel` and move `spec`, `expr`, `catalog`, `table`, `transaction`, `scan`, and supporting modules.
+   - Introduce temporary shim modules in the facade so existing imports keep working (mark them deprecated).
+
+2. **Phase 2 – Abstract runtime & IO**
+   - Define the `Runtime` and `FileIO` traits inside the kernel.
+   - Remove direct `tokio`/`opendal` dependencies from kernel modules.
+   - Introduce standalone crates (`iceberg-runtime-tokio`, `iceberg-fileio-opendal`, etc.) that implement the new traits.
+
+3. **Phase 3 – Detach Arrow/execution**
+   - Move `arrow` helpers and `ArrowReaderBuilder` into a reference executor crate (e.g. `iceberg-engine-arrow`).

Review Comment:
   In fact, there are several parts in the `to_arrow` method:
   1. `ArrowReaderBuilder` which is used to read one split of planned task. This is in fact compute engine independent, and we should leave it in `iceberg` crate.
   2. An executor to use runtime to scan table in parallel. I think this part should be move to the new default engine crate.



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api

Review Comment:
   Move `runtime_api` to `runtime` crate?



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.
+- **Stable facade for existing users**: the top-level `iceberg` crate continues to expose the familiar API by re-exporting the kernel plus a default engine feature.
+
+Out of scope: changes to the Iceberg table specification or rewriting catalog adapters.
+
+## Architecture Overview
+
+### Workspace Layout
+
+```
+crates/
+  kernel/                 # new: pure protocols & planning logic
+    spec/ expr/ catalog/ table/ transaction/ scan/ runtime_api
+    io/traits.rs          # FileIO traits (no opendal)
+  fileio/
+    opendal/             # e.g. `iceberg-fileio-opendal`
+    fs/                  # other FileIO implementations
+  runtime/
+    tokio/               # e.g. `iceberg-runtime-tokio`
+    smol/
+  iceberg/                # facade re-exporting kernel + default engine

Review Comment:
   How about another approach: we keep iceberg part as now, and move the default `Executor` which produces an arrow record batch stream to another crate in `integrations`? This aligns with what we have in datafusion integration.



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.
+- **No default storage dependency**: the kernel defines `FileIO` traits only; concrete implementations (for example `iceberg-fileio-opendal`) live in dedicated crates.

Review Comment:
   I'm thinking that we have a `iceberg-storage` crate, which contains all fileio related things, including `FileIO/InputFile/OutputFile` struct, `Storage` trait, some builtin storage implemention(enabled independently by feature).



##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.

Review Comment:
   We already have a runtime module, which serves similar purpose. I'm thinking maybe we should split out a `iceberg-runtime` crate, and have the `iceberg` crate relying on it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "liurenjie1024 (via GitHub)" <gi...@apache.org>.
liurenjie1024 commented on code in PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#discussion_r2541277082


##########
docs/rfcs/0001_kernel.md:
##########
@@ -0,0 +1,192 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+-->
+
+# RFC: Extract `iceberg-kernel` for Pluggable Execution Layers
+
+## Background
+
+Issue #1819 proposes decoupling the protocol/metadata/plan logic that currently lives inside the `iceberg` crate so that it can serve as a reusable “kernel,” similar to the approach taken by [delta-kernel-rs](https://github.com/delta-io/delta-kernel-rs). Today the `iceberg` crate simultaneously exposes the public trait surface and the default engine (Tokio runtime, opendal-backed FileIO, Arrow readers, etc.). This tight coupling makes it difficult for downstream projects to embed Iceberg metadata while providing their own storage, runtime, or execution stack.
+
+## Goals and Scope
+
+- **Full read & write coverage**: the kernel must contain every protocol component required for both scan planning and transactional writes (append, rewrite, commit, etc.).
+- **No default runtime dependency**: the kernel defines a `Runtime` trait instead of depending on Tokio or Smol.

Review Comment:
   What I want to say is to have a separate `iceberg-runtime` crate which only contains trait definition, and have the core `iceberg` crate relies on the trait only crate. The benefit of this approach is that we could have the core crate to be lightweight, and we could have smaller. But I had an offlie sync with @Xuanwo , and we reached consensus that we should put trait definitions in core crate, since we should not encourage user to use `iceberg-runtime` standalone, they are tailored specifically for iceberg's usage. Advanced users are expected to provided their own implementation of runtime api, but that should also be tailed for iceberg.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] rfc: Modularize `iceberg` Implementations [iceberg-rust]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3601970058

   Let's go!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3538992918

   merged main to fix ci


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] docs: Add RFC for iceberg-kernel [iceberg-rust]

Posted by "ZENOTME (via GitHub)" <gi...@apache.org>.
ZENOTME commented on PR #1854:
URL: https://github.com/apache/iceberg-rust/pull/1854#issuecomment-3528197886

   I'm thinking is reasonable to split out `spec` part as a single minimum module? It just provide the memory representation of iceberg spec and de/serialize way. It can be evolve quickly and as a minimum module reuse by external user or inner module. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org