I am trying to run simplest query. However it is not working.
-bash-4.2$ prestosql --execute "select 1;" Exception in thread "main" io.airlift.airline.ParseArgumentsUnexpectedException: Found unexpected parameters: [1;] at io.airlift.airline.SingleCommand.validate(SingleCommand.java:98) at io.airlift.airline.SingleCommand.parse(SingleCommand.java:65) at io.airlift.airline.SingleCommand.parse(SingleCommand.java:56) at io.prestosql.cli.Presto.main(Presto.java:24)
But –file option works fine
-bash-4.2$ cat a.sql select 1; -bash-4.2$ prestosql --file a.sql > result -bash-4.2$ cat result "1"
Any ideas? UPD: Trying to escape ‘;’ with backslash doesn’t help(
-bash-4.2$ prestosql --execute "select 1" Exception in thread "main" io.airlift.airline.ParseArgumentsUnexpectedException: Found unexpected parameters: [1] at io.airlift.airline.SingleCommand.validate(SingleCommand.java:98) at io.airlift.airline.SingleCommand.parse(SingleCommand.java:65) at io.airlift.airline.SingleCommand.parse(SingleCommand.java:56) at io.prestosql.cli.Presto.main(Presto.java:24) -bash-4.2$ prestosql --execute "select 1;" Exception in thread "main" io.airlift.airline.ParseArgumentsUnexpectedException: Found unexpected parameters: [1;] at io.airlift.airline.SingleCommand.validate(SingleCommand.java:98) at io.airlift.airline.SingleCommand.parse(SingleCommand.java:65) at io.airlift.airline.SingleCommand.parse(SingleCommand.java:56) at io.prestosql.cli.Presto.main(Presto.java:24)
Advertisement
Answer
This turned out to be an issue with the wrapper around presto CLI executable jar.
The wrapper script needs to use "$@"
to preserve parameter with spaces (like the SQL query being passed to --execute
).
Note: there is usually no need to have a wrapper script for CLI executable. It’s executable, so you can place it directly on $PATH
. (Or, place a symlink on path)