我试图通过指定动态字段来删除apache phoenix中的行。 这是一个例子: 假设我们使用下面的模式创建“测试”表:
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
答案 0 :(得分:1)
您应该向他们提交错误报告或功能请求,但作为解决方法:
delete from test where id in (select id from test(dynamicColumn VARCHAR) where dynamicColumn = 'dynamic');
在列名称周围使用或不使用双引号,它与错误消息无关。