goldmedal opened a new pull request, #12525:
URL: https://github.com/apache/datafusion/pull/12525
## 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.
-->
Part of #12415
## Rationale for this change
I am implementing a testing framework for string types to ensure consistent
behavior across different string types. I have extracted test cases from
`datafusion/sqllogictest/test_files/string_view.slt`, which contains many good
tests for string types.
Currently, I haven’t moved all the tests from `string_view.slt` because I
don’t want to make this PR too large (I want to confirm if I’m on the right way
🤔). For now, I’ve only moved the following case:
- column comparison as filters
- column comparison
- column to StringView scalar comparison
- column to String scalar
- column to LargeString scalar
- substr function
- distinct aggregate
- STARTS_WITH function
- TRANSLATE function
- REGEXP_REPLACE function
- Initcap function
### Some TODO items should be finished in the follow-up PR
- The remaining tests in the `string_view.slt`
- [ ] `LIKE/ILIKE`
- [ ] `SUBSTR` planing
- [ ] ASCII
- [ ] BTRIM
- [ ] LTRIM
- [ ] RTRIM
- [ ] CHARACTER_LENGTH
- [ ] CONCAT
- [ ] CONTAINS
- [ ] ENDS_WITH
- [ ] LEVENSHTEIN
- [ ] LOWER
- [ ] UPPER
- [ ] LPAD
- [ ] OCTET_LENGTH
- [ ] OVERLAY
- [ ] REGEXP_LIKE
- [ ] REGEXP_MATCH
- [ ] REPEAT
- [ ] REPLACE
- [ ] REVERSE
- [ ] RIGHT
- [ ] LEFT
- [ ] RPAD
- [ ] SPLIT_PART
- [ ] STRPOS
- [ ] SUBSTRINDEX
- [ ] FIND_IN_SET
- [ ] `||` operator
- [ ] `~` operator (regex match)
- [ ] `~*` operator (regex match case-insensitive)
- [ ] `!~~` operator (not like match)
- [ ] `!~~*` operator (not like match case-insensitive)
- [ ] Move StringView specific tests to `string/string_view.slt`
- Move string literal tests from `function.slt` to
`string/string_literal.rs`
<!--
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.
-->
## What changes are included in this PR?
Refer to #12433, I made some changes. I regroup the test case by the data
type. The file structure is
```
string/
- init_data.slt.part // generate the testing data
- string_query.slt.part // the sharing tests for all string type
- string.slt // the entrypoint for string type
- large_string.slt // the entrypoint for large_string type
- string_view.slt // the entrypoint for string_view type and
the string_view specific tests
- string_literal.slt // the tests for string literal
```
Any entry point file should include `init_data.slt.part` and
`string_query.slt.part`.
For planning tests for `StringView` (e.g. `EXPLAIN ...`), I moved to the
`string/string_view.slt` because it's only used to assert the planning behavior
of `StringView`.
<!--
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?
Refactor and enhance the original tests.
<!--
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?
no
<!--
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.
-->
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]