Options
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to create phoenix view on existing HBase table by splitting primary key to composite keys
Labels:
- Labels:
-
Apache HBase
-
Apache Phoenix
New Contributor
Created ‎09-18-2018 06:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Considering a scenario where rowkey is combination of parts delimited by " | ".
Row Key : part1|part2|part3|1000 column family:f column: "c1" value: "1"
Row Key : part1|part2|part3|1001 column family:f column: "c2" value: "2"
How to create view in phoenix that looks like.
and insert values into Hbase through phoenix
col1 | col2 | col3 | col4 | c1 | c2 |
part1 | part2 | part3 | 1000 | 1 | null |
part1 | part2 | part3 | 1001 | null | 2 |
1 REPLY 1
New Contributor
Created ‎04-06-2020 03:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
according to this post:https://phoenix.apache.org/faq.html#How_I_map_Phoenix_table_to_an_existing_HBase_table
you can do it like this, say that the existing HBase table is "t1" :
CREATE VIEW "t1"("col1" varchar not null,
"col2" varchar not null,
"col3" varchar not null,
"col4" integer not null,
"f"."c1" integer,
"f"."c2" integer,
CONSTRAINT "ROW" PRIMARY KEY("col1", "col2", "col3", "col4")
);
