feat: add toLower/toUpper support, fix type coercion error#82
Merged
ChunxuTang merged 4 commits intoJan 13, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
ChunxuTang
reviewed
Jan 10, 2026
ChunxuTang
left a comment
Collaborator
There was a problem hiding this comment.
@youssef-tharwat Thanks so much for the fix!
I just left very minor comments for the tests. The fix generally looks good to me.
Meanwhile, could you fix the style check error of your PR? Feel free to tag me when you want me to review again.
Contributor
Author
|
@ChunxuTang all done :) |
ChunxuTang
approved these changes
Jan 13, 2026
ChunxuTang
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Thanks for the contribution.
Collaborator
|
@youssef-tharwat One minor thing: there's a style check error reported by the GitHub workflows. Could you run |
- Add support for toLower/toUpper (Cypher) and lower/upper (SQL) string functions - Change fallback for unsupported functions from lit(0) to ScalarValue::Null to prevent type coercion errors in any context (string or numeric) - Add unit tests for new string functions - Add integration tests including exact bug reproduction Fixes type coercion error when using toLower(s.name) CONTAINS 'x' with integer columns in RETURN clause.
Co-Authored-By: Claude <noreply@anthropic.com>
6984153 to
2ff66f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toLower/toUpper(Cypher) andlower/upper(SQL) string functionslit(0)toScalarValue::Nullto prevent type coercion errorsProblem
When using
toLower(s.name) CONTAINS 'x'with integer columns in the RETURN clause, a type coercion error occurred:This happened because
toLowerwas not implemented and fell through to the default case which returnedlit(0)(Int32). When combined withCONTAINS(translated to LIKE), DataFusion couldn't coerce Int32 to Utf8.Solution
toLower/toUpperusing DataFusion'slower()/upper()functionslit(0)toScalarValue::Null, which coerces to any type in SQL semanticsTest plan
toLower,toUpper,lower,upperfunctions