Skip to content

Add cast functions for char datatype to numeric types#23792

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
elbinpallimalilibm:cast-char-to-numeric-types
Oct 10, 2024
Merged

Add cast functions for char datatype to numeric types#23792
tdcmeehan merged 1 commit intoprestodb:masterfrom
elbinpallimalilibm:cast-char-to-numeric-types

Conversation

@elbinpallimalilibm
Copy link
Contributor

@elbinpallimalilibm elbinpallimalilibm commented Oct 9, 2024

Description

Add CAST functions for CHAR datatype to different numeric datatypes.

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • 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
* Added support for casting char datatype to various numeric datatypes.     :pr:`23792`

@elbinpallimalilibm elbinpallimalilibm requested a review from a team as a code owner October 9, 2024 15:06
@tdcmeehan tdcmeehan self-assigned this Oct 9, 2024
}

@Test
public void testCharCast()
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 add some test cases for the following:

  1. some numbers without whitespace
  2. What happens when the number is outside of the range of values for integer/float
  3. Any support for nan or infinity
  4. any support for hexidecimal numbers
  5. Any support for hexidecimal floating point numbers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some more tests. There is no support for hexa decimal numbers now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could probably add support for hexadecimals by considering any char(x) type prefixed with 0x as a hexadecimal, but I'm not sure if that will be an unintended output for those who use the cast function

@steveburnett
Copy link
Contributor

Nit to include the PR number in the release note entry, following the Release Notes Guidelines.

== RELEASE NOTES ==

General Changes
* Add support for casting char datatype to various numeric datatypes.  :pr:`23792`

@elbinpallimalilibm elbinpallimalilibm force-pushed the cast-char-to-numeric-types branch from 5d20de0 to 008cc08 Compare October 9, 2024 17:31
@elbinpallimalilibm elbinpallimalilibm force-pushed the cast-char-to-numeric-types branch from 008cc08 to 8d8464a Compare October 9, 2024 18:12
@tdcmeehan tdcmeehan merged commit 9fa4aee into prestodb:master Oct 10, 2024
@elbinpallimalilibm elbinpallimalilibm deleted the cast-char-to-numeric-types branch October 10, 2024 14:21
@jaystarshot jaystarshot mentioned this pull request Nov 1, 2024
25 tasks
@tdcmeehan tdcmeehan added the from:IBM PR from IBM label Dec 13, 2024
@prestodb-ci prestodb-ci requested review from a team, Dilli-Babu-Godari and namya28 and removed request for a team December 13, 2024 15:29
@prestodb-ci
Copy link
Contributor

Saved that user @elbinpallimalilibm is from IBM

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

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments