You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "samuelcolvin (via GitHub)" <gi...@apache.org> on 2024/09/13 19:23:50 UTC
[PR] fix length error with `array_has` [datafusion]
samuelcolvin opened a new pull request, #12459:
URL: https://github.com/apache/datafusion/pull/12459
## Rationale for this change
Fixes an error we've been experiencing in prod where some queries that use `array_has` (including via `ANY()`) result int:
```
DataFusion CLI v41.0.0
Error: Internal error: UDF returned a different number of rows than expected. Expected: 8192, Got: 1.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
```
## What changes are included in this PR?
Fix a bug in `array_has` where it returned 1 row, instead of the size of the group.
## Are these changes tested?
Yes.
## Are there any user-facing changes?
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#issuecomment-2350934051
slt test updated and dedicated test removed.
It would be great to get this merged. We'll run datafusion main until there's a another release since this is is affecting a lot of users as we migrate querying from timescale to datafusion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #12459:
URL: https://github.com/apache/datafusion/pull/12459
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759710653
##########
datafusion/sqllogictest/test_files/array.slt:
##########
@@ -7086,6 +7086,16 @@ select [1,2,3]::int[], [['1']]::int[][], arrow_typeof([]::text[]);
----
[1, 2, 3] [[1]] List(Field { name: "item", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })
+# test empty arrays return length
+# issue: https://github.com/apache/datafusion/pull/12459
+statement ok
+create table values_all_empty (a int[]) as values ([]), ([]);
Review Comment:
beautiful 🎉
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#issuecomment-2350944018
Thanks @alamb for merging so quickly. 🙏
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759573631
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
+ let ctx = SessionContext::new();
Review Comment:
I too tried to come up with a pure SQL test, but couldn't.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759532353
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
Review Comment:
Since this test isn't a user defined function per se, can we move this test to https://github.com/apache/datafusion/tree/main/datafusion/core/tests/sql instead ?
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
+ let ctx = SessionContext::new();
Review Comment:
FWIW I tried to come up with a pure sql reproducer for this and could not:
```sql
> create or replace table t as values (make_array([]), (make_array([])), (make_array([])));
0 row(s) fetched.
Elapsed 0.002 seconds.
```
I could't make the query work:
```sql
> select 1 from t where array_has(column1, 1);
type_coercion
caused by
Error during planning: Error during planning: Coercion from [List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), Int64] to the signature ArraySignature(ArrayAndElement) failed. No function matches the given name and argument types 'array_has(List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), Int64)'. You might need to add explicit type casts.
Candidate functions:
array_has(array, element)
> select 1 from t where array_has(column1, arrow_cast(1, 'UInt64'));
type_coercion
caused by
Error during planning: Error during planning: Coercion from [List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), UInt64] to the signature ArraySignature(ArrayAndElement) failed. No function matches the given name and argument types 'array_has(List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), UInt64)'. You might need to add explicit type casts.
Candidate functions:
array_has(array, element)
```
Any thoughts @jayzhan211 or @Weijun-H ? I think you may be more familiar with this code than am I
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759577649
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
+ let ctx = SessionContext::new();
Review Comment:
ignore that, I got the pure SQL reproduction to work. Feel free to remove the test file, personally I'd rather keep it as it's explicit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#issuecomment-2351552082
> Thanks @alamb for merging so quickly. 🙏
I try hard to prioritize bug fixes. Thank you for fixing the bug!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759437767
##########
datafusion/functions-nested/src/array_has.rs:
##########
@@ -200,7 +201,10 @@ fn array_has_dispatch_for_scalar<O: OffsetSizeTrait>(
// If first argument is empty list (second argument is non-null), return false
// i.e. array_has([], non-null element) -> false
if values.len() == 0 {
- return Ok(Arc::new(BooleanArray::from(vec![Some(false)])));
+ return Ok(Arc::new(BooleanArray::new(
+ BooleanBuffer::new_unset(haystack.len()),
Review Comment:
the point is that in this case the array returned should be the same length as the haystack, not 1.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759609816
##########
datafusion/core/tests/sql/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
Review Comment:
I think we don't need this but test it in slt
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759608744
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
+ let ctx = SessionContext::new();
Review Comment:
Could try this
```
statement ok
create table t (a int[]) as values ([]), ([]);
query B
select array_has(a, 1) from t;
----
false
false
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759573497
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
Review Comment:
test moved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759609816
##########
datafusion/core/tests/sql/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
Review Comment:
I think we don't need this if we could come out slt test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] fix length error with `array_has` [datafusion]
Posted by "samuelcolvin (via GitHub)" <gi...@apache.org>.
samuelcolvin commented on code in PR #12459:
URL: https://github.com/apache/datafusion/pull/12459#discussion_r1759707583
##########
datafusion/core/tests/sql/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
Review Comment:
done.
##########
datafusion/core/tests/user_defined/array_has.rs:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow::datatypes::UInt32Type;
+use arrow::datatypes::{DataType, Field, Schema};
+use arrow::record_batch::RecordBatch;
+use arrow_array::ListArray;
+use datafusion::logical_expr::ScalarUDF;
+use datafusion::prelude::*;
+use datafusion_functions_nested::array_has::ArrayHas;
+use std::sync::Arc;
+
+/// can't go next to the `ArrayHas` struct due to circular dependencies, hence this standalone test
+#[tokio::test]
+async fn array_has_empty_haystack() {
+ let ctx = SessionContext::new();
Review Comment:
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org