Skip to content

Commit

Permalink
match cmd.format()
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeiPatiakin committed Dec 19, 2024
1 parent a22783b commit 5926a37
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions src/frontend/flight/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,36 +163,35 @@ impl SeafowlFlightHandler {
});
}

let (sync_target, url) = if cmd.format == TableFormat::Delta as i32 {
let log_store = match cmd.store {
None => self
.context
.get_internal_object_store()?
.get_log_store(&cmd.path),
Some(store_loc) => {
self.context
.metastore
.object_stores
.get_log_store_for_table(
Url::parse(&store_loc.location).map_err(|e| {
DataFusionError::Execution(format!(
"Couldn't parse sync location: {e}"
))
})?,
store_loc.options,
cmd.path,
)
.await?
}
};
let url = log_store.root_uri();
(LakehouseSyncTarget::Delta(log_store), url)
} else if cmd.format == TableFormat::Iceberg as i32 {
return Err(SyncError::NotImplemented);
} else {
return Err(SyncError::InvalidMessage {
reason: "Unknown table format".to_string(),
});
let (sync_target, url) = match cmd.format() {
TableFormat::Delta => {
let log_store = match cmd.store {
None => self
.context
.get_internal_object_store()?
.get_log_store(&cmd.path),
Some(store_loc) => {
self.context
.metastore
.object_stores
.get_log_store_for_table(
Url::parse(&store_loc.location).map_err(|e| {
DataFusionError::Execution(format!(
"Couldn't parse sync location: {e}"
))
})?,
store_loc.options,
cmd.path,
)
.await?
}
};
let url = log_store.root_uri();
(LakehouseSyncTarget::Delta(log_store), url)
}
TableFormat::Iceberg => {
return Err(SyncError::NotImplemented);
}
};

let num_batches = batches.len();
Expand Down

0 comments on commit 5926a37

Please sign in to comment.