Support Questions
Find answers, ask questions, and share your expertise

Map Phoenix view to existing HBase namespace table

Contributor

Hi all,

We have table 't1' in HBase using the namespace 'test'.

create 'test:t1', {NAME => 'f1', VERSIONS => 5}

Creating a view in Phoenix throws the below error:

0: jdbc:phoenix:localhost> CREATE VIEW "test.t1" ( pk VARCHAR PRIMARY KEY, "f1".val VARCHAR );
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.ensureTableCreated(ConnectionQueryServicesImpl.java:1032)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1415)
        at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:2180)
        at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:865)
        at org.apache.phoenix.compile.CreateTableCompiler$2.execute(CreateTableCompiler.java:194)
        at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:343)
        at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:331)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:329)
        at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1440)
        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)

However, creating a table in Phoenix throws SchemaNotFoundException:

0: jdbc:phoenix:localhost> CREATE table "test.t1" ( pk VARCHAR PRIMARY KEY, "f1".val VARCHAR );
Error: ERROR 722 (43M05): Schema does not exists schemaName=TEST (state=43M05,code=722)
org.apache.phoenix.schema.SchemaNotFoundException: ERROR 722 (43M05): Schema does not exists schemaName=TEST
        at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createSchemaRef(FromCompiler.java:507)
        at org.apache.phoenix.compile.FromCompiler$SchemaResolver.<init>(FromCompiler.java:300)
        at org.apache.phoenix.compile.FromCompiler.getResolverForCreation(FromCompiler.java:160)
        at org.apache.phoenix.compile.CreateTableCompiler.compile(CreateTableCompiler.java:83)
        at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableCreateTableStatement.compilePlan(PhoenixStatement.java:628)
        at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableCreateTableStatement.compilePlan(PhoenixStatement.java:617)
        at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:336)
        at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:331)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:329)
        at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1440)
        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)

How do I map Phoenix view to an existing HBase table in a namspace with HDP 2.5.3?

Thank you in advance, Christian

1 REPLY 1