Skip to content

Commit 22f8766

Browse files
authored
Merge pull request #146 from influxdata/tm/format-the-snake
chore: move `udf_query` into its own `query` module
2 parents 529da3d + 8f918ea commit 22f8766

File tree

16 files changed

+83
-42
lines changed

16 files changed

+83
-42
lines changed

Cargo.lock

Lines changed: 15 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ members = [
66
"guests/python",
77
"guests/rust",
88
"host",
9+
"query",
910
]
1011

1112
[workspace.package]
@@ -24,9 +25,12 @@ datafusion-sql = { version = "49.0.1", default-features = false }
2425
datafusion-udf-wasm-arrow2bytes = { path = "arrow2bytes", version = "0.1.0" }
2526
datafusion-udf-wasm-bundle = { path = "guests/bundle", version = "0.1.0" }
2627
datafusion-udf-wasm-guest = { path = "guests/rust", version = "0.1.0" }
28+
datafusion-udf-wasm-host = { path = "host", version = "0.1.0" }
2729
datafusion-udf-wasm-python = { path = "guests/python", version = "0.1.0" }
30+
datafusion-udf-wasm-query = { path = "query", version = "0.1.0" }
2831
http = { version = "1.3.1", default-features = false }
2932
hyper = { version = "1.7", default-features = false }
33+
insta = { version = "1.43.2", "default-features" = false }
3034
pyo3 = { version = "0.27.1", default-features = false, features = ["macros"] }
3135
sqlparser = { version = "0.55.0", default-features = false, features = [
3236
"std",

host/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ license.workspace = true
77
[dependencies]
88
anyhow.workspace = true
99
arrow.workspace = true
10-
datafusion.workspace = true
1110
datafusion-common.workspace = true
1211
datafusion-expr.workspace = true
13-
datafusion-sql.workspace = true
1412
datafusion-udf-wasm-arrow2bytes.workspace = true
1513
http.workspace = true
1614
hyper.workspace = true
1715
rand = { version = "0.9" }
1816
siphasher = { version = "1", default-features = false }
19-
sqlparser.workspace = true
2017
tar.workspace = true
2118
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "sync"] }
2219
wasmtime.workspace = true
@@ -29,7 +26,7 @@ datafusion-udf-wasm-bundle = { workspace = true, features = [
2926
"example",
3027
"python"
3128
] }
32-
insta = "1.43.2"
29+
insta.workspace = true
3330
tokio = { workspace = true, features = ["fs", "macros"] }
3431
wiremock = "0.6.5"
3532

host/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ mod error;
4747
pub mod http;
4848
mod linker;
4949
mod tokio_helpers;
50-
pub mod udf_query;
5150
pub mod vfs;
5251

5352
/// State of the WASM payload.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
mod python;
22
mod rust;
33
mod test_utils;
4-
mod udf_query;

host/tests/integration_tests/python/inspection/errors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use datafusion_common::DataFusionError;
2-
31
use crate::integration_tests::python::test_utils::python_scalar_udfs;
2+
use datafusion_common::DataFusionError;
43

54
#[tokio::test(flavor = "multi_thread")]
65
async fn test_invalid_syntax() {

host/tests/integration_tests/python/inspection/filter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use datafusion_expr::ScalarUDFImpl;
2-
31
use crate::integration_tests::python::test_utils::python_scalar_udfs;
2+
use datafusion_expr::ScalarUDFImpl;
43

54
#[tokio::test(flavor = "multi_thread")]
65
async fn test_underscore() {

host/tests/integration_tests/python/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ mod examples;
33
mod inspection;
44
mod runtime;
55
mod state;
6-
pub(crate) mod test_utils;
6+
mod test_utils;
77
mod types;

host/tests/integration_tests/python/state.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
66
use std::sync::Arc;
77

8+
use crate::integration_tests::{
9+
python::test_utils::python_scalar_udfs, test_utils::ColumnarValueExt,
10+
};
811
use arrow::{
912
array::{Array, ArrayRef, Int64Array},
1013
datatypes::{DataType, Field},
1114
};
1215
use datafusion_expr::{ScalarFunctionArgs, ScalarUDFImpl};
1316

14-
use crate::integration_tests::{
15-
python::test_utils::python_scalar_udfs, test_utils::ColumnarValueExt,
16-
};
17-
1817
const CODE: &str = "
1918
# Use system module to store our state.
2019
#

host/tests/integration_tests/python/test_utils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ use datafusion_common::DataFusionError;
22
use datafusion_udf_wasm_host::{WasmComponentPrecompiled, WasmScalarUdf};
33
use tokio::sync::OnceCell;
44

5+
/// Static precompiled Python WASM component for tests
56
static COMPONENT: OnceCell<WasmComponentPrecompiled> = OnceCell::const_new();
67

8+
/// Returns a static reference to the precompiled Python WASM component.
79
pub(crate) async fn python_component() -> &'static WasmComponentPrecompiled {
810
COMPONENT
911
.get_or_init(async || {
@@ -14,12 +16,14 @@ pub(crate) async fn python_component() -> &'static WasmComponentPrecompiled {
1416
.await
1517
}
1618

19+
/// Compiles the provided Python UDF code into a list of WasmScalarUdf instances.
1720
pub(crate) async fn python_scalar_udfs(code: &str) -> Result<Vec<WasmScalarUdf>, DataFusionError> {
1821
let component = python_component().await;
1922

2023
WasmScalarUdf::new(component, &Default::default(), code.to_owned()).await
2124
}
2225

26+
/// Compiles the provided Python UDF code into a single WasmScalarUdf instance.
2327
pub(crate) async fn python_scalar_udf(code: &str) -> Result<WasmScalarUdf, DataFusionError> {
2428
let udfs = python_scalar_udfs(code).await?;
2529
assert_eq!(udfs.len(), 1);

0 commit comments

Comments
 (0)