无法运行简单的presto shell查询

daupos2t  于 2021-06-25  发布在  Hive
关注(0)|答案(2)|浏览(409)

我正在尝试运行最简单的查询。但是它不起作用。

-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"

有什么想法吗?upd:试图逃脱';'用反斜杠也没用(

-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)
flvlnr44

flvlnr441#

这是presto cli可执行jar的 Package 器的问题。
Package 器脚本需要使用 "$@" 使用空格保留参数(如传递给 --execute ).
注意:cli可执行文件通常不需要 Package 器脚本。它是可执行的,所以你可以直接放在 $PATH . (或者,在路径上放置一个符号链接)

8tntrjer

8tntrjer2#

尝试不带分号的相同操作 ; 或者用 \ :

prestosql --execute "select 1"

prestosql --execute "select 1\;"

相关问题