Skip to content

Commit 33ba32d

Browse files
committed
Register tables only in one place
1 parent dab7670 commit 33ba32d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

benchmarks/src/tpch/run.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,18 @@ impl DistributedSessionBuilder for RunOpt {
147147
builder = builder.with_physical_optimizer_rule(Arc::new(rule));
148148
}
149149

150-
let state = builder
150+
Ok(builder
151151
.with_config(config)
152152
.with_runtime_env(rt_builder.build_arc()?)
153-
.build();
154-
155-
let ctx = SessionContext::from(state);
156-
self.register_tables(&ctx).await?;
157-
Ok(ctx.state())
153+
.build())
158154
}
159155
}
160156

161157
impl RunOpt {
162158
pub fn run(self) -> Result<()> {
163159
let ports = get_free_ports(self.workers);
164160

165-
let _handle = self.clone().spawn_workers(ports.clone());
166-
drop(_handle);
161+
let _worker_handles = self.clone().spawn_workers(ports.clone());
167162

168163
let rt = tokio::runtime::Builder::new_multi_thread()
169164
.worker_threads(self.threads.unwrap_or(get_available_parallelism()))
@@ -217,6 +212,8 @@ impl RunOpt {
217212
.build_session_state(DistributedSessionBuilderContext::default())
218213
.await?;
219214
let ctx = SessionContext::new_with_state(state);
215+
self.register_tables(&ctx).await?;
216+
220217
println!("Running benchmarks with the following options: {self:?}");
221218
let query_range = match self.query {
222219
Some(query_id) => query_id..=query_id,

0 commit comments

Comments
 (0)