>我正在尝试运行最简单的查询。 但是它不起作用。
-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)
但是 --file 选项工作正常
-bash-4.2$ cat a.sql
select 1;
-bash-4.2$ prestosql --file a.sql > result
-bash-4.2$ cat result
"1"
有什么想法吗? 上级: 尝试使用反斜杠转义";"无济于事(
-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)
事实证明,这是presto CLI可执行jar周围的包装器的问题。
包装器脚本需要使用"$@"
来保留带有空格的参数(例如传递给--execute
的 SQL 查询(。
注意:通常不需要 CLI 可执行文件的包装脚本。它是可执行的,因此您可以将其直接放在$PATH
上。(或者,在路径上放置符号链接(
尝试不使用分号;
或带的盾分号:
prestosql --execute "select 1"
或
prestosql --execute "select 1;"