duckdb / duckdb/duckdb-ui

Casting fails in Instant SQL

Open
#166 2 comments 0 reactions 0 assignees View on GitHub
bug ui
Dominant language
TypeScript
Stars
465
Forks
47
PR merge metrics
No merged PRs in 30d

Description

I experience an issue when using the instant SQL feature and casting to decimal.

To reproduce:

```sql
CREATE TABLE services AS FROM 'http://blobs.duckdb.org/train-services-2025-02.csv';
```

```sql
SELECT
station,
avg(delay) AS avg_delay
FROM services
WHERE date_part('dow', date) IN (0, 6)
GROUP BY station
ORDER BY avg_delay DESC
LIMIT 3;
```

Add casting to `avg(delay)`

```sql
::DECIMAL(5, 2)
```

https://github.com/user-attachments/assets/3a65670b-5e7c-47dc-bb87-e2d9db5694d0

When running the query without instant SQL, it works.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the supplied query in Instant SQL, including the DECIMAL(5, 2) cast on avg(delay), then compare it with the same query outside Instant SQL. Trace the Instant SQL path responsible for handling casts and consider the issue complete when the casted query runs successfully there as it does without Instant SQL.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
databases, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.