我想使用phoenix服务从hbase中选择行。我得到以下错误:错误:错误1036(42j04):如果父级的最后一个pk列是可变长度的,则无法修改视图的主键。columnname=tbl1.pk(状态=42j04,代码=1036)
我使用的参考资料来自:https://phoenix.apache.org/faq.html#how_i_map_phoenix_table_to_an_existing_hbase_tableapache phoenix:创建Map到现有hbase表的phoenix表
我所做的:
hbase> describe 'tbl1'
tbl1,{table_attributes=>{coprocessor$1=>'| org.apache.phoenix.coprocessor.scanregionobserver | 805306366 |',cop rocessor$2=>'| org.apache.phoenix.coprocessor.ungroupedaggregateGionobserver | 805306366 |',coprocessor$3=>''org.apac he.phoenix.coprocessor.groupedaggregateGionobserver | 805306366 |',协处理器$4=>'| org.apache.phoenix.coprocessor.ser vercachingendpointimpl | 805306366 |'}
列族说明
{name=>'c',versions=>'1',execut\u blocks\u on\u close=>'false',new\u version\u behavior=>'false',keep\u deleted\u cells=>'false',cache\u data\u on\u write=>'false',data\u block\u encoding=>'none',ttl=>'8035200 seconds(93 days)”,min\u versions=>'0',replication\u scope=>'0',bloomfilter=>'row',cache\u index\u on\u write=>'false',内存=>'false',写时缓存=>'false',打开时预取块=>'false',压缩=>'gz',块缓存=>'true',块大小=>'6 5536'}
hbase> scan 'tbl1', {LIMIT=>2}
00123 | 9223370438236964192 | 376f38c6-e92a-11ea-9c9b-0242ac130002列=c:t,时间戳=1598617869297,值=\x00\x00
00337 | 9223370438236964198 | 376e38c6-e92a-11ea-9c9b-0242ac130002列=c:s,时间戳=1598617869297,值=<111>123 ctx\u userid=“”ctx\u id=“12345”
phoenix>create table "tbl1" ( "pk" VARCHAR PRIMARY KEY, "C"."s" VARCHAR, "C"."t" VARCHAR);
phoenix>create view "CanonicalId_view_s" ( "pk" VARCHAR PRIMARY KEY, "C"."s" VARCHAR, "C"."t" VARCHAR) as select * from "CanonicalId";
我得到以下错误:
java.sql.SQLException: ERROR 1036 (42J04): Cannot modify the primary key of a VIEW if last PK column of parent is variable length. columnName=tbl1.pk
at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:497)
at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150)
at org.apache.phoenix.schema.MetaDataClient.throwIfLastPKOfParentIsFixedLength(MetaDataClient.java:4037)
at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:2410)
at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1114)
at org.apache.phoenix.compile.CreateTableCompiler$1.execute(CreateTableCompiler.java:198)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:408)
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)
暂无答案!
目前还没有任何答案,快来回答吧!