apache / apache/druid

DruidSQL should allow (and trim out) trailing semicolons;

Open
#11,212 0 comments 3 reactions 0 assignees View on GitHub
Area - Query UI Area - Querying Feature/Change Description
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

### Description

It is pretty standard to finish queries with semicolons, right now this fails to parse in Druid. It would be really easy to trim out the trailing semicolons and ignore them just like comments are ignored

### Motivation

It would improve the query UX just a little bit.

Right now

`curl 'http://localhost:8888/druid/v2/sql' -H 'Content-Type: application/json' --data-raw '{"query":"SELECT isNew, COUNT(*) FROM wikipedia GROUP BY 1 ORDER BY 2 DESC;"}'`

Fails with

`{"error":"SQL parse failed","errorMessage":"Encountered \";\" at line 1, column 65.\nWas expecting one of:\n \n \"FETCH\" ...\n \"LIMIT\" ...\n \"NULLS\" ...\n \"OFFSET\" ...\n \",\" ...\n ","errorClass":"org.apache.calcite.sql.parser.SqlParseException","host":null}`

Contributor guide

Open the contributing guide

Research direction

Start at the Druid SQL endpoint shown in the curl example and trace how the query reaches the Apache Calcite parser. Add coverage for a query ending in a semicolon, and consider the work done when that request parses and executes without the trailing semicolon affecting the query.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.