我从hbase表创建了一个phoenix视图,然后从中创建了一个phoenix视图,最后尝试向上插入一个新的:
create view "personal" (k VARCHAR primary key, "personal_data"."name" VARCHAR);
select * from "personal";
+--------+-------------------------------+
| K | name |
+--------+-------------------------------+
| 0 | Darrell Clark |
| 1 | Elizabeth Baker |
| 10 | Brad Alexander |
| 100 | Douglas Morris |
| 1000 | Joel Boyd |
| 10000 | Christine Wood |
| 10001 | Thomas Wilson |
| 10002 | Laura Salinas |
| 10003 | Audrey Norris |
| 10004 | Kristen Klein |
| 10005 | Vanessa Brooks |
| 10006 | Mary Flynn |
| 10007 | Margaret Mullen |
然后创建一个phoenix表:
create table if not exists personal_table (name VARCHAR, k VARCHAR CONSTRAINT my_pk PRIMARY KEY (name, k));
然后我试着向上插入:
UPSERT INTO personal_table SELECT * FROM personal;
Error: ERROR 1012 (42M03): Table undefined. tableName=PERSONAL (state=42M03,code=1012)
org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=PERSONAL
at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:582)
at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:396)
at org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:228)
at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:504)
at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:784)
at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:770)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:401)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:391)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:390)
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378)
at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1825)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:813)
at sqlline.SqlLine.begin(SqlLine.java:686)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:291)
有什么问题吗?是否可以向上插入表格select*from view?谢谢!
1条答案
按热度按时间azpvetkf1#
是否可以向上插入表格select*from view?
不,不是这样的。upsert语句中缺少引号导致此错误。“与create table一样,表、列族和列名都是大写的,除非它们是双引号
UPSERT INTO personal_table SELECT * FROM personal;
应该是->UPSERT INTO personal_table SELECT * FROM "personal";
我在本地法院审理了你的案子。以下是我在hbase shell上执行的操作:然后我切换到phoenix sqlline并执行以下命令: