apache / pinot

Apache Pinot - A realtime distributed OLAP datastore
https://pinot.apache.org/
Apache License 2.0
5.31k stars 1.24k forks source link

Using double quotes in Presto not working as expected #7461

Open JKL98ISR opened 2 years ago

JKL98ISR commented 2 years ago

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 <table> LIMIT 10 I get the following error:

PrestoExternalError(type=EXTERNAL, name=PINOT_EXCEPTION, message="Query SELECT date FROM <table> LIMIT 10 encountered exception {"message":"PQLParsingError:\norg.apache.pinot.sql.parsers.SqlCompilationException: Caught exception while parsing query: SELECT date FROM <table> 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 <table> LIMIT 10"", query_id=20210922_140305_00041_tmeq6)

Anyone came across this?

Jackie-Jiang commented 2 years ago

@xiangfu0 ^^

xiangfu0 commented 2 years ago

Make sense, we should quotes those.

JKL98ISR commented 2 years ago

In relation to the topic also using select * produces different results in the UI and presto. Presto separates the * to the columns names which also causes an error because of the column date.

ItayGabbay commented 2 years ago

Hey guys, Any update about this? I experience this behavior also and really need to work with presto & pinot together. Thanks.