[Iceberg] Add basic iceberg integration - #595
Conversation
eb071d9 to
72203a0
Compare
|
Lgtm, looks nice as an initial integration. |
| use iceberg::{Error, ErrorKind}; | ||
|
|
||
| /// Converts a datafusion error into an iceberg error. | ||
| pub fn iceberg_err(error: DataFusionError) -> Error { |
There was a problem hiding this comment.
pub fn iceberg_err(error: DataFusionError) -> iceberg::Error {
match error {
DataFusionError::External(error) => {
match error.downcast::<iceberg::Error>() {
Ok(error) => *error,
Err(error) => iceberg::Error::new(
ErrorKind::Unexpected,
format!("DataFusion execution failed: {error}"),
),
}
}
error => iceberg::Error::new(
ErrorKind::Unexpected,
format!("DataFusion execution failed: {error}"),
),
}
}Could we have structured error handling here instead of the string? Can be follow up.
There was a problem hiding this comment.
The challenge with this is that this approach would not survive a serialization roundtrip.
When propagating DataFusionError messages across the network, we use https://github.com/datafusion-contrib/datafusion-distributed/blob/9dd018a392185c6853f4d32a43d839219b31730d/src/protocol/grpc/errors, and any error that relies on type downcasting is lost in the way.
72203a0 to
bd7e471
Compare
bd7e471 to
e840655
Compare
61c91e2 to
1408dd7
Compare
1408dd7 to
0f30c31
Compare
0f30c31 to
5bb08bb
Compare
5bb08bb to
872eebe
Compare
Introduces the empty `datafusion-distributed-iceberg` crate, its dependency set, and the corresponding lockfile updates. This is the first layer of the Iceberg integration stack. The implementation follows in #595.
a3b361d to
6a5767e
Compare
6a5767e to
a6cb6af
Compare
|
🤔 interesting, this passes on my Mac, but fails on the CI: It sounds like a bug in |
|
Ah no, it was just that git lfs was disabled, we are good now |
|
Merged! For further contributions to iceberg, let's make them to the Once |
Closes #600
Note
The PR is large because it contains a lot of boilerplate for a basic Iceberg integration, but it was crafted by hand, and it contains just whatever is minimal to get some tests e2e running
Adds a very basic Iceberg integration as a new crate that depends on
datafusion,datafusion-distributedandiceberg-rust.This is mostly a rewrite of https://github.com/apache/iceberg-rust/tree/main/crates/integrations/datafusion, with a few exceptions for helpers like expression transpilation.
It heavily relies on
WorkUnitFeeds for streamingFileScanTasks at runtime, following a pattern that looks like this today in single-node:And that will look like this once distribution is supported:
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ Coordinating Context │ │ ┌────────────────────────────────────────────────────────────────────────────────────────┐│ ││ IcebergWorkUnitFeed │ │┌─────────────┐┌─────────────┐┌────────────┐┌────────────┐┌─────────────┐┌─────────────┐││ │││ Feed 0 ││ Feed 1 ││ Feed 2 ││ Feed 3 ││ Feed 4 ││ Feed 5 ││ │└──────┬──────┘└─────┬───────┘└────┬───────┘└───────┬────┘└───────┬─────┘└──────┬──────┘││ └└───────┼─────────────┼─────────────┼────────────────┼─────────────┼─────────────┼───────┴ .─────▼─────. .─────▼─────. .─────▼─────. .─────▼─────. .─────▼─────. .─────▼─────. (FileScanTask (FileScanTask (FileScanTask ) (FileScanTask (FileScanTask (FileScanTask ) .───────────. `─────┬─────' .───────────. `─────┬─────' .───────────. `─────┬─────' (FileScanTask ) │ (FileScanTask ) │ (FileScanTask ) │ `─────┬─────' │ .───────────. │ `───────────' │ │ │ (FileScanTask ) │ │ │ Worker 0 │ │ `─────┬─────' │ │ │ Worker 1 ┌ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ┐┌ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ┐ ┌───────┼─────────────┼─────────────┼───────┐┌───────┼─────────────┼─────────────┼───────┐ │ │ │ IcebergD│taSource │ ││ │ IcebergD│taSource │ │ │ │ │ │ │ ││ │ │ │ │ │ │┌──────▼─────┐┌──────▼─────┐┌──────▼─────┐ ││┌──────▼─────┐┌──────▼─────┐┌──────▼─────┐ │ │ ││Partition 0 ││Partition 1 ││Partition 2 │ │││Partition 0 ││Partition 1 ││Partition 2 │ │ │ ││ArrowReader ││ArrowReader ││ArrowReader │ │││ArrowReader ││ArrowReader ││ArrowReader │ │ │ │└──────┬─────┘└──────┬─────┘└──────┬─────┘ ││└──────┬─────┘└──────┬─────┘└──────┬─────┘ │ │ │ │ │ │ ││ │ │ │ │ │ │ .─────▼─────. │ .─────▼─────. ││ │ ▼ ▼ │ │ │( RecordBatch ).─────▼─────.( RecordBatch )││ .─────▼─────. .───────────. .───────────. │ │ │ `─────┬─────'( RecordBatch ).───────────. ││( RecordBatch ( RecordBatch ) RecordBatch )│ │ │ │ `─────┬─────'( RecordBatch )││ `─────┬─────' `───────────' `─────┬─────' │ │ │ │ │ `───────────' ││ │ ( RecordBatch ) │ │ │ │ │ │ │ ││ │ `─────┬─────' │ │ │ └───────┼─────────────┼─────────────┼───────┘└───────┼─────────────┼─────────────┼───────┘ │ ▼ ▼ ▼ ││ ▼ ▼ ▼ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─However, this PR just adds a very basic integration that includes:
TableProviderandTableProviderFactoryimplementations, very similar to what https://github.com/apache/iceberg-rust/tree/main/crates/integrations/datafusion has today on this frontIcebergWorkUnitFeedimplementation that streamsFileScanTasks messages at execution time as new files are discoveredIcebergDataSourcethat reads theFileScanTaskstreams, executing the tasks and yielding ArrowRecordBatches.It's still laking:
FileScanTasks andIcebergDataSourcesStack created with GitHub Stacks CLI • Give Feedback 💬