Phoenx create view Table is read only.

Error: ERROR 505 (42000): Table is read only. (state=42000,code=505)
org.apache.phoenix.schema.ReadOnlyTableException: ERROR 505 (42000): Table is read only.
at org.apache.phoenix.query.ConnectionQueryServicesImpl.generateTableDescriptor(ConnectionQueryServicesImpl.java:765)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:991)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1369)
at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:2116)
at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:828)
at org.apache.phoenix.compile.CreateTableCompiler$2.execute(CreateTableCompiler.java:183)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:338)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:326)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:324)
at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1345)
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)

Hbase shell 

hbase(main):055:0> scan "test2"
ROW                   COLUMN+CELL                                                
 rk0001               column=cf1:age, timestamp=1548662234920, value=30          
 rk0001               column=cf1:name, timestamp=1548662234910, value=panxiaojun 
 rk0002               column=cf1:age, timestamp=1548662234939, value=35          
 rk0002               column=cf1:name, timestamp=1548662234931, value=yanbiao    
2 row(s) in 0.0280 seconds 

 phoenix

解决办法:如果是通过hbase创建的表,需要在phoenix中create table 而不是create view。另外需要注意的是需要用双引
create table "test2"(
"user_id" varchar primary key,
"cf1"."name"  varchar,
"cf1"."age" varchar);
 

你可能感兴趣的:(Hadoop)