Skip to content

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jan 30, 2025

Which issue does this PR close?

Rationale for this change

This allows Stringview to be compared to numeric values, consistently with normal stirngs

What changes are included in this PR?

  1. add tests for coercion (both numeric as well as date/time coercion)

Are these changes tested?

Yes unit tests are

Are there any user-facing changes?

Yes, queries that work with Utf8 will now also work with Utf8View

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Jan 30, 2025
@alamb alamb changed the title Alamb/string view coercion Support Utf8View to numeric coercsion Jan 30, 2025
@alamb alamb changed the title Support Utf8View to numeric coercsion Support Utf8View to numeric coercion Jan 30, 2025
match (lhs_type, rhs_type) {
(Utf8, _) if rhs_type.is_numeric() => Some(Utf8),
(LargeUtf8, _) if rhs_type.is_numeric() => Some(LargeUtf8),
(Utf8View, _) if rhs_type.is_numeric() => Some(Utf8View),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only code change

@Omega359
Copy link
Contributor

Looking good, thx for putting this together

@alamb alamb mentioned this pull request Feb 1, 2025
32 tasks
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @alamb

@alamb
Copy link
Contributor Author

alamb commented Feb 3, 2025

Thank you @comphead and @Omega359 for the review 🙏

@alamb alamb merged commit 86df9b9 into apache:main Feb 3, 2025
29 checks passed
@alamb alamb deleted the alamb/string_view_coercion branch February 3, 2025 17:15
alamb added a commit to alamb/datafusion that referenced this pull request Feb 3, 2025
* Test for string / numeric coercion

* fix tests

* Update tests

* Add tests to stringview

* add numeric coercion
alamb added a commit that referenced this pull request Feb 3, 2025
* Test for string / numeric coercion

* fix tests

* Update tests

* Add tests to stringview

* add numeric coercion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants