You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by Vamshi Krishna <va...@gmail.com> on 2015/07/30 15:33:26 UTC

Table undefined error even though table exists

Hi,
 I am trying to access my hbase running on my local machine with zookeeper
at localhost:2181. I installed phoenix-3.3.1-bin and trying to access an
already existing hbase tabe, but could not. So, simply to test, i created a
table using phoenix commandline and see it when i run !tables command. but
when i run selet command, it shows error.


This is what I am doing.

0: jdbc:phoenix:localhost> CREATE TABLE stats.prod_metrics ( host char(50)
not null, created_date date not null,

. . . . . . . . . . . . .>     txn_count bigint CONSTRAINT pk PRIMARY KEY
(host, created_date) );

No rows affected (1.82 seconds)

0: jdbc:phoenix:localhost> !tables

*+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*

*| **               TABLE_CAT                ** | **
TABLE_SCHEM               ** | **               TABLE_NAME               **
| **               TABLE_TYPE** |*

*+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*

*| *                                        * | *SYSTEM
             * | *CATALOG                                 * | *SYSTEM
TABLE             * |*

*| *                                        * | *SYSTEM
             * | *SEQUENCE                                * | *SYSTEM
TABLE             * |*

*| *                                        * | *SYSTEM
             * | *STATS                                   * | *SYSTEM
TABLE             * |*

*| *                                        * | *STATS
             * | *PROD_METRICS                            * | *TABLE
             * |*

*+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*

0: jdbc:phoenix:localhost> select * from PROD_METRICS;

*Error: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS
(state=42M03,code=1012)*

org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table
undefined. tableName=PROD_METRICS

at
org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:336)

at
org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:236)

at
org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:159)

at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:318)

at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:308)

at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225)

at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:221)

at
org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:54)

at
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:221)

at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1059)

at sqlline.Commands.execute(Commands.java:822)

at sqlline.Commands.sql(Commands.java:732)

at sqlline.SqlLine.dispatch(SqlLine.java:808)

at sqlline.SqlLine.begin(SqlLine.java:681)

at sqlline.SqlLine.start(SqlLine.java:398)

at sqlline.SqlLine.main(SqlLine.java:292)

0: jdbc:phoenix:localhost> !tables

*+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*

*| **               TABLE_CAT                ** | **
TABLE_SCHEM               ** | **               TABLE_NAME               **
| **               TABLE_TYPE** |*

*+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*

*| *                                        * | *SYSTEM
             * | *CATALOG                                 * | *SYSTEM
TABLE             * |*

*| *                                        * | *SYSTEM
             * | *SEQUENCE                                * | *SYSTEM
TABLE             * |*

*| *                                        * | *SYSTEM
             * | *STATS                                   * | *SYSTEM
TABLE             * |*

*| *                                        * | *STATS
             * | *PROD_METRICS                            * | *TABLE
             * |*

*+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*


Can any one help??




-- 
*Regards*


*Vamshi*

Re: Table undefined error even though table exists

Posted by Christopher Tarnas <cf...@biotiquesystems.com>.
Hi Vamshi,

Phoenix is a layer on HBase and only sees tables that have been defined for Phoenix using DDL, those tables have entries in the SYSTEM.CATALOG table. Using !tables is a query against that table. 

HBase sees all tables. 

-chris

> On Jul 31, 2015, at 2:25 AM, Vamshi Krishna <va...@gmail.com> wrote:
> 
> The interesting thing is, if a table is created using phoenix, they are
> seen inside hbase shell. But, if a table is created using hbase shell, they
> are not seen using phoenix command line interface. I use ./sqlline.py
> localshost   where hbase is running in psuedo distributed mode with
> zookeepr at 2181.
> I am trying to see the list of tables on phoenix with command : !tables   ,
> Is it right or something am i missing?
> 
> 
> Why is this unexpected behavior?
> 
> On Fri, Jul 31, 2015 at 1:10 PM, Vamshi Krishna <va...@gmail.com>
> wrote:
> 
>> Whatever you have mentioned is correct. Thank you. But. when i do !tables,
>> already existing tables that were created before phoenix installed should
>> also be seen right ? Those tables are not seen here. And moreover, when i
>> create tables in hbase, i don't use any schema explicity such as 'stats' or
>> 'system'.
>> 
>> On Thu, Jul 30, 2015 at 9:40 PM, Ravi Kiran <ma...@gmail.com>
>> wrote:
>> 
>>> Hi Vamsi,
>>> 
>>>   Please give the full table name in select.
>>>  SELECT * FROM STATS.PROD_METRICS;
>>> 
>>> Regards
>>> Ravi
>>> 
>>> On Thu, Jul 30, 2015 at 6:33 AM, Vamshi Krishna <va...@gmail.com>
>>> wrote:
>>> 
>>>> Hi,
>>>> I am trying to access my hbase running on my local machine with
>>> zookeeper
>>>> at localhost:2181. I installed phoenix-3.3.1-bin and trying to access an
>>>> already existing hbase tabe, but could not. So, simply to test, i
>>> created a
>>>> table using phoenix commandline and see it when i run !tables command.
>>> but
>>>> when i run selet command, it shows error.
>>>> 
>>>> 
>>>> This is what I am doing.
>>>> 
>>>> 0: jdbc:phoenix:localhost> CREATE TABLE stats.prod_metrics ( host
>>> char(50)
>>>> not null, created_date date not null,
>>>> 
>>>> . . . . . . . . . . . . .>     txn_count bigint CONSTRAINT pk PRIMARY
>>> KEY
>>>> (host, created_date) );
>>>> 
>>>> No rows affected (1.82 seconds)
>>>> 
>>>> 0: jdbc:phoenix:localhost> !tables
>>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>>>> 
>>>> *| **               TABLE_CAT                ** | **
>>>> TABLE_SCHEM               ** | **               TABLE_NAME
>>> **
>>>> | **               TABLE_TYPE** |*
>>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>>>> 
>>>> *| *                                        * | *SYSTEM
>>>>             * | *CATALOG                                 * | *SYSTEM
>>>> TABLE             * |*
>>>> 
>>>> *| *                                        * | *SYSTEM
>>>>             * | *SEQUENCE                                * | *SYSTEM
>>>> TABLE             * |*
>>>> 
>>>> *| *                                        * | *SYSTEM
>>>>             * | *STATS                                   * | *SYSTEM
>>>> TABLE             * |*
>>>> 
>>>> *| *                                        * | *STATS
>>>>             * | *PROD_METRICS                            * | *TABLE
>>>>             * |*
>>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>>>> 
>>>> 0: jdbc:phoenix:localhost> select * from PROD_METRICS;
>>>> 
>>>> *Error: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS
>>>> (state=42M03,code=1012)*
>>>> 
>>>> org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03):
>>> Table
>>>> undefined. tableName=PROD_METRICS
>>>> 
>>>> at
>>> org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:336)
>>>> 
>>>> at
>>> org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:236)
>>>> 
>>>> at
>>> org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:159)
>>>> 
>>>> at
>>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:318)
>>>> 
>>>> at
>>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:308)
>>>> 
>>>> at
>>> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225)
>>>> 
>>>> at
>>> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:221)
>>>> 
>>>> at
>>> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:54)
>>>> 
>>>> at
>>> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:221)
>>>> 
>>>> at
>>> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1059)
>>>> 
>>>> at sqlline.Commands.execute(Commands.java:822)
>>>> 
>>>> at sqlline.Commands.sql(Commands.java:732)
>>>> 
>>>> at sqlline.SqlLine.dispatch(SqlLine.java:808)
>>>> 
>>>> at sqlline.SqlLine.begin(SqlLine.java:681)
>>>> 
>>>> at sqlline.SqlLine.start(SqlLine.java:398)
>>>> 
>>>> at sqlline.SqlLine.main(SqlLine.java:292)
>>>> 
>>>> 0: jdbc:phoenix:localhost> !tables
>>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>>>> 
>>>> *| **               TABLE_CAT                ** | **
>>>> TABLE_SCHEM               ** | **               TABLE_NAME
>>> **
>>>> | **               TABLE_TYPE** |*
>>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>>>> 
>>>> *| *                                        * | *SYSTEM
>>>>             * | *CATALOG                                 * | *SYSTEM
>>>> TABLE             * |*
>>>> 
>>>> *| *                                        * | *SYSTEM
>>>>             * | *SEQUENCE                                * | *SYSTEM
>>>> TABLE             * |*
>>>> 
>>>> *| *                                        * | *SYSTEM
>>>>             * | *STATS                                   * | *SYSTEM
>>>> TABLE             * |*
>>>> 
>>>> *| *                                        * | *STATS
>>>>             * | *PROD_METRICS                            * | *TABLE
>>>>             * |*
>>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>>>> 
>>>> 
>>>> Can any one help??
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> *Regards*
>>>> 
>>>> 
>>>> *Vamshi*
>> 
>> 
>> 
>> --
>> *Regards*
>> 
>> 
>> *Vamshi Krishna*
> 
> 
> 
> -- 
> *Regards*
> 
> 
> *Vamshi Krishna*

Re: Table undefined error even though table exists

Posted by Vamshi Krishna <va...@gmail.com>.
The interesting thing is, if a table is created using phoenix, they are
seen inside hbase shell. But, if a table is created using hbase shell, they
are not seen using phoenix command line interface. I use ./sqlline.py
localshost   where hbase is running in psuedo distributed mode with
zookeepr at 2181.
I am trying to see the list of tables on phoenix with command : !tables   ,
Is it right or something am i missing?


Why is this unexpected behavior?

On Fri, Jul 31, 2015 at 1:10 PM, Vamshi Krishna <va...@gmail.com>
wrote:

> Whatever you have mentioned is correct. Thank you. But. when i do !tables,
> already existing tables that were created before phoenix installed should
> also be seen right ? Those tables are not seen here. And moreover, when i
> create tables in hbase, i don't use any schema explicity such as 'stats' or
> 'system'.
>
> On Thu, Jul 30, 2015 at 9:40 PM, Ravi Kiran <ma...@gmail.com>
> wrote:
>
>> Hi Vamsi,
>>
>>    Please give the full table name in select.
>>   SELECT * FROM STATS.PROD_METRICS;
>>
>> Regards
>> Ravi
>>
>> On Thu, Jul 30, 2015 at 6:33 AM, Vamshi Krishna <va...@gmail.com>
>> wrote:
>>
>> > Hi,
>> >  I am trying to access my hbase running on my local machine with
>> zookeeper
>> > at localhost:2181. I installed phoenix-3.3.1-bin and trying to access an
>> > already existing hbase tabe, but could not. So, simply to test, i
>> created a
>> > table using phoenix commandline and see it when i run !tables command.
>> but
>> > when i run selet command, it shows error.
>> >
>> >
>> > This is what I am doing.
>> >
>> > 0: jdbc:phoenix:localhost> CREATE TABLE stats.prod_metrics ( host
>> char(50)
>> > not null, created_date date not null,
>> >
>> > . . . . . . . . . . . . .>     txn_count bigint CONSTRAINT pk PRIMARY
>> KEY
>> > (host, created_date) );
>> >
>> > No rows affected (1.82 seconds)
>> >
>> > 0: jdbc:phoenix:localhost> !tables
>> >
>> >
>> >
>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>> >
>> > *| **               TABLE_CAT                ** | **
>> > TABLE_SCHEM               ** | **               TABLE_NAME
>>  **
>> > | **               TABLE_TYPE** |*
>> >
>> >
>> >
>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>> >
>> > *| *                                        * | *SYSTEM
>> >              * | *CATALOG                                 * | *SYSTEM
>> > TABLE             * |*
>> >
>> > *| *                                        * | *SYSTEM
>> >              * | *SEQUENCE                                * | *SYSTEM
>> > TABLE             * |*
>> >
>> > *| *                                        * | *SYSTEM
>> >              * | *STATS                                   * | *SYSTEM
>> > TABLE             * |*
>> >
>> > *| *                                        * | *STATS
>> >              * | *PROD_METRICS                            * | *TABLE
>> >              * |*
>> >
>> >
>> >
>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>> >
>> > 0: jdbc:phoenix:localhost> select * from PROD_METRICS;
>> >
>> > *Error: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS
>> > (state=42M03,code=1012)*
>> >
>> > org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03):
>> Table
>> > undefined. tableName=PROD_METRICS
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:336)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:236)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:159)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:318)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:308)
>> >
>> > at
>> >
>> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225)
>> >
>> > at
>> >
>> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:221)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:54)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:221)
>> >
>> > at
>> >
>> >
>> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1059)
>> >
>> > at sqlline.Commands.execute(Commands.java:822)
>> >
>> > at sqlline.Commands.sql(Commands.java:732)
>> >
>> > at sqlline.SqlLine.dispatch(SqlLine.java:808)
>> >
>> > at sqlline.SqlLine.begin(SqlLine.java:681)
>> >
>> > at sqlline.SqlLine.start(SqlLine.java:398)
>> >
>> > at sqlline.SqlLine.main(SqlLine.java:292)
>> >
>> > 0: jdbc:phoenix:localhost> !tables
>> >
>> >
>> >
>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>> >
>> > *| **               TABLE_CAT                ** | **
>> > TABLE_SCHEM               ** | **               TABLE_NAME
>>  **
>> > | **               TABLE_TYPE** |*
>> >
>> >
>> >
>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>> >
>> > *| *                                        * | *SYSTEM
>> >              * | *CATALOG                                 * | *SYSTEM
>> > TABLE             * |*
>> >
>> > *| *                                        * | *SYSTEM
>> >              * | *SEQUENCE                                * | *SYSTEM
>> > TABLE             * |*
>> >
>> > *| *                                        * | *SYSTEM
>> >              * | *STATS                                   * | *SYSTEM
>> > TABLE             * |*
>> >
>> > *| *                                        * | *STATS
>> >              * | *PROD_METRICS                            * | *TABLE
>> >              * |*
>> >
>> >
>> >
>> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>> >
>> >
>> > Can any one help??
>> >
>> >
>> >
>> >
>> > --
>> > *Regards*
>> >
>> >
>> > *Vamshi*
>> >
>>
>
>
>
> --
> *Regards*
>
>
> *Vamshi Krishna*
>



