Skip to content

Commit c118002

Browse files
authored
test: improve md5 function SQL test coverage (apache#23757)
## 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 apache#123` indicates that this PR will close issue apache#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. -->
1 parent 96e8fdf commit c118002

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

  • datafusion/sqllogictest/test_files

datafusion/sqllogictest/test_files/expr.slt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,30 @@ SELECT md5(NULL);
15591559
----
15601560
NULL
15611561

1562+
# md5 string and binary array inputs
1563+
query BBBBBB
1564+
SELECT
1565+
md5(column1) = md5('tom'),
1566+
md5(arrow_cast(column1, 'LargeUtf8')) = md5('tom'),
1567+
md5(arrow_cast(column1, 'Utf8View')) = md5('tom'),
1568+
md5(arrow_cast(column1, 'Binary')) = md5('tom'),
1569+
md5(arrow_cast(column1, 'LargeBinary')) = md5('tom'),
1570+
md5(arrow_cast(column1, 'BinaryView')) = md5('tom')
1571+
FROM (VALUES ('tom'), (NULL)) AS t(column1);
1572+
----
1573+
true true true true true true
1574+
NULL NULL NULL NULL NULL NULL
1575+
1576+
# invalid argument count and type
1577+
query error DataFusion error:
1578+
SELECT md5();
1579+
1580+
query error DataFusion error:
1581+
SELECT md5('tom', 'extra');
1582+
1583+
query error DataFusion error:
1584+
SELECT md5(1);
1585+
15621586
query ?
15631587
SELECT digest('','md5');
15641588
----

0 commit comments

Comments
 (0)