question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prepared statement parse error with limit ?

See original GitHub issue

Using presto 0.214. Trying to create a prepared statement with limit ? and I get the following:

PREPARE statement1 FROM select ....
from .... 
limit ?
com.facebook.presto.sql.parser.ParsingException: line 3:7: mismatched input '?'. Expecting: 'ALL', <integer>
	at com.facebook.presto.sql.parser.ErrorHandler.syntaxError(ErrorHandler.java:109)
	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 com.facebook.presto.sql.parser.SqlBaseParser.queryNoWith(SqlBaseParser.java:3393)
	at com.facebook.presto.sql.parser.SqlBaseParser.query(SqlBaseParser.java:2751)
	at com.facebook.presto.sql.parser.SqlBaseParser.statement(SqlBaseParser.java:1453)
	at com.facebook.presto.sql.parser.SqlBaseParser.statement(SqlBaseParser.java:2605)
	at com.facebook.presto.sql.parser.SqlBaseParser.singleStatement(SqlBaseParser.java:236)
	at com.facebook.presto.sql.parser.SqlParser.invokeParser(SqlParser.java:160)
	at com.facebook.presto.sql.parser.SqlParser.createStatement(SqlParser.java:96)
	at com.facebook.presto.execution.QueryPreparer.prepareQuery(QueryPreparer.java:55)
	at com.facebook.presto.execution.SqlQueryManager.createQueryInternal(SqlQueryManager.java:338)
	at com.facebook.presto.execution.SqlQueryManager.lambda$createQuery$4(SqlQueryManager.java:303)
	at com.facebook.presto.$gen.Presto_0_214____20200311_120255_1.run(Unknown Source)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.antlr.v4.runtime.InputMismatchException: undefined
	at com.facebook.presto.sql.parser.SqlParser$2.recoverInline(SqlParser.java:134)
	at com.facebook.presto.sql.parser.SqlBaseParser.queryNoWith(SqlBaseParser.java:3379)
	... 15 more

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
etzelmcommented, Jul 9, 2020

Yes, we ended up doing a similar work around for now but I’d still like to see this eventually get fixed as well because according to the documentation it should work. Thank you 😃

0reactions
nayendurcommented, Sep 27, 2021

Any plans to address this issue from presto db side a part from the issue being fixed at presto-sql which is now Trino ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

MySQL syntax error using LIMIT command with Prepared ...
limit accepts integer parameters, so you should use int s, not String s: int timh1 = 1; int timh2 = 2; PreparedStatement st...
Read more >
4633: Cannot use Prepared Statement placeholders with LIMIT
I have a fix for the java connector, it checks select statements to determine if they have parameterized LIMIT criteria, and falls back...
Read more >
Java – MySQL syntax error using LIMIT command ... - iTecNote
I am writing code in Java and I want to take every time I run this code the next line from a MySQL...
Read more >
SQL error messages and exceptions - Oracle Help Center
Revalidating stored prepared statements failed. ... 42000, Syntax error or access rule violation; see additional errors for ... The limit is <number> ....
Read more >
Database Drivers Limit Size of JDBC Prepared Statements
Generally, statement size would be limited to Java and database memory. According to the docs, SQL Server query size limit is: 65,536 *...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found