Improve `repeat` so it errors if the second argument is a non integer
- 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?
Prior to https://github.com/apache/datafusion/pull/14268, the following query would error:
```sql
select repeat('-1.2', 3.2);
```
```
query error DataFusion error: Error during planning: Internal error: Expect TypeSignatureClass::Native\(LogicalType\(Native\(Int64\), Int64\)\) but received Float64
```
After https://github.com/apache/datafusion/pull/14268 it appends `3` copies (ignores the `.2` part
```
DataFusion CLI v44.0.0
> select repeat('-1.2', 3.2);
+-----------------------------------+
| repeat(Utf8("-1.2"),Float64(3.2)) |
+-----------------------------------+
| -1.2-1.2-1.2 |
+-----------------------------------+
1 row(s) fetched.
Elapsed 0.023 seconds.
```
### Describe the solution you'd like
Per @jayzhan211 the query should error if the second argument is a non intger: https://github.com/apache/datafusion/pull/14268/files#r1933031384
> I still think non-integer 2nd arg should return error
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start by tracing the SQL repeat function and reproduce the reported query, select repeat('-1.2', 3.2), in DataFusion. Confirm that a non-integer second argument now produces an error rather than truncating the value, and add or update coverage for this behavior if the surrounding repeat tests are found.
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