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

feat: make parse_float_as_decimal work on scientific notaion #8486

Open
Weijun-H opened this issue Dec 10, 2023 · 5 comments
Open

feat: make parse_float_as_decimal work on scientific notaion #8486

Weijun-H opened this issue Dec 10, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Weijun-H
Copy link
Contributor

Weijun-H commented Dec 10, 2023

Is your feature request related to a problem or challenge?

Datafusion can't parse float as decimal if it is scientific notation.

DataFusion CLI v33.0.0
❯ set datafusion.sql_parser.parse_float_as_decimal=true;
0 rows in set. Query took 0.014 seconds.

❯ select 10e10;
SQL error: ParserError("Cannot parse 10e10 as i128 when building decimal: invalid digit found in string")
❯ select -10e10;
SQL error: ParserError("Cannot parse 10e10 as i128 when building decimal: invalid digit found in string")

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@Weijun-H Weijun-H added the enhancement New feature or request label Dec 10, 2023
@Weijun-H
Copy link
Contributor Author

I will take this ticket

@alamb
Copy link
Contributor

alamb commented Dec 11, 2023

Maybe @andygrove has some additional context / correct expected behavior -- he seems to have introduced this feature in #4102

@Weijun-H
Copy link
Contributor Author

Weijun-H commented Dec 11, 2023

set datafusion.sql_parser.parse_float_as_decimal=true;

Yes, it supports this feature only when set datafusion.sql_parser.parse_float_as_decimal=false;

@alamb
Copy link
Contributor

alamb commented Dec 14, 2023

For the record, here is what happens by default (set datafusion.sql_parser.parse_float_as_decimal=false;)

❯ select 10e10;
+-----------------------+
| Float64(100000000000) |
+-----------------------+
| 1.0e11                |
+-----------------------+
1 row in set. Query took 0.024 seconds.

@andygrove
Copy link
Member

I made a comment in #4102 that We cannot enable by default until decimal support is farther along. Unfortunately, I do not remember the specifics. Now that decimal support is farther along, maybe we can revisit this and try enabling by default (and eventually deprecate the option).

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

Successfully merging a pull request may close this issue.

3 participants