Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[package]
name = "datafusion-functions-json"
version = "0.49.1"
version = "0.50.0"
edition = "2021"
description = "JSON functions for DataFusion"
readme = "README.md"
license = "Apache-2.0"
keywords = ["datafusion", "JSON", "SQL"]
categories = ["database-implementations", "parsing"]
repository = "https://github.com/datafusion-contrib/datafusion-functions-json/"
rust-version = "1.85.1"
rust-version = "1.86.0"

[dependencies]
datafusion = { version = "49", default-features = false }
datafusion = { version = "50", default-features = false }
jiter = "0.10"
log = "0.4"
paste = "1"

[dev-dependencies]
codspeed-criterion-compat = "2.6"
datafusion = { version = "49", default-features = false, features = [
datafusion = { version = "50", default-features = false, features = [
"nested_expressions",
] }
tokio = { version = "1.43", features = ["full"] }
Expand Down
4 changes: 4 additions & 0 deletions benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fn bench_json_contains(b: &mut Bencher) {
number_rows: 1,
arg_fields: arg_fields.clone(),
return_field: return_field.clone(),
config_options: Arc::new(datafusion::config::ConfigOptions::default()),
})
.unwrap()
});
Expand Down Expand Up @@ -63,6 +64,7 @@ fn bench_json_get_str_scalar(b: &mut Bencher) {
arg_fields: arg_fields.clone(),
number_rows: 1,
return_field: return_field.clone(),
config_options: Arc::new(datafusion::config::ConfigOptions::default()),
})
.unwrap();
});
Expand Down Expand Up @@ -94,6 +96,7 @@ fn bench_json_get_str_array(b: &mut Bencher) {
arg_fields: arg_fields.clone(),
number_rows: 1,
return_field: return_field.clone(),
config_options: Arc::new(datafusion::config::ConfigOptions::default()),
})
.unwrap();
});
Expand Down Expand Up @@ -125,6 +128,7 @@ fn bench_json_get_str_view_array(b: &mut Bencher) {
arg_fields: arg_fields.clone(),
number_rows: 1,
return_field: return_field.clone(),
config_options: Arc::new(datafusion::config::ConfigOptions::default()),
})
.unwrap();
});
Expand Down
2 changes: 1 addition & 1 deletion src/common_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ macro_rules! make_udf_function {
static [< STATIC_ $expr_fn_name:upper >]: std::sync::OnceLock<std::sync::Arc<datafusion::logical_expr::ScalarUDF>> =
std::sync::OnceLock::new();

/// ScalarFunction that returns a [`ScalarUDF`] for [`$udf_impl`]
/// `ScalarFunction` that returns a [`ScalarUDF`] for [`$udf_impl`]
///
/// [`ScalarUDF`]: datafusion::logical_expr::ScalarUDF
pub fn [< $expr_fn_name _udf >]() -> std::sync::Arc<datafusion::logical_expr::ScalarUDF> {
Expand Down
2 changes: 1 addition & 1 deletion src/common_union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl JsonUnionEncoder {
///
/// Panics if the idx is outside the union values or an invalid type id exists in the union.
#[must_use]
pub fn get_value(&self, idx: usize) -> JsonUnionValue {
pub fn get_value(&self, idx: usize) -> JsonUnionValue<'_> {
let type_id = self.type_ids[idx];
match type_id {
TYPE_ID_NULL => JsonUnionValue::JsonNull,
Expand Down
2 changes: 1 addition & 1 deletion src/json_as_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r#"Get any value from a JSON string by its "path", represented as a string"#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonAsText {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_contains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r#"Does the key/index exist within the JSON value as the specified "path"?"#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonContains {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ make_udf_function!(

// build_typed_get!(JsonGet, "json_get", Union, Float64Array, jiter_json_get_float);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGet {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r#"Get an arrow array from a JSON string by its "path""#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGetArray {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get_bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ make_udf_function!(
r#"Get an boolean value from a JSON string by its "path""#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGetBool {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r#"Get a float value from a JSON string by its "path""#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGetFloat {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get_int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r#"Get an integer value from a JSON string by its "path""#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGetInt {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ make_udf_function!(
r#"Get a nested raw JSON string from a JSON string by its "path""#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGetJson {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_get_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ make_udf_function!(
r#"Get a string value from a JSON string by its "path""#
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonGetStr {
signature: Signature,
aliases: [String; 1],
Expand Down
2 changes: 1 addition & 1 deletion src/json_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r"Get the length of the array or object at the given path."
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonLength {
signature: Signature,
aliases: [String; 2],
Expand Down
2 changes: 1 addition & 1 deletion src/json_object_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ make_udf_function!(
r"Get the keys of a JSON object as an array."
);

#[derive(Debug)]
#[derive(Debug, PartialEq, Eq, Hash)]
pub(super) struct JsonObjectKeys {
signature: Signature,
aliases: [String; 2],
Expand Down
4 changes: 4 additions & 0 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use datafusion::arrow::datatypes::{Field, Int64Type, Int8Type, Schema};
use datafusion::arrow::{array::StringDictionaryBuilder, datatypes::DataType};
use datafusion::assert_batches_eq;
use datafusion::common::ScalarValue;
use datafusion::config::ConfigOptions;
use datafusion::logical_expr::{ColumnarValue, ScalarFunctionArgs};
use datafusion::prelude::SessionContext;
use datafusion_functions_json::udfs::json_get_str_udf;
Expand Down Expand Up @@ -600,6 +601,7 @@ fn test_json_get_utf8() {
Field::new("ret_field", DataType::Utf8, false)
.with_metadata(HashMap::from_iter(vec![("is_json".to_string(), "true".to_string())])),
),
config_options: Arc::new(ConfigOptions::default()),
})
.unwrap()
else {
Expand Down Expand Up @@ -633,6 +635,7 @@ fn test_json_get_large_utf8() {
Field::new("ret_field", DataType::Utf8, false)
.with_metadata(HashMap::from_iter(vec![("is_json".to_string(), "true".to_string())])),
),
config_options: Arc::new(ConfigOptions::default()),
})
.unwrap()
else {
Expand Down Expand Up @@ -1573,6 +1576,7 @@ fn check_for_null_dictionary_values(array: &dyn Array) {
}

/// Test that we don't output nulls in dictionary values.
#[allow(clippy::doc_markdown)]
/// This can cause issues with arrow-rs and DataFusion; they expect nulls to be in keys.
#[tokio::test]
async fn test_dict_get_no_null_values() {
Expand Down
Loading