Skip to content

Commit

Permalink
feat: preserve session id when using cxt.enable_url_table() (#14004)
Browse files Browse the repository at this point in the history
  • Loading branch information
milenkovicm authored Jan 6, 2025
1 parent 69687da commit 3f4297f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,11 @@ impl SessionContext {
current_catalog_list,
Arc::clone(&factory) as Arc<dyn UrlTableFactory>,
));

let session_id = self.session_id.clone();
let ctx: SessionContext = self
.into_state_builder()
.with_session_id(session_id)
.with_catalog_list(catalog_list)
.build()
.into();
Expand Down Expand Up @@ -2222,6 +2225,16 @@ mod tests {
assert_batches_eq!(expected, &result);
Ok(())
}
#[test]
fn preserve_session_context_id() -> Result<()> {
let ctx = SessionContext::new();
// it does make sense to preserve session id in this case
// as `enable_url_table()` can be seen as additional configuration
// option on ctx.
// some systems like datafusion ballista relies on stable session_id
assert_eq!(ctx.session_id(), ctx.enable_url_table().session_id());
Ok(())
}

struct MyPhysicalPlanner {}

Expand Down

0 comments on commit 3f4297f

Please sign in to comment.