This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-23756-ba8796e460bd60b8239c5f2f51f83d464efc177b in repository https://gitbox.apache.org/repos/asf/datafusion.git
commit a4f11089e7c59be35e5cb1c38f1793592e6cfc09 Author: Yongting You <[email protected]> AuthorDate: Thu Jul 23 14:07:52 2026 +0800 test: improve `digest` function SQL test coverage (#23756) ## 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. --> --- datafusion/sqllogictest/test_files/expr.slt | 63 +++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/datafusion/sqllogictest/test_files/expr.slt b/datafusion/sqllogictest/test_files/expr.slt index e14004a5f9..228cce4cfa 100644 --- a/datafusion/sqllogictest/test_files/expr.slt +++ b/datafusion/sqllogictest/test_files/expr.slt @@ -1748,6 +1748,69 @@ SELECT digest('','blake3'); ---- af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262 +# digest every supported algorithm over an array +query BBBBBBBB +SELECT + digest(column1, 'md5') = digest('tom', 'md5'), + digest(column1, 'sha224') = digest('tom', 'sha224'), + digest(column1, 'sha256') = digest('tom', 'sha256'), + digest(column1, 'sha384') = digest('tom', 'sha384'), + digest(column1, 'sha512') = digest('tom', 'sha512'), + digest(column1, 'blake2s') = digest('tom', 'blake2s'), + digest(column1, 'blake2b') = digest('tom', 'blake2b'), + digest(column1, 'blake3') = digest('tom', 'blake3') +FROM (VALUES ('tom'), (NULL), ('mot')) AS t(column1); +---- +true true true true true true true true +NULL NULL NULL NULL NULL NULL NULL NULL +false false false false false false false false + +# binary-view, large-utf8, and utf8-view array inputs +query BBBBBBBB +SELECT + digest(arrow_cast(column1, 'BinaryView'), 'md5') = digest('tom', 'md5'), + digest(arrow_cast(column1, 'BinaryView'), 'sha224') = digest('tom', 'sha224'), + digest(arrow_cast(column1, 'BinaryView'), 'sha256') = digest('tom', 'sha256'), + digest(arrow_cast(column1, 'BinaryView'), 'sha384') = digest('tom', 'sha384'), + digest(arrow_cast(column1, 'BinaryView'), 'sha512') = digest('tom', 'sha512'), + digest(arrow_cast(column1, 'BinaryView'), 'blake2s') = digest('tom', 'blake2s'), + digest(arrow_cast(column1, 'BinaryView'), 'blake2b') = digest('tom', 'blake2b'), + digest(arrow_cast(column1, 'BinaryView'), 'blake3') = digest('tom', 'blake3') +FROM (VALUES ('tom'), (NULL), ('mot')) AS t(column1); +---- +true true true true true true true true +NULL NULL NULL NULL NULL NULL NULL NULL +false false false false false false false false + +query BB +SELECT + digest(arrow_cast(column1, 'LargeUtf8'), 'md5') = digest('tom', 'md5'), + digest(arrow_cast(column1, 'Utf8View'), 'md5') = digest('tom', 'md5') +FROM (VALUES ('tom'), (NULL), ('mot')) AS t(column1); +---- +true true +NULL NULL +false false + +# invalid algorithm, dynamic algorithm, argument count, and argument type +query error There is no built-in digest algorithm named 'unknown' +SELECT digest('tom', 'unknown'); + +query error Digest using dynamically decided method is not yet supported +SELECT digest(column1, column2) FROM (VALUES ('tom', 'md5')) AS t(column1, column2); + +query error DataFusion error: +SELECT digest(); + +query error DataFusion error: +SELECT digest('tom'); + +query error DataFusion error: +SELECT digest('tom', 'md5', 'extra'); + +query error DataFusion error: +SELECT digest(1, 'md5'); + # vverify utf8view query ? SELECT sha224(arrow_cast('tom', 'Utf8View')); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
