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

Feature: numeric constants literal should be parsed as fixed-point numbers instead of floating-point numbers to avoid losing precision without notice #10220

Closed
youngsofun opened this issue Feb 25, 2023 · 3 comments · Fixed by #10275
Labels
C-feature Category: feature

Comments

@youngsofun
Copy link
Member

youngsofun commented Feb 25, 2023

Summary

for numeric literal with a point, two approaches are used most commonly:

  1. use floating-point as long as there is an 'e'/'E', used by MySQL, SQL server
  2. use floating-point unless it is too large to fit into decimal (more than 38 digits), used by PostgreSQL、Impala、snowflake

the second way sounds more reasonable to me.

cc @andylokandy @sundy-li @BohuTANG

@youngsofun youngsofun added the C-feature Category: feature label Feb 25, 2023
@BohuTANG
Copy link
Member

Great.

These two examples will work after this issue is solved?

mysql> select 58750003716598352816469;
ERROR 1105 (HY000): Code: 1065, displayText = Unsupported literal value: 58750003716598352816469.

mysql> select 58750003716598352816469::Decimal(37,0);
ERROR 1105 (HY000): Code: 1065, displayText = Unsupported literal value: 58750003716598352816469.

@sundy-li
Copy link
Member

Prefer 2, so we should handle the case of Literal::BigInt

@youngsofun
Copy link
Member Author

Great.

These two examples will work after this issue is solved?

mysql> select 58750003716598352816469;
ERROR 1105 (HY000): Code: 1065, displayText = Unsupported literal value: 58750003716598352816469.

mysql> select 58750003716598352816469::Decimal(37,0);
ERROR 1105 (HY000): Code: 1065, displayText = Unsupported literal value: 58750003716598352816469.

yes

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

Successfully merging a pull request may close this issue.

3 participants