Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Preserve session id when using ctx.enable_url_table() #14004

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading