diff --git a/Cargo.lock b/Cargo.lock index 62152096ad8c1..bd59189204b02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -643,7 +643,7 @@ dependencies = [ [[package]] name = "arrow-udf-python" version = "0.1.0" -source = "git+https://github.com/risingwavelabs/arrow-udf.git?rev=273c8c5#273c8c50ddca10a8988691e8d95374f3af371548" +source = "git+https://github.com/risingwavelabs/arrow-udf.git?rev=0479980#04799805f3b17a7feb55b94591967876b773e263" dependencies = [ "anyhow", "arrow-array 50.0.0", @@ -652,6 +652,7 @@ dependencies = [ "arrow-schema 50.0.0", "lazy_static", "pyo3", + "pyo3-build-config", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a08760adc1601..3297da08d250d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -136,7 +136,7 @@ arrow-ord = "50" arrow-row = "50" arrow-udf-js = "0.1" arrow-udf-wasm = { version = "0.1.2", features = ["build"] } -arrow-udf-python = { git = "https://github.com/risingwavelabs/arrow-udf.git", rev = "273c8c5" } +arrow-udf-python = { git = "https://github.com/risingwavelabs/arrow-udf.git", rev = "0479980" } arrow-array-deltalake = { package = "arrow-array", version = "48.0.1" } arrow-buffer-deltalake = { package = "arrow-buffer", version = "48.0.1" } arrow-cast-deltalake = { package = "arrow-cast", version = "48.0.1" } diff --git a/ci/scripts/run-e2e-test.sh b/ci/scripts/run-e2e-test.sh index 95bf4fc679add..8663bf9cd1679 100755 --- a/ci/scripts/run-e2e-test.sh +++ b/ci/scripts/run-e2e-test.sh @@ -82,10 +82,10 @@ sqllogictest -p 4566 -d test './e2e_test/database/test.slt' echo "--- e2e, $mode, Apache Superset" sqllogictest -p 4566 -d dev './e2e_test/superset/*.slt' --junit "batch-${profile}" -echo "--- e2e, $mode, python udf" +echo "--- e2e, $mode, external python udf" python3 e2e_test/udf/test.py & sleep 1 -sqllogictest -p 4566 -d dev './e2e_test/udf/udf.slt' +sqllogictest -p 4566 -d dev './e2e_test/udf/external_udf.slt' pkill python3 sqllogictest -p 4566 -d dev './e2e_test/udf/alter_function.slt' @@ -93,14 +93,16 @@ sqllogictest -p 4566 -d dev './e2e_test/udf/graceful_shutdown_python.slt' # FIXME: flaky test # sqllogictest -p 4566 -d dev './e2e_test/udf/retry_python.slt' -echo "--- e2e, $mode, java udf" +echo "--- e2e, $mode, external java udf" java -jar risingwave-udf-example.jar & sleep 1 -sqllogictest -p 4566 -d dev './e2e_test/udf/udf.slt' +sqllogictest -p 4566 -d dev './e2e_test/udf/external_udf.slt' pkill java -echo "--- e2e, $mode, wasm udf" +echo "--- e2e, $mode, embedded udf" sqllogictest -p 4566 -d dev './e2e_test/udf/wasm_udf.slt' +sqllogictest -p 4566 -d dev './e2e_test/udf/js_udf.slt' +sqllogictest -p 4566 -d dev './e2e_test/udf/python_udf.slt' echo "--- Kill cluster" cluster_stop diff --git a/e2e_test/udf/udf.slt b/e2e_test/udf/external_udf.slt similarity index 100% rename from e2e_test/udf/udf.slt rename to e2e_test/udf/external_udf.slt diff --git a/src/expr/core/src/expr/expr_udf.rs b/src/expr/core/src/expr/expr_udf.rs index b5fcc0cb052cb..296f69c4c0ce3 100644 --- a/src/expr/core/src/expr/expr_udf.rs +++ b/src/expr/core/src/expr/expr_udf.rs @@ -205,7 +205,7 @@ impl Build for UserDefinedFunction { UdfImpl::JavaScript(rt) } "python" if udf.body.is_some() => { - let mut rt = PythonRuntime::new()?; + let mut rt = PythonRuntime::builder().sandboxed(true).build()?; let body = udf.get_body()?; rt.add_function( identifier, diff --git a/src/expr/core/src/table_function/user_defined.rs b/src/expr/core/src/table_function/user_defined.rs index 023e79c63f407..c00c728475686 100644 --- a/src/expr/core/src/table_function/user_defined.rs +++ b/src/expr/core/src/table_function/user_defined.rs @@ -221,7 +221,7 @@ pub fn new_user_defined(prost: &PbTableFunction, chunk_size: usize) -> Result { - let mut rt = PythonRuntime::new()?; + let mut rt = PythonRuntime::builder().sandboxed(true).build()?; let body = udtf.get_body()?; rt.add_function( identifier,