在条件子句中具有动态字段的 DELETE 似乎不适用于 phoenix

DELETE with having dynamic fields in condition clause seems not working for phoenix

我正在尝试通过指定动态字段来删除 apache phoenix 中的行。 这是一个例子: 假设我们使用以下架构创建 "test" table:

create table "test" ("id" INTEGER not null primary key, "staticColumn" VARCHAR);

并像这样插入一行

upsert into "test" ("id", "staticColumn", "dynamicColumn" VARCHAR) values (0, 'static', 'dynamic');

然后根据文档,我可以通过以下方式搜索:

select * from "test"("dynamicColumn" VARCHAR)  where "dynamicColumn" = 'dynamic';

但我只能删除:

delete from "test" where "staticColumn" = 'static';

不是:

delete from "test"("dynamicColumn" VARCHAR) where "dynamicColumn" = 'dynamic';

我收到的错误消息:

Error: ERROR 602 (42P00): Syntax error. Missing "EOF" at line 1, column 19. (state=42P00,code=602)
org.apache.phoenix.exception.PhoenixParserException: ERROR 602 (42P00): Syntax error. Missing "EOF" at line 1, column 19.
        at org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33)
        at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:111)
        at org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(PhoenixStatement.java:1285)
        at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:1366)
        at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1429)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:808)
        at sqlline.SqlLine.begin(SqlLine.java:681)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:292)
Caused by: MissingTokenException(inserted [@-1,0:0='<missing EOF>',<-1>,1:18] at ()
        at org.apache.phoenix.parse.PhoenixSQLParser.recoverFromMismatchedToken(PhoenixSQLParser.java:350)
        at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
        at org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixSQLParser.java:510)
        at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:108)
        ... 9 more

您应该向他们提交错误报告或功能请求,但作为解决方法:

delete from test where id in (select id from test(dynamicColumn VARCHAR) where dynamicColumn = 'dynamic');

无论是否在列名称周围加上双引号,它都与错误消息无关。