You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/08/03 02:30:54 UTC
(datafusion) branch main updated: test: improve `find_in_set` sqllogictest coverage (#23970)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 21ad189782 test: improve `find_in_set` sqllogictest coverage (#23970)
21ad189782 is described below
commit 21ad1897826a2dd00f31dd8bb574735ca70143d9
Author: Yongting You <20...@gmail.com>
AuthorDate: Mon Aug 3 10:18:27 2026 +0800
test: improve `find_in_set` sqllogictest coverage (#23970)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes #.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
Codecov reports low test coverage for this function, so this PR adds
more SLT tests for it.
The tests were AI-generated, and I manually verified that the results
are correct.
See `Codecov` bot comment -> `☔ View full report in Codecov by Harness`
-> `Indirect Changes` for the updated test coverage.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
---
.../test_files/string/string_literal.slt | 10 +++
.../test_files/string/string_query.slt.part | 76 ++++++++++++++++++++++
2 files changed, 86 insertions(+)
diff --git a/datafusion/sqllogictest/test_files/string/string_literal.slt b/datafusion/sqllogictest/test_files/string/string_literal.slt
index 06d8bf2a4c..d5c4004c95 100644
--- a/datafusion/sqllogictest/test_files/string/string_literal.slt
+++ b/datafusion/sqllogictest/test_files/string/string_literal.slt
@@ -1049,6 +1049,16 @@ SELECT find_in_set(arrow_cast('', 'Utf8View'), arrow_cast('a,b,c,d,a', 'Utf8View
----
0
+# invalid scalar argument count and type
+query error 'find_in_set' does not support zero arguments
+SELECT find_in_set();
+
+query error Failed to coerce arguments to satisfy a call to 'find_in_set' function
+SELECT find_in_set('a');
+
+query error Failed to coerce arguments to satisfy a call to 'find_in_set' function
+SELECT find_in_set('a', 'a,b', 'extra');
+
query T
SELECT split_part('foo_bar', '_', 2)
diff --git a/datafusion/sqllogictest/test_files/string/string_query.slt.part b/datafusion/sqllogictest/test_files/string/string_query.slt.part
index 9231ec7b9c..096045b4f5 100644
--- a/datafusion/sqllogictest/test_files/string/string_query.slt.part
+++ b/datafusion/sqllogictest/test_files/string/string_query.slt.part
@@ -972,6 +972,82 @@ NULL NULL NULL NULL
# Test FIND_IN_SET
# --------------------------------------
+# array on the left and a literal on the right
+query I
+SELECT find_in_set(ascii_1, 'Andrew,Xiangpeng') FROM test_basic_operator
+----
+1
+2
+0
+0
+0
+0
+0
+0
+0
+NULL
+NULL
+
+# literal on the left and an array on the right
+query I
+SELECT find_in_set('🔥', unicode_2) FROM test_basic_operator
+----
+1
+0
+0
+0
+0
+0
+0
+0
+0
+NULL
+1
+
+# arrays on both sides
+query I
+SELECT find_in_set(unicode_2, unicode_1) FROM test_basic_operator
+----
+0
+1
+0
+0
+0
+1
+1
+1
+1
+NULL
+NULL
+
+# Explicit casts are needed to exercise the LargeUtf8 scalar/array paths;
+# otherwise string coercion chooses a different common physical type.
+query II
+SELECT
+ find_in_set(arrow_cast(ascii_1, 'LargeUtf8'), arrow_cast('Andrew,Xiangpeng', 'LargeUtf8')),
+ find_in_set(arrow_cast('🔥', 'LargeUtf8'), arrow_cast(unicode_2, 'LargeUtf8'))
+FROM test_basic_operator
+----
+1 1
+2 0
+0 0
+0 0
+0 0
+0 0
+0 0
+0 0
+0 0
+NULL NULL
+NULL 1
+
+# null literals paired with arrays
+query II
+SELECT find_in_set(ascii_1, NULL), find_in_set(NULL, ascii_2)
+FROM test_basic_operator
+LIMIT 1
+----
+NULL NULL
+
query IIIIII
SELECT
FIND_IN_SET(ascii_1, 'a,b,c,d'),
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org