0

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

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

2 回答 2

1

;在没有分号或屏蔽分号的情况下尝试相同的操作\

 prestosql --execute "select 1"

或者

 prestosql --execute "select 1\;"
于 2020-02-07T17:27:28.363 回答
1

这原来是 presto CLI 可执行 jar 的包装器的问题。

包装脚本需要使用"$@"空格来保留参数(如传递给的 SQL 查询--execute)。

注意:通常不需要 CLI 可执行文件的包装脚本。它是可执行的,因此您可以将其直接放在$PATH. (或者,在路径上放置一个符号链接)

于 2020-02-10T11:53:07.757 回答