Skip to content

Commit

Permalink
fix some deprecation / unused import warnings (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt authored Nov 25, 2024
1 parent 99b007d commit 6fae049
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
8 changes: 4 additions & 4 deletions benches/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use codspeed_criterion_compat::{criterion_group, criterion_main, Bencher, Criterion};

use datafusion_common::ScalarValue;
use datafusion_expr::ColumnarValue;
use datafusion::common::ScalarValue;
use datafusion::logical_expr::ColumnarValue;
use datafusion_functions_json::udfs::{json_contains_udf, json_get_str_udf};

fn bench_json_contains(b: &mut Bencher) {
Expand All @@ -14,7 +14,7 @@ fn bench_json_contains(b: &mut Bencher) {
ColumnarValue::Scalar(ScalarValue::Utf8(Some("aa".to_string()))),
];

b.iter(|| json_contains.invoke(args).unwrap());
b.iter(|| json_contains.invoke_batch(args, 1).unwrap());
}

fn bench_json_get_str(b: &mut Bencher) {
Expand All @@ -27,7 +27,7 @@ fn bench_json_get_str(b: &mut Bencher) {
ColumnarValue::Scalar(ScalarValue::Utf8(Some("aa".to_string()))),
];

b.iter(|| json_get_str.invoke(args).unwrap());
b.iter(|| json_get_str.invoke_batch(args, 1).unwrap());
}

fn criterion_benchmark(c: &mut Criterion) {
Expand Down
6 changes: 0 additions & 6 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ fn zip_apply<'a, P: Iterator<Item = Option<JsonPath<'a>>>, C: FromIterator<Optio
object_lookup: bool,
return_dict: bool,
) -> DataFusionResult<ArrayRef> {
// arrow_schema "use" is workaround for https://github.com/apache/arrow-rs/issues/6400#issue-2528388332
use datafusion::arrow::datatypes as arrow_schema;

let c = downcast_dictionary_array!(
json_array => {
let values = zip_apply(json_array.values(), path_array, to_array, jiter_find, object_lookup, false)?;
Expand Down Expand Up @@ -245,9 +242,6 @@ fn scalar_apply<C: FromIterator<Option<I>>, I>(
jiter_find: impl Fn(Option<&str>, &[JsonPath]) -> Result<I, GetError>,
return_dict: bool,
) -> DataFusionResult<ArrayRef> {
// arrow_schema "use" is workaround for https://github.com/apache/arrow-rs/issues/6400#issue-2528388332
use datafusion::arrow::datatypes as arrow_schema;

let c = downcast_dictionary_array!(
json_array => {
let values = scalar_apply(json_array.values(), path, to_array, jiter_find, false)?;
Expand Down
4 changes: 2 additions & 2 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ fn test_json_get_utf8() {
ColumnarValue::Scalar(ScalarValue::Utf8(Some("aa".to_string()))),
];

let ColumnarValue::Scalar(sv) = json_get_str.invoke(args).unwrap() else {
let ColumnarValue::Scalar(sv) = json_get_str.invoke_batch(args, 1).unwrap() else {
panic!("expected scalar")
};

Expand All @@ -518,7 +518,7 @@ fn test_json_get_large_utf8() {
ColumnarValue::Scalar(ScalarValue::LargeUtf8(Some("aa".to_string()))),
];

let ColumnarValue::Scalar(sv) = json_get_str.invoke(args).unwrap() else {
let ColumnarValue::Scalar(sv) = json_get_str.invoke_batch(args, 1).unwrap() else {
panic!("expected scalar")
};

Expand Down

0 comments on commit 6fae049

Please sign in to comment.