Skip to content

Allow force casting of comma-separated numbers - #3059

Merged
Yicong-Huang merged 7 commits into
masterfrom
yicong-allow-force-casting-of-comma-seperated-numbers
Nov 15, 2024
Merged

Allow force casting of comma-separated numbers#3059
Yicong-Huang merged 7 commits into
masterfrom
yicong-allow-force-casting-of-comma-seperated-numbers

Conversation

@Yicong-Huang

@Yicong-Huang Yicong-Huang commented Nov 15, 2024

Copy link
Copy Markdown
Contributor

The typecasting operator does not work when casting number-strings with commas. This PR adds this functionality. By default, it will infer the comma-separated number-strings as String type to preserve the information. When the user explicitly requests casting such a comma-separated number-string into an Int type or a Long type, it will perform the casting.

For instance, now typecasting can cast 1,234 into 1234 as an integer.

Added testcases for other types as well.

@Yicong-Huang
Yicong-Huang requested a review from kunwp1 November 15, 2024 19:41
@Yicong-Huang Yicong-Huang self-assigned this Nov 15, 2024
@Yicong-Huang
Yicong-Huang requested review from aglinxinyuan and removed request for kunwp1 November 15, 2024 19:41
@Yicong-Huang Yicong-Huang changed the title Allow force casting of comma separated numbers Allow force casting of comma-separated numbers Nov 15, 2024

@kunwp1 kunwp1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Adding unit tests look good!

We had an internal discussion that for "1 2 3 4 5", we trim the string and just use the first number, so the output is 1 in the current implementation. I think it is okay for now.

@Yicong-Huang
Yicong-Huang merged commit 81821fa into master Nov 15, 2024
@Yicong-Huang
Yicong-Huang deleted the yicong-allow-force-casting-of-comma-seperated-numbers branch November 15, 2024 23:30
Yicong-Huang added a commit that referenced this pull request Dec 2, 2024
#3111 caused changes in #3059 being reverted. This PR applies the
changes again.
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
The typecasting operator does not work when casting number-strings with
commas. This PR adds this functionality. By default, it will infer the
comma-separated number-strings as String type to preserve the
information. When the user explicitly requests casting such a
comma-separated number-string into an Int type or a Long type, it will
perform the casting.

For instance, now typecasting can cast `1,234` into `1234` as an
integer.

Added testcases for other types as well.
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
#3111 caused changes in #3059 being reverted. This PR applies the
changes again.
SarahAsad23 pushed a commit to madisonmlin/texera that referenced this pull request May 20, 2026
The typecasting operator does not work when casting number-strings with
commas. This PR adds this functionality. By default, it will infer the
comma-separated number-strings as String type to preserve the
information. When the user explicitly requests casting such a
comma-separated number-string into an Int type or a Long type, it will
perform the casting.

For instance, now typecasting can cast `1,234` into `1234` as an
integer.

Added testcases for other types as well.
SarahAsad23 pushed a commit to madisonmlin/texera that referenced this pull request May 20, 2026
apache#3111 caused changes in apache#3059 being reverted. This PR applies the
changes again.
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
The typecasting operator does not work when casting number-strings with
commas. This PR adds this functionality. By default, it will infer the
comma-separated number-strings as String type to preserve the
information. When the user explicitly requests casting such a
comma-separated number-string into an Int type or a Long type, it will
perform the casting.

For instance, now typecasting can cast `1,234` into `1234` as an
integer.

Added testcases for other types as well.
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
apache#3111 caused changes in apache#3059 being reverted. This PR applies the
changes again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants