apache / apache/datafusion

feat: make `parse_float_as_decimal` work on scientific notaion

Open
#8,486 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

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

``` bash
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_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the parse_float_as_decimal setting through DataFusion's SQL parser and reproduce the reported SELECT 10e10 and SELECT -10e10 queries. Identify the existing decimal-literal tests, then add coverage for scientific notation and confirm the queries parse successfully when the setting is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.