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

add mysql compatible function bit_length #24531

Merged
merged 1 commit into from
Feb 15, 2025

Conversation

shenh062326
Copy link
Contributor

@shenh062326 shenh062326 commented Feb 11, 2025

Description

Add a mysql compatible function bit_length, it returns the count of bits for the given string.

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Add a MySQL-compatible function ``bit_length`` that returns the count of bits for the given string.


@shenh062326 shenh062326 requested a review from a team as a code owner February 11, 2025 10:52
Copy link

linux-foundation-easycla bot commented Feb 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: shenh062326 / name: HongShen (4de2500)

@steveburnett
Copy link
Contributor

Thanks for the release note! A few minor changes suggested to follow the Release Notes Guidelines.

== RELEASE NOTES ==

General Changes
* Add a MySQL-compatible function ``bit_length`` that returns the count of bits for the given string.

@jaystarshot
Copy link
Member

Can you please add some documentation? (preferrably in https://prestodb.io/docs/current/functions/string.html)

@shenh062326
Copy link
Contributor Author

Can you please add some documentation? (preferrably in https://prestodb.io/docs/current/functions/string.html)

Done.

@shenh062326
Copy link
Contributor Author

Thanks for the release note! A few minor changes suggested to follow the Release Notes Guidelines.

== RELEASE NOTES ==

General Changes
* Add a MySQL-compatible function ``bit_length`` that returns the count of bits for the given string.

Done.

Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, new local doc build, looks good. Thanks!

@@ -104,6 +104,15 @@ public static long charLength(@LiteralParameter("x") long x, @SqlType("char(x)")
return x;
}

@Description("count of bits for the given string")
@ScalarFunction("bit_length")
@LiteralParameters("x")
Copy link
Member

Choose a reason for hiding this comment

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

This literal parameter is not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I refer to the implementation of the length function in StringFunctions.java.

@jaystarshot
Copy link
Member

I think you can squash both commits into the first one

@shenh062326
Copy link
Contributor Author

I think you can squash both commits into the first one

Done.

@jaystarshot jaystarshot merged commit 652026b into prestodb:master Feb 15, 2025
55 checks passed
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

Successfully merging this pull request may close these issues.

3 participants