trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.49k stars 3.02k forks source link

query: `select 1 ;` invalid #24167

Closed raphaelauv closed 3 days ago

raphaelauv commented 3 days ago

why the query select 1; is invalid ?

Image


io.trino.sql.parser.ParsingException: line 1:10: mismatched input ';'. Expecting: '%', '*', '+', ',', '-', '.', '/', 'AND', 'AS', 'AT', 'EXCEPT', 'FETCH', 'FROM', 'GROUP', 'HAVING', 'INTERSECT', 'LIMIT', 'OFFSET', 'OR', 'ORDER', 'UNION', 'WHERE', 'WINDOW', '[', '||', <EOF>, <identifier>, <predicate>
    at io.trino.sql.parser.ErrorHandler.syntaxError(ErrorHandler.java:108)
    at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
    at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
    at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327)
    at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139)
    at io.trino.grammar.sql.SqlBaseParser.singleStatement(SqlBaseParser.java:352)
    at io.trino.sql.parser.SqlParser.invokeParser(SqlParser.java:172)
    at io.trino.sql.parser.SqlParser.invokeParser(SqlParser.java:125)
    at io.trino.sql.parser.SqlParser.createStatement(SqlParser.java:90)
    at io.trino.execution.QueryPreparer.prepareQuery(QueryPreparer.java:54)
    at io.trino.dispatcher.DispatchManager.createQueryInternal(DispatchManager.java:224)
    at io.trino.dispatcher.DispatchManager.lambda$createQuery$1(DispatchManager.java:193)
    at io.opentelemetry.context.Context.lambda$wrap$1(Context.java:241)
    at io.airlift.concurrent.BoundedExecutor.drainQueue(BoundedExecutor.java:79)
    at io.trino.$gen.Trino_464____20241118_145524_2.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1575)
Caused by: org.antlr.v4.runtime.InputMismatchException: undefined
    at io.trino.sql.parser.SqlParser$2.recoverInline(SqlParser.java:147)
    at org.antlr.v4.runtime.Parser.match(Parser.java:208)
    at io.trino.grammar.sql.SqlBaseParser.singleStatement(SqlBaseParser.java:347)
    ... 12 more

Trino Python Client/0.330.0

ebyhr commented 3 days ago

Please take a look at #5078