-- 
*Regards*


*Vamshi Krishna*

Re: Table undefined error even though table exists

Posted by Vamshi Krishna <va...@gmail.com>.
Whatever you have mentioned is correct. Thank you. But. when i do !tables,
already existing tables that were created before phoenix installed should
also be seen right ? Those tables are not seen here. And moreover, when i
create tables in hbase, i don't use any schema explicity such as 'stats' or
'system'.

On Thu, Jul 30, 2015 at 9:40 PM, Ravi Kiran <ma...@gmail.com>
wrote:

> Hi Vamsi,
>
>    Please give the full table name in select.
>   SELECT * FROM STATS.PROD_METRICS;
>
> Regards
> Ravi
>
> On Thu, Jul 30, 2015 at 6:33 AM, Vamshi Krishna <va...@gmail.com>
> wrote:
>
> > Hi,
> >  I am trying to access my hbase running on my local machine with
> zookeeper
> > at localhost:2181. I installed phoenix-3.3.1-bin and trying to access an
> > already existing hbase tabe, but could not. So, simply to test, i
> created a
> > table using phoenix commandline and see it when i run !tables command.
> but
> > when i run selet command, it shows error.
> >
> >
> > This is what I am doing.
> >
> > 0: jdbc:phoenix:localhost> CREATE TABLE stats.prod_metrics ( host
> char(50)
> > not null, created_date date not null,
> >
> > . . . . . . . . . . . . .>     txn_count bigint CONSTRAINT pk PRIMARY KEY
> > (host, created_date) );
> >
> > No rows affected (1.82 seconds)
> >
> > 0: jdbc:phoenix:localhost> !tables
> >
> >
> >
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
> >
> > *| **               TABLE_CAT                ** | **
> > TABLE_SCHEM               ** | **               TABLE_NAME
>  **
> > | **               TABLE_TYPE** |*
> >
> >
> >
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
> >
> > *| *                                        * | *SYSTEM
> >              * | *CATALOG                                 * | *SYSTEM
> > TABLE             * |*
> >
> > *| *                                        * | *SYSTEM
> >              * | *SEQUENCE                                * | *SYSTEM
> > TABLE             * |*
> >
> > *| *                                        * | *SYSTEM
> >              * | *STATS                                   * | *SYSTEM
> > TABLE             * |*
> >
> > *| *                                        * | *STATS
> >              * | *PROD_METRICS                            * | *TABLE
> >              * |*
> >
> >
> >
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
> >
> > 0: jdbc:phoenix:localhost> select * from PROD_METRICS;
> >
> > *Error: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS
> > (state=42M03,code=1012)*
> >
> > org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03):
> Table
> > undefined. tableName=PROD_METRICS
> >
> > at
> >
> >
> org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:336)
> >
> > at
> >
> >
> org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:236)
> >
> > at
> >
> >
> org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:159)
> >
> > at
> >
> >
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:318)
> >
> > at
> >
> >
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:308)
> >
> > at
> >
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225)
> >
> > at
> >
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:221)
> >
> > at
> >
> >
> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:54)
> >
> > at
> >
> >
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:221)
> >
> > at
> >
> >
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1059)
> >
> > at sqlline.Commands.execute(Commands.java:822)
> >
> > at sqlline.Commands.sql(Commands.java:732)
> >
> > at sqlline.SqlLine.dispatch(SqlLine.java:808)
> >
> > at sqlline.SqlLine.begin(SqlLine.java:681)
> >
> > at sqlline.SqlLine.start(SqlLine.java:398)
> >
> > at sqlline.SqlLine.main(SqlLine.java:292)
> >
> > 0: jdbc:phoenix:localhost> !tables
> >
> >
> >
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
> >
> > *| **               TABLE_CAT                ** | **
> > TABLE_SCHEM               ** | **               TABLE_NAME
>  **
> > | **               TABLE_TYPE** |*
> >
> >
> >
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
> >
> > *| *                                        * | *SYSTEM
> >              * | *CATALOG                                 * | *SYSTEM
> > TABLE             * |*
> >
> > *| *                                        * | *SYSTEM
> >              * | *SEQUENCE                                * | *SYSTEM
> > TABLE             * |*
> >
> > *| *                                        * | *SYSTEM
> >              * | *STATS                                   * | *SYSTEM
> > TABLE             * |*
> >
> > *| *                                        * | *STATS
> >              * | *PROD_METRICS                            * | *TABLE
> >              * |*
> >
> >
> >
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
> >
> >
> > Can any one help??
> >
> >
> >
> >
> > --
> > *Regards*
> >
> >
> > *Vamshi*
> >
>



-- 
*Regards*


*Vamshi Krishna*

Re: Table undefined error even though table exists

Posted by Ravi Kiran <ma...@gmail.com>.
Hi Vamsi,

   Please give the full table name in select.
  SELECT * FROM STATS.PROD_METRICS;

Regards
Ravi

On Thu, Jul 30, 2015 at 6:33 AM, Vamshi Krishna <va...@gmail.com>
wrote:

> Hi,
>  I am trying to access my hbase running on my local machine with zookeeper
> at localhost:2181. I installed phoenix-3.3.1-bin and trying to access an
> already existing hbase tabe, but could not. So, simply to test, i created a
> table using phoenix commandline and see it when i run !tables command. but
> when i run selet command, it shows error.
>
>
> This is what I am doing.
>
> 0: jdbc:phoenix:localhost> CREATE TABLE stats.prod_metrics ( host char(50)
> not null, created_date date not null,
>
> . . . . . . . . . . . . .>     txn_count bigint CONSTRAINT pk PRIMARY KEY
> (host, created_date) );
>
> No rows affected (1.82 seconds)
>
> 0: jdbc:phoenix:localhost> !tables
>
>
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>
> *| **               TABLE_CAT                ** | **
> TABLE_SCHEM               ** | **               TABLE_NAME               **
> | **               TABLE_TYPE** |*
>
>
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>
> *| *                                        * | *SYSTEM
>              * | *CATALOG                                 * | *SYSTEM
> TABLE             * |*
>
> *| *                                        * | *SYSTEM
>              * | *SEQUENCE                                * | *SYSTEM
> TABLE             * |*
>
> *| *                                        * | *SYSTEM
>              * | *STATS                                   * | *SYSTEM
> TABLE             * |*
>
> *| *                                        * | *STATS
>              * | *PROD_METRICS                            * | *TABLE
>              * |*
>
>
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>
> 0: jdbc:phoenix:localhost> select * from PROD_METRICS;
>
> *Error: ERROR 1012 (42M03): Table undefined. tableName=PROD_METRICS
> (state=42M03,code=1012)*
>
> org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table
> undefined. tableName=PROD_METRICS
>
> at
>
> org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:336)
>
> at
>
> org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:236)
>
> at
>
> org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:159)
>
> at
>
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:318)
>
> at
>
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:308)
>
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:225)
>
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:221)
>
> at
>
> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:54)
>
> at
>
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:221)
>
> at
>
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1059)
>
> at sqlline.Commands.execute(Commands.java:822)
>
> at sqlline.Commands.sql(Commands.java:732)
>
> at sqlline.SqlLine.dispatch(SqlLine.java:808)
>
> at sqlline.SqlLine.begin(SqlLine.java:681)
>
> at sqlline.SqlLine.start(SqlLine.java:398)
>
> at sqlline.SqlLine.main(SqlLine.java:292)
>
> 0: jdbc:phoenix:localhost> !tables
>
>
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>
> *| **               TABLE_CAT                ** | **
> TABLE_SCHEM               ** | **               TABLE_NAME               **
> | **               TABLE_TYPE** |*
>
>
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>
> *| *                                        * | *SYSTEM
>              * | *CATALOG                                 * | *SYSTEM
> TABLE             * |*
>
> *| *                                        * | *SYSTEM
>              * | *SEQUENCE                                * | *SYSTEM
> TABLE             * |*
>
> *| *                                        * | *SYSTEM
>              * | *STATS                                   * | *SYSTEM
> TABLE             * |*
>
> *| *                                        * | *STATS
>              * | *PROD_METRICS                            * | *TABLE
>              * |*
>
>
> *+------------------------------------------+------------------------------------------+------------------------------------------+---------------------------+*
>
>
> Can any one help??
>
>
>
>
> --
> *Regards*
>
>
> *Vamshi*
>