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

FIRST/LAST_VALUE behavior changes #10732

Closed
waynexia opened this issue May 31, 2024 · 3 comments
Closed

FIRST/LAST_VALUE behavior changes #10732

waynexia opened this issue May 31, 2024 · 3 comments

Comments

@waynexia
Copy link
Member

Describe the bug

In #9960, FIRST_VALUE and LAST_VALUE are moved into another place, but that patch also changes the function signatures. They only accept NUMERICS after the PR.

To Reproduce

Try the following query in CLI:

d201ec7

SELECT arrow_typeof(FIRST_VALUE('0.1'::DECIMAL(4,1)));

Result at d201ec7 (before #9960) is

+----------------------------------------+
| arrow_typeof(FIRST_VALUE(Utf8("0.1"))) |
+----------------------------------------+
| Decimal128(4, 1)                       |
+----------------------------------------+

And after is

+----------------------------------------+
| arrow_typeof(first_value(Utf8("0.1"))) |
+----------------------------------------+
| Float64                                |
+----------------------------------------+

Expected behavior

The output type changes because decimal is not one of NUMERICS. I can think of two points:

  • Should decimal be one of NUMERICS?
  • Should first/last value work like before?

My perspective is "yes" for both.

Additional context

By the way, the function name also changes. From big letters to small letters.

@waynexia
Copy link
Member Author

cc @jayzhan211. I'd like to make the corresponding change if the "expected behavior" looks reasonable.

@jayzhan211
Copy link
Contributor

jayzhan211 commented May 31, 2024

I had checked that this issue is solved in #10651, which I had added the UTF8 to the signature.

I used is_numeric to check the types, decimal is considered as numeric.

@jayzhan211
Copy link
Contributor

jayzhan211 commented Jun 5, 2024

Since #10651 and #10781 is merged, I close the issue. if there is still any issue, we can reopen it. @waynexia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants