Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support Utf8View in numeric_string_coercion #13366

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonathanc-n
Copy link
Contributor

Which issue does this PR close?

Closes #13359 .

Rationale for this change

What changes are included in this PR?

Added utf8view to string_numeric_coercion

Are these changes tested?

Added tests for most numeric possibilities

Are there any user-facing changes?

@jonathanc-n jonathanc-n changed the title minor(fix): Support Utf8View in string_numeric_coercion fix: Support Utf8View in string_numeric_coercion Nov 11, 2024
@jonathanc-n jonathanc-n reopened this Nov 11, 2024
@@ -1490,6 +1491,92 @@ mod tests {
);
}

#[test]
fn test_numeric_string_coercion_with_utf8view() {
assert_eq!(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you find a test case that fail if the change is reverted instead of the rust test here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are no test cases that will fail if changes are reverted other than this one.

Copy link
Contributor

@jayzhan211 jayzhan211 Nov 12, 2024

Choose a reason for hiding this comment

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

so it means the change is not solving the problem 🤔 maybe this function is not used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit confused, the function is used here. If reverted, the change will fail the current added test but no other tests. This means that the changes allow support for Utf8View in numeric_string_conversion

Copy link
Contributor

@jayzhan211 jayzhan211 Nov 12, 2024

Choose a reason for hiding this comment

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

If I understand correctly, your test is unit test, it failed if the change reverted but it doesn't mean the change effects the actual query (I guess after we change the signature for most of the function, numeric string coercion might not be used at all). I suggest we add end2end test (slt) instead of unit test

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally this query should pass after your change, but it didn't

SELECT make_array(arrow_cast('1.2', 'Utf8View'), 2.3);

@jonathanc-n jonathanc-n changed the title fix: Support Utf8View in string_numeric_coercion fix: Support Utf8View in numeric_string_coercion Nov 12, 2024
@jonathanc-n jonathanc-n reopened this Nov 15, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I think this PR needs some end to end tests -- namely something like

> drop table foo;
0 row(s) fetched.
Elapsed 0.001 seconds.

> create table foo as values (arrow_cast('1', 'Utf8View')), (arrow_cast('2', 'Utf8View'));
0 row(s) fetched.
Elapsed 0.004 seconds.

> select column1 = 1 from foo;
Error during planning: Cannot infer common argument type for comparison operation Utf8View = Int64

@alamb
Copy link
Contributor

alamb commented Nov 25, 2024

@jonathanc-n do you have some time to add some SLT tests to this PR as suggested above?

@jonathanc-n
Copy link
Contributor Author

@alamb I believe this is waiting on the numeric to utf8view pr for arrow-rs.

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Nov 25, 2024
@alamb
Copy link
Contributor

alamb commented Nov 27, 2024

@alamb I believe this is waiting on the numeric to utf8view pr for arrow-rs.

I think that means

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.

string_numeric_coercion in binary.rs does not support Utf8View
4 participants