Using double quotes in Presto not working as expected
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 1.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 195
Description
I have a field called date in my database so I need to use double quotes to not get a parse error.
When I use double quotes in the Pinot console UI it runs the query normally.
In Presto it seems like the double quotes are removed before the compilation.
When I process the query: `SELECT "date" from LIMIT 10` I get the following error:
`PrestoExternalError(type=EXTERNAL, name=PINOT_EXCEPTION, message="Query SELECT date FROM LIMIT 10 encountered exception {"message":"PQLParsingError:\norg.apache.pinot.sql.parsers.SqlCompilationException: Caught exception while parsing query: SELECT date FROM LIMIT 10\n\tat org.apache.pinot.sql.parsers.CalciteSqlParser.compileCalciteSqlToPinotQuery(CalciteSqlParser.java:327)\n\tat org.apache.pinot.sql.parsers.CalciteSqlParser.compileToPinotQuery(CalciteSqlParser.java:110)\n\tat org.apache.pinot.sql.parsers.CalciteSqlCompiler.compileToBrokerRequest(CalciteSqlCompiler.java:35)\n\tat org.apache.pinot.core.requesthandler.PinotQueryParserFactory.parseSQLQuery(PinotQueryParserFactory.java:49)\n\tat org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleSQLRequest(BaseBrokerRequestHandler.java:212)\n\tat org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:194)\n\tat org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:99)\n\tat org.apache.pinot.broker.api.resources.PinotClientRequest.processSqlQueryPost(PinotClientRequest.java:191)\n\tat jdk.internal.reflect.GeneratedMethodAccessor94.invoke(Unknown Source)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)\n\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)\n\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)","errorCode":150} with pinot query "SELECT date FROM LIMIT 10"", query_id=20210922_140305_00041_tmeq6)`
Anyone came across this?
Contributor guide
Research direction
Start by reproducing the quoted-identifier query through the Presto-to-Pinot path and trace it from PinotQueryParserFactory.parseSQLQuery into CalciteSqlParser.compileCalciteSqlToPinotQuery. Confirm where the double quotes are removed and verify that the generated Pinot query preserves the identifier quoting without breaking existing queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100