feat: supports passing user params into coprocessor (#962)

* feat: make args in coprocessor optional

* feat: supports kwargs for coprocessor as params passed by the users

* feat: supports params for /run-script

* fix: we should rewrite the coprocessor by removing kwargs

* fix: remove println

* fix: compile error after rebasing

* fix: improve http_handler_test

* test: http scripts api with user params

* refactor: tweak all to_owned
This commit is contained in:
dennis zhuang
2023-02-16 16:11:26 +08:00
committed by GitHub
parent ddbc97befb
commit 5ec1a7027b
19 changed files with 564 additions and 142 deletions

View File

@@ -19,6 +19,7 @@ mod opentsdb;
mod prometheus;
mod standalone;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
@@ -512,9 +513,14 @@ impl ScriptHandler for Instance {
}
}
async fn execute_script(&self, schema: &str, script: &str) -> server_error::Result<Output> {
async fn execute_script(
&self,
schema: &str,
script: &str,
params: HashMap<String, String>,
) -> server_error::Result<Output> {
if let Some(handler) = &self.script_handler {
handler.execute_script(schema, script).await
handler.execute_script(schema, script, params).await
} else {
server_error::NotSupportedSnafu {
feat: "Script execution in Frontend",