phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: How to enable a HBase table to be phoenix-able
Date Sat, 22 Mar 2014 04:06:03 GMT
Hi Tianying,
Not sure what version you're using, but I recommend you use the latest
release candidate [1]. If you've been playing around with earlier 3.0
version, then it's best if you disable and drop the system table through
the HBase shell, as it's been through various changes:
    disable 'SYSTEM.CATALOG'
    drop 'SYSTEM.CATALOG'
Phoenix will automatically create this table when you connect the first
time.

I tried creating an HBase table in the HBase shell and then creating a view
in Phoenix and dropping the view, and it worked fine.

>From the HBase shell:
    create 'foo', {NAME => 'f1'}
    put 'foo', 'r1','f1','value'

>From the Phoenix sqlline:
    create view "foo"(k varchar primary key, "f1". "value" varchar);
    select * from "foo";
    drop view "foo";

Note that when you map a Phoenix table to an existing HBase table, the
table name and column family name must match exactly. Otherwise Phoenix
will give you an error message, because a view on an existing HBase table
is considered read-only.

HTH,
James


[1]
http://mail-archives.apache.org/mod_mbox/incubator-phoenix-dev/201403.mbox/%3CCAAF1JdiBkqtR9FkEow-kGd1xsxZ%2B0B1-7NejH%3Duygocx_iM30g%40mail.gmail.com%3E


On Fri, Mar 21, 2014 at 5:55 PM, Tianying Chang <tychang@gmail.com> wrote:

> I tried to Drop view, it complains undefined, but if I try to create the
> view, it will complain already exist. Any idea?
>
>
> 0: jdbc:phoenix:hbasetestzk001a.ec2.pin220.co>  CREATE VIEW "TestTable" (
> pk VARCHAR PRIMARY KEY, "info".val VARCHAR );
>
> Error: ERROR 1013 (42M04): Table already exists. tableName=TestTable
> (state=42M04,code=0)
>
> 0: jdbc:phoenix:hbasetestzk001a.ec2.pin220.co> DROP VIEW "TestTable";
>
> Error: ERROR 1012 (42M03): Table undefined. tableName=TestTable
> (state=42M03,code=1012)
>
>
> On Fri, Mar 21, 2014 at 5:13 PM, Tianying Chang <tychang@gmail.com> wrote:
>
>> That works. Thanks
>>
>> Tian-Ying
>>
>>
>> On Fri, Mar 21, 2014 at 5:01 PM, James Taylor <jamestaylor@apache.org>wrote:
>>
>>> Hi Tianying,
>>> Try with our new 3.0 release candidate (
>>> http://mail-archives.apache.org/mod_mbox/incubator-phoenix-dev/201403.mbox/%3CCAAF1JdiBkqtR9FkEow-kGd1xsxZ%2B0B1-7NejH%3Duygocx_iM30g%40mail.gmail.com%3E).
>>>
>>>
>>> Follow the examples here: http://phoenix.incubator.apache.org/views.html
>>>
>>> Please note that Phoenix upper cases table, column, and column family
>>> names. So if your HBase table metadata isn't all uppercase, you need to put
>>> these names in double quotes as the FAQ outlines.
>>>
>>> Thanks,
>>> James
>>>
>>>
>>> On Fri, Mar 21, 2014 at 4:54 PM, Tianying Chang <tychang@gmail.com>wrote:
>>>
>>>> Hi, Mujtaba
>>>>
>>>> Thanks for the quick response.
>>>>
>>>> I tried that, but got error below
>>>>
>>>>  CREATE VIEW TestTable ( pk VARCHAR PRIMARY KEY, info.val VARCHAR );
>>>>
>>>> Error: ERROR 505 (42000): Table is read only. (state=42000,code=0)
>>>>
>>>>
>>>> On Fri, Mar 21, 2014 at 4:19 PM, Mujtaba Chohan <mujtaba@apache.org>wrote:
>>>>
>>>>> Hi Tian,
>>>>>
>>>>> Following page describes how you can use existing tables with Phoenix
>>>>> http://phoenix.incubator.apache.org/faq.html#How_I_create_Views_in_Phoenix_Whats_the_difference_between_ViewsTables
>>>>>
>>>>> //mujtaba
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 21, 2014 at 4:07 PM, Tianying Chang <tychang@gmail.com>wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have put the phoenix jar under the hbase/lib. and tested that I
can
>>>>>> create a new table with sqlline, and do the select * statement.
>>>>>>
>>>>>> My question is how can I convert the existing HBase table  to run
>>>>>> those select commands? I have a HBase table that already has large
amount
>>>>>> of data in it.
>>>>>>
>>>>>> Thanks
>>>>>> Tian-Ying
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Mime
View raw message