I am trying to create a view on a table in Apache Phoenix and add/change the
values of one of the base table columns in the view.
Something like this:
CREATE VIEW mobile_product_metrics (new_col varchar) AS
SELECT * ,
(CASE metric_type WHEN 'm' THEN 'mobile'
WHEN 'p' THEN 'phone'
ELSE 'unknown'
Correct - it has to do with the way we encode column values in the row key.
Since a VARBINARY can be any length with any bytes, we cannot know where it
ends. Thus we only allow it at the end of the row key. With a BINARY,
you're telling Phoenix how big it is, so it can occur anywhere in the PK
Thanks James.
While doing some testing on this, I have accidentally ended up with two columns
having same name/type but different column sizes. Please see below (table with
column name “ID” repeating twice):
[cid:image001.png@01D13C03.D9189390]
From: James Taylor
You'd need to create multiple views, one for each metric_type:
CREATE VIEW mobile_product_metrics (new_col1 varchar) AS SELECT * FROM
product_metrics WHERE metric_type = 'm';
CREATE VIEW phone_product_metrics (new_col2 varchar) AS SELECT * FROM
product_metrics WHERE metric_type = 'p';
On
Hi all,
I am running into an issue with Phoenix local index when "Alter Index" with
rebuild option is used. It seems like Phoenix is dropping all records from
index table and adding records for given index.
For Local index, this is an issue as one Index table will be created for all
columns
Dropping a view doesn't impact your data. Phoenix doesn't support altering
the data type of a column.
On Monday, December 21, 2015, Naor David wrote:
> Thanks James.
> This means that If I don't want to delete my data, I can alter the table
> and replicate the TIMESTAMP column
Hi,
We’re using HBase under phoenix. Need to setup DR site and ongoing replication.
Phoenix tables are salted tables. In this scenario what is the best method to
copy data to remote cluster?
People give different opinions. Replication will not work for us as we’re
using bulk loading.
Can
Hello all,
I am trying to alter table (adding new column) to a table which has a primary
key column of type VARBINARY. I am getting the following error:
Error: ERROR 1015 (42J04): Cannot add column to table when the last PK column
is of type VARBINARY or ARRAY. columnName=ID
SQLState: 42J04
Strangely, if the primary key column is of type BINARY (instead of VARBINARY),
columns can be added using alter table.
From: Ramanathan, Kannan: IT (NYK)
Sent: Monday, December 21, 2015 11:38
To: user@phoenix.apache.org
Subject: Alter table - can't add column to table which has PK column type is