-
Notifications
You must be signed in to change notification settings - Fork 752
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
chore(query): introduce meta Runtime #5294
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
@@ -424,6 +430,30 @@ impl QueryContext { | |||
})?; | |||
Ok(FunctionContext { tz }) | |||
} | |||
|
|||
pub fn block_on_meta<F>(&self, future: F) -> Result<F::Output> | |||
where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this function, show function
can work well in Mac Osx.
I do not know whether this code is right or not. cc @drmingdrmer @dantengsky
pub fn block_on_meta<F>(&self, future: F) -> Result<F::Output> | ||
where | ||
F: Future + Send + 'static, | ||
F::Output: Send + 'static, | ||
{ | ||
let rt = self.get_meta_runtime(); | ||
let (tx, rx): ( | ||
std::sync::mpsc::Sender<F::Output>, | ||
std::sync::mpsc::Receiver<F::Output>, | ||
) = std::sync::mpsc::channel(); | ||
|
||
rt.try_spawn(async move { | ||
let res = future.await; | ||
tx.send(res).unwrap(); | ||
})?; | ||
match rx.recv() { | ||
Ok(v) => Ok(v), | ||
Err(cause) => Err(ErrorCode::LogicalError(format!( | ||
"Logical error, receive error. {:?}", | ||
cause | ||
))), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One concern: this method can not be called in a tokio-runtime, right? This method itself can not provide any guarantee on this. It's totally up to the caller.
Except this, everything else looks great to me:DDD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can, because QueryNormalizer::normalize
is inside tokio-runtime.
hmm, this approach may block the runtime, I revert it first. |
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
Summary about this PR
Changelog
Related Issues
Related #5287