You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Maria Catherine Tan <ct...@exist.com> on 2015/04/24 06:41:16 UTC

Creating table with multiple column families having dynamic columns

Hi,

We're planning to use phoenix to create an HBase table with 2 column families both having dynamic columns.

Already did some googling but I couldn't find an example on how to do that or if it's even possible.

Can anyone point me in the right direction.


Thanks,
--
Maria Catherine Tan
Software Engineer | Exist Software Labs | +6326874091 | skype: marica_tan | email: ctan@exist.com | www.exist.com | Innovation Delivered

Re: Creating table with multiple column families having dynamic columns

Posted by Maria Catherine Tan <ct...@exist.com>.
Hi Sergey,

In my case, I just want to create a table in phoenix without defining the column names, since they're all dynamic.

CREATE table "myTable" (
  SOURCE varchar(50) not null,
  CIF varchar(50) not null,
  COLFAM,
  COLFAM,
  CONSTRAINT PK PRIMARY KEY (SOURCE, CIF)
);

So I guess my only option is to create a dummy column for each column family.


Thanks,
--
Maria Catherine Tan

----- Original Message -----
From: "Sergey Belousov" <se...@gmail.com>
To: user@phoenix.apache.org
Sent: Friday, April 24, 2015 8:17:17 PM
Subject: Re: Creating table with multiple column families having dynamic columns

http://phoenix.apache.org/dynamic_columns.html

Sometimes defining a static schema up front is not feasible. Instead, a
subset of columns may be specified at table create
<http://phoenix.apache.org/language/index.html#create_table> time while the
rest would be specified at query
<http://phoenix.apache.org/language/index.html#select> time. As of Phoenix
1.2, specifying columns dynamically is now supported by allowing column
definitions to included in parenthesis after the table in the FROM clause
on a SELECT statement. Although this is not standard SQL, it is useful to
surface this type of functionality to leverage the late binding ability of
HBase.

On Fri, Apr 24, 2015 at 1:38 AM, 丁桂涛(桂花) <di...@baixing.com> wrote:

> see the Phoenix FAQ
> <http://phoenix.apache.org/faq.html#Are_there_any_tips_for_optimizing_Phoenix>
> :
>
>
>    - Use *multiple column families*
>
> Column family contains related data in separate files. If you query use
> selected columns then it make sense to group those columns together in a
> column family to improve read performance.
>
> Example:
>
> Following create table DDL will create two column faimiles A and B.
>
> *CREATE TABLE TEST (MYKEY VARCHAR NOT NULL PRIMARY KEY, A.COL1 VARCHAR,
> A.COL2 VARCHAR, B.COL3 VARCHAR)*
>
> On Fri, Apr 24, 2015 at 12:41 PM, Maria Catherine Tan <ct...@exist.com>
> wrote:
>
>> Hi,
>>
>> We're planning to use phoenix to create an HBase table with 2 column
>> families both having dynamic columns.
>>
>> Already did some googling but I couldn't find an example on how to do
>> that or if it's even possible.
>>
>> Can anyone point me in the right direction.
>>
>>
>> Thanks,
>> --
>> Maria Catherine Tan
>> Software Engineer | Exist Software Labs | +6326874091 | skype:
>> marica_tan | email: ctan@exist.com | www.exist.com | Innovation Delivered
>>
>
>

Re: Creating table with multiple column families having dynamic columns

Posted by Sergey Belousov <se...@gmail.com>.
http://phoenix.apache.org/dynamic_columns.html

Sometimes defining a static schema up front is not feasible. Instead, a
subset of columns may be specified at table create
<http://phoenix.apache.org/language/index.html#create_table> time while the
rest would be specified at query
<http://phoenix.apache.org/language/index.html#select> time. As of Phoenix
1.2, specifying columns dynamically is now supported by allowing column
definitions to included in parenthesis after the table in the FROM clause
on a SELECT statement. Although this is not standard SQL, it is useful to
surface this type of functionality to leverage the late binding ability of
HBase.

On Fri, Apr 24, 2015 at 1:38 AM, 丁桂涛(桂花) <di...@baixing.com> wrote:

> see the Phoenix FAQ
> <http://phoenix.apache.org/faq.html#Are_there_any_tips_for_optimizing_Phoenix>
> :
>
>
>    - Use *multiple column families*
>
> Column family contains related data in separate files. If you query use
> selected columns then it make sense to group those columns together in a
> column family to improve read performance.
>
> Example:
>
> Following create table DDL will create two column faimiles A and B.
>
> *CREATE TABLE TEST (MYKEY VARCHAR NOT NULL PRIMARY KEY, A.COL1 VARCHAR,
> A.COL2 VARCHAR, B.COL3 VARCHAR)*
>
> On Fri, Apr 24, 2015 at 12:41 PM, Maria Catherine Tan <ct...@exist.com>
> wrote:
>
>> Hi,
>>
>> We're planning to use phoenix to create an HBase table with 2 column
>> families both having dynamic columns.
>>
>> Already did some googling but I couldn't find an example on how to do
>> that or if it's even possible.
>>
>> Can anyone point me in the right direction.
>>
>>
>> Thanks,
>> --
>> Maria Catherine Tan
>> Software Engineer | Exist Software Labs | +6326874091 | skype:
>> marica_tan | email: ctan@exist.com | www.exist.com | Innovation Delivered
>>
>
>

Re: Creating table with multiple column families having dynamic columns

Posted by 丁桂涛(桂花) <di...@baixing.com>.
see the Phoenix FAQ
<http://phoenix.apache.org/faq.html#Are_there_any_tips_for_optimizing_Phoenix>
:


   - Use *multiple column families*

Column family contains related data in separate files. If you query use
selected columns then it make sense to group those columns together in a
column family to improve read performance.

Example:

Following create table DDL will create two column faimiles A and B.

*CREATE TABLE TEST (MYKEY VARCHAR NOT NULL PRIMARY KEY, A.COL1 VARCHAR,
A.COL2 VARCHAR, B.COL3 VARCHAR)*

On Fri, Apr 24, 2015 at 12:41 PM, Maria Catherine Tan <ct...@exist.com>
wrote:

> Hi,
>
> We're planning to use phoenix to create an HBase table with 2 column
> families both having dynamic columns.
>
> Already did some googling but I couldn't find an example on how to do that
> or if it's even possible.
>
> Can anyone point me in the right direction.
>
>
> Thanks,
> --
> Maria Catherine Tan
> Software Engineer | Exist Software Labs | +6326874091 | skype: marica_tan
> | email: ctan@exist.com | www.exist.com | Innovation Delivered
>