You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Divya Gehlot <di...@gmail.com> on 2016/03/11 08:54:20 UTC
[Query:]Table creation with column family in Phoenix
Hi,
I created a table in Phoenix with three column families and Inserted the
values as shown below
Syntax :
> CREATE TABLE TESTCF (MYKEY VARCHAR NOT NULL PRIMARY KEY, CF1.COL1 VARCHAR,
> CF2.COL2 VARCHAR, CF3.COL3 VARCHAR)
> UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> ('Key2','CF1','CF2','CF3')
> UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> ('Key2','CF12','CF22','CF32')
When I try to scan same table in Hbase
hbase(main):010:0> scan "TESTCF"
> ROW COLUMN+CELL
> Key1 column=CF1:COL1, timestamp=1457682385805, value=CF1
> Key1 column=CF1:_0, timestamp=1457682385805, value=
> Key1 column=CF2:COL2, timestamp=1457682385805, value=CF2
> Key1 column=CF3:COL3, timestamp=1457682385805, value=CF3
> Key2 column=CF1:COL1, timestamp=1457682426396, value=CF12
> Key2 column=CF1:_0, timestamp=1457682426396, value=
> Key2 column=CF2:COL2, timestamp=1457682426396, value=CF22
> Key2 column=CF3:COL3, timestamp=1457682426396, value=CF32
> 2 row(s) in 0.0260 seconds
My query is why I am getting CF1:_0 one extra column in each row with no
value.
Can any body explain me .
Would really appreciate the help.
Thanks,
Divya
Re: [Query:]Table creation with column family in Phoenix
Posted by Divya Gehlot <di...@gmail.com>.
Thanks Enis for such a good explanation .
On 15 March 2016 at 08:13, Enis Söztutar <en...@gmail.com> wrote:
> Phoenix maintains a column with empty value, because unlike a row-oriented
> RDBMS, a NULL column is not represented explicitly in HBase, but implicitly
> where the cell is not in HBase at all.
>
> Here is the explanation from phoenix.apache.org:
>
> For CREATE TABLE, an empty key value will also be added for each row so
> that queries behave as expected (without requiring all columns to be
> projected during scans). For CREATE VIEW, this will not be done, nor will
> any HBase metadata be created. Instead the existing HBase metadata must
> match the metadata specified in the DDL statement or aERROR 505 (42000):
> Table is read only will be thrown.
> Enis
>
> On Fri, Mar 11, 2016 at 2:53 PM, Harish Krishnan <
> harish.t.krishnan@gmail.com> wrote:
>
> > Your scan query is returning all states/versions of your columns and
> column
> > families
> >
> > Thanks & Regards,
> > Harish.T.K
> >
> > On Thu, Mar 10, 2016 at 11:54 PM, Divya Gehlot <di...@gmail.com>
> > wrote:
> >
> > > Hi,
> > > I created a table in Phoenix with three column families and Inserted
> the
> > > values as shown below
> > >
> > > Syntax :
> > >
> > > > CREATE TABLE TESTCF (MYKEY VARCHAR NOT NULL PRIMARY KEY, CF1.COL1
> > > VARCHAR,
> > > > CF2.COL2 VARCHAR, CF3.COL3 VARCHAR)
> > > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > > ('Key2','CF1','CF2','CF3')
> > > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > > ('Key2','CF12','CF22','CF32')
> > >
> > >
> > > When I try to scan same table in Hbase
> > > hbase(main):010:0> scan "TESTCF"
> > >
> > > > ROW COLUMN+CELL
> > > > Key1 column=CF1:COL1, timestamp=1457682385805,
> > value=CF1
> > > > Key1 column=CF1:_0, timestamp=1457682385805, value=
> > > > Key1 column=CF2:COL2, timestamp=1457682385805,
> > value=CF2
> > > > Key1 column=CF3:COL3, timestamp=1457682385805,
> > value=CF3
> > > > Key2 column=CF1:COL1, timestamp=1457682426396,
> > > value=CF12
> > > > Key2 column=CF1:_0, timestamp=1457682426396, value=
> > > > Key2 column=CF2:COL2, timestamp=1457682426396,
> > > value=CF22
> > > > Key2 column=CF3:COL3, timestamp=1457682426396,
> > > value=CF32
> > > > 2 row(s) in 0.0260 seconds
> > >
> > >
> > > My query is why I am getting CF1:_0 one extra column in each row with
> no
> > > value.
> > >
> > > Can any body explain me .
> > > Would really appreciate the help.
> > >
> > > Thanks,
> > > Divya
> > >
> >
>
Re: [Query:]Table creation with column family in Phoenix
Posted by Enis Söztutar <en...@gmail.com>.
Phoenix maintains a column with empty value, because unlike a row-oriented
RDBMS, a NULL column is not represented explicitly in HBase, but implicitly
where the cell is not in HBase at all.
Here is the explanation from phoenix.apache.org:
For CREATE TABLE, an empty key value will also be added for each row so
that queries behave as expected (without requiring all columns to be
projected during scans). For CREATE VIEW, this will not be done, nor will
any HBase metadata be created. Instead the existing HBase metadata must
match the metadata specified in the DDL statement or aERROR 505 (42000):
Table is read only will be thrown.
Enis
On Fri, Mar 11, 2016 at 2:53 PM, Harish Krishnan <
harish.t.krishnan@gmail.com> wrote:
> Your scan query is returning all states/versions of your columns and column
> families
>
> Thanks & Regards,
> Harish.T.K
>
> On Thu, Mar 10, 2016 at 11:54 PM, Divya Gehlot <di...@gmail.com>
> wrote:
>
> > Hi,
> > I created a table in Phoenix with three column families and Inserted the
> > values as shown below
> >
> > Syntax :
> >
> > > CREATE TABLE TESTCF (MYKEY VARCHAR NOT NULL PRIMARY KEY, CF1.COL1
> > VARCHAR,
> > > CF2.COL2 VARCHAR, CF3.COL3 VARCHAR)
> > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > ('Key2','CF1','CF2','CF3')
> > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > ('Key2','CF12','CF22','CF32')
> >
> >
> > When I try to scan same table in Hbase
> > hbase(main):010:0> scan "TESTCF"
> >
> > > ROW COLUMN+CELL
> > > Key1 column=CF1:COL1, timestamp=1457682385805,
> value=CF1
> > > Key1 column=CF1:_0, timestamp=1457682385805, value=
> > > Key1 column=CF2:COL2, timestamp=1457682385805,
> value=CF2
> > > Key1 column=CF3:COL3, timestamp=1457682385805,
> value=CF3
> > > Key2 column=CF1:COL1, timestamp=1457682426396,
> > value=CF12
> > > Key2 column=CF1:_0, timestamp=1457682426396, value=
> > > Key2 column=CF2:COL2, timestamp=1457682426396,
> > value=CF22
> > > Key2 column=CF3:COL3, timestamp=1457682426396,
> > value=CF32
> > > 2 row(s) in 0.0260 seconds
> >
> >
> > My query is why I am getting CF1:_0 one extra column in each row with no
> > value.
> >
> > Can any body explain me .
> > Would really appreciate the help.
> >
> > Thanks,
> > Divya
> >
>
Re: [Query:]Table creation with column family in Phoenix
Posted by Enis Söztutar <en...@gmail.com>.
Phoenix maintains a column with empty value, because unlike a row-oriented
RDBMS, a NULL column is not represented explicitly in HBase, but implicitly
where the cell is not in HBase at all.
Here is the explanation from phoenix.apache.org:
For CREATE TABLE, an empty key value will also be added for each row so
that queries behave as expected (without requiring all columns to be
projected during scans). For CREATE VIEW, this will not be done, nor will
any HBase metadata be created. Instead the existing HBase metadata must
match the metadata specified in the DDL statement or aERROR 505 (42000):
Table is read only will be thrown.
Enis
On Fri, Mar 11, 2016 at 2:53 PM, Harish Krishnan <
harish.t.krishnan@gmail.com> wrote:
> Your scan query is returning all states/versions of your columns and column
> families
>
> Thanks & Regards,
> Harish.T.K
>
> On Thu, Mar 10, 2016 at 11:54 PM, Divya Gehlot <di...@gmail.com>
> wrote:
>
> > Hi,
> > I created a table in Phoenix with three column families and Inserted the
> > values as shown below
> >
> > Syntax :
> >
> > > CREATE TABLE TESTCF (MYKEY VARCHAR NOT NULL PRIMARY KEY, CF1.COL1
> > VARCHAR,
> > > CF2.COL2 VARCHAR, CF3.COL3 VARCHAR)
> > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > ('Key2','CF1','CF2','CF3')
> > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > ('Key2','CF12','CF22','CF32')
> >
> >
> > When I try to scan same table in Hbase
> > hbase(main):010:0> scan "TESTCF"
> >
> > > ROW COLUMN+CELL
> > > Key1 column=CF1:COL1, timestamp=1457682385805,
> value=CF1
> > > Key1 column=CF1:_0, timestamp=1457682385805, value=
> > > Key1 column=CF2:COL2, timestamp=1457682385805,
> value=CF2
> > > Key1 column=CF3:COL3, timestamp=1457682385805,
> value=CF3
> > > Key2 column=CF1:COL1, timestamp=1457682426396,
> > value=CF12
> > > Key2 column=CF1:_0, timestamp=1457682426396, value=
> > > Key2 column=CF2:COL2, timestamp=1457682426396,
> > value=CF22
> > > Key2 column=CF3:COL3, timestamp=1457682426396,
> > value=CF32
> > > 2 row(s) in 0.0260 seconds
> >
> >
> > My query is why I am getting CF1:_0 one extra column in each row with no
> > value.
> >
> > Can any body explain me .
> > Would really appreciate the help.
> >
> > Thanks,
> > Divya
> >
>
Re: [Query:]Table creation with column family in Phoenix
Posted by Divya Gehlot <di...@gmail.com>.
Thanks Harish for the responding to my query and explanation.
On 12 March 2016 at 06:53, Harish Krishnan <ha...@gmail.com>
wrote:
> Your scan query is returning all states/versions of your columns and column
> families
>
> Thanks & Regards,
> Harish.T.K
>
> On Thu, Mar 10, 2016 at 11:54 PM, Divya Gehlot <di...@gmail.com>
> wrote:
>
> > Hi,
> > I created a table in Phoenix with three column families and Inserted the
> > values as shown below
> >
> > Syntax :
> >
> > > CREATE TABLE TESTCF (MYKEY VARCHAR NOT NULL PRIMARY KEY, CF1.COL1
> > VARCHAR,
> > > CF2.COL2 VARCHAR, CF3.COL3 VARCHAR)
> > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > ('Key2','CF1','CF2','CF3')
> > > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > > ('Key2','CF12','CF22','CF32')
> >
> >
> > When I try to scan same table in Hbase
> > hbase(main):010:0> scan "TESTCF"
> >
> > > ROW COLUMN+CELL
> > > Key1 column=CF1:COL1, timestamp=1457682385805,
> value=CF1
> > > Key1 column=CF1:_0, timestamp=1457682385805, value=
> > > Key1 column=CF2:COL2, timestamp=1457682385805,
> value=CF2
> > > Key1 column=CF3:COL3, timestamp=1457682385805,
> value=CF3
> > > Key2 column=CF1:COL1, timestamp=1457682426396,
> > value=CF12
> > > Key2 column=CF1:_0, timestamp=1457682426396, value=
> > > Key2 column=CF2:COL2, timestamp=1457682426396,
> > value=CF22
> > > Key2 column=CF3:COL3, timestamp=1457682426396,
> > value=CF32
> > > 2 row(s) in 0.0260 seconds
> >
> >
> > My query is why I am getting CF1:_0 one extra column in each row with no
> > value.
> >
> > Can any body explain me .
> > Would really appreciate the help.
> >
> > Thanks,
> > Divya
> >
>
Re: [Query:]Table creation with column family in Phoenix
Posted by Harish Krishnan <ha...@gmail.com>.
Your scan query is returning all states/versions of your columns and column
families
Thanks & Regards,
Harish.T.K
On Thu, Mar 10, 2016 at 11:54 PM, Divya Gehlot <di...@gmail.com>
wrote:
> Hi,
> I created a table in Phoenix with three column families and Inserted the
> values as shown below
>
> Syntax :
>
> > CREATE TABLE TESTCF (MYKEY VARCHAR NOT NULL PRIMARY KEY, CF1.COL1
> VARCHAR,
> > CF2.COL2 VARCHAR, CF3.COL3 VARCHAR)
> > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > ('Key2','CF1','CF2','CF3')
> > UPSERT INTO TESTCF (MYKEY,CF1.COL1,CF2.COL2,CF3.COL3)values
> > ('Key2','CF12','CF22','CF32')
>
>
> When I try to scan same table in Hbase
> hbase(main):010:0> scan "TESTCF"
>
> > ROW COLUMN+CELL
> > Key1 column=CF1:COL1, timestamp=1457682385805, value=CF1
> > Key1 column=CF1:_0, timestamp=1457682385805, value=
> > Key1 column=CF2:COL2, timestamp=1457682385805, value=CF2
> > Key1 column=CF3:COL3, timestamp=1457682385805, value=CF3
> > Key2 column=CF1:COL1, timestamp=1457682426396,
> value=CF12
> > Key2 column=CF1:_0, timestamp=1457682426396, value=
> > Key2 column=CF2:COL2, timestamp=1457682426396,
> value=CF22
> > Key2 column=CF3:COL3, timestamp=1457682426396,
> value=CF32
> > 2 row(s) in 0.0260 seconds
>
>
> My query is why I am getting CF1:_0 one extra column in each row with no
> value.
>
> Can any body explain me .
> Would really appreciate the help.
>
> Thanks,
> Divya
>