Re: Undefined column. columnName=IS_ROW_TIMESTAMP

2016-04-13 Thread Pindi, Srinivas
Yes.

On Apr 13, 2016, at 5:26 PM, Samarth Jain 
> wrote:

Srinivas,

Are you trying to create a phoenix view over an existing HBase table?

On Wed, Apr 13, 2016 at 11:47 AM, Pindi, Srinivas 
> wrote:

Problem Statement:

While we are trying to create a phoenix view and we are getting the following 
exception.



When I looked at the source code here is what I found:



if (currentServerSideTableTimeStamp < 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0) {

columnsToAdd += PhoenixDatabaseMetaData.IS_ROW_TIMESTAMP + " " + 
PBoolean.INSTANCE.getSqlTypeName();

}



Version:

Serverphoenix-4.6.1-HBase-1.0-1.17.0.21

Client phoenix-4.6.1-HBase-1.0-1.17.0.21



Error:

Caused by: java.sql.SQLException: Error running CREATE VIEW XYZ  ("A" VARCHAR, 
"B" VARCHAR) AS SELECT * FROM HBASE_TABLE_1 WHERE (KEY  >= '0-02UsG-0' AND KEY  
<= '0-02UsG-g') AND UPDATED_DATE IS NOT NULL

…

…

... 90 more

Caused by: org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 
(42703): Undefined column. columnName=IS_ROW_TIMESTAMP

at org.apache.phoenix.schema.PTableImpl.getColumn(PTableImpl.java:647)

at 
org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.resolveColumn(FromCompiler.java:361)

at 
org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:386)

at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:553)

at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:541)

at 
org.apache.phoenix.jdbc.PhoenixPreparedStatement.getParameterMetaData(PhoenixPreparedStatement.java:246)

at 
org.apache.phoenix.schema.MetaDataClient.addColumnMutation(MetaDataClient.java:707)

at 
org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:1943)





This e-mail and files transmitted with it are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not the intended recipient, or the employee or agent 
responsible to deliver it to the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you are not one of the named recipient(s) or otherwise 
have reason to believe that you received this message in error, please 
immediately notify sender by e-mail, and destroy the original message. Thank 
You.




This e-mail and files transmitted with it are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not the intended recipient, or the employee or agent 
responsible to deliver it to the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you are not one of the named recipient(s) or otherwise 
have reason to believe that you received this message in error, please 
immediately notify sender by e-mail, and destroy the original message. Thank 
You.


Re: Undefined column. columnName=IS_ROW_TIMESTAMP

2016-04-13 Thread Samarth Jain
Srinivas,

Are you trying to create a phoenix view over an existing HBase table?

On Wed, Apr 13, 2016 at 11:47 AM, Pindi, Srinivas <
srinivas.pi...@epsilon.com> wrote:

> *Problem* *Statement*:
>
> While we are trying to create a phoenix view and we are getting the
> following exception.
>
>
>
> When I looked at the source code here is what I found:
>
>
>
> if (currentServerSideTableTimeStamp <
> MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0) {
>
> columnsToAdd += PhoenixDatabaseMetaData.IS_ROW_TIMESTAMP + " " +
> PBoolean.INSTANCE.getSqlTypeName();
>
> }
>
>
>
> *Version*:
>
> Serverphoenix-4.6.1-HBase-1.0-1.17.0.21
>
> Client phoenix-4.6.1-HBase-1.0-1.17.0.21
>
>
>
> *Error*:
>
> Caused by: java.sql.SQLException: Error running CREATE VIEW XYZ  ("A"
> VARCHAR, "B" VARCHAR) AS SELECT * FROM HBASE_TABLE_1 WHERE (KEY  >=
> '0-02UsG-0' AND KEY  <= '0-02UsG-g') AND UPDATED_DATE IS NOT NULL
>
> …
>
> …
>
> ... 90 more
>
> Caused by: org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504
> (42703): Undefined column. columnName=IS_ROW_TIMESTAMP
>
> at
> org.apache.phoenix.schema.PTableImpl.getColumn(PTableImpl.java:647)
>
> at
> org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.resolveColumn(FromCompiler.java:361)
>
> at
> org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:386)
>
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:553)
>
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:541)
>
> at
> org.apache.phoenix.jdbc.PhoenixPreparedStatement.getParameterMetaData(PhoenixPreparedStatement.java:246)
>
> at
> org.apache.phoenix.schema.MetaDataClient.addColumnMutation(MetaDataClient.java:707)
>
> at
> org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:1943)
>
>
>
>
>
> --
>
> This e-mail and files transmitted with it are confidential, and are
> intended solely for the use of the individual or entity to whom this e-mail
> is addressed. If you are not the intended recipient, or the employee or
> agent responsible to deliver it to the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you are not one of the named
> recipient(s) or otherwise have reason to believe that you received this
> message in error, please immediately notify sender by e-mail, and destroy
> the original message. Thank You.
>


Apache Phoenix + Wildfly 10

2016-04-13 Thread marks1900-post01

I am working on integrating Widlfly 10 and Apache Phoenix, and while the 
following seems to work, though it would be great if someone could give me 
feedback.

I have been using the instructions as outlined here as inspiration:  
https://docs.jboss.org/author/display/TEIID/Phoenix+Data+Sources



Environment:  
Ambari  2.2.1.0
HDFS  2.7.1.2.4MapReduce2  2.7.1.2.4YARN  2.7.1.2.4
HBase  1.1.2.2.4
Wildfly 10.0.0.Final

Configuration:
* My Wildfly module.xml ( 
wildfly-10.0.0.Final/modules/org/apache/phoenix/main/module.xml ) uses the 
Ambari HDP distribution of the Phoenix client 
(/usr/hdp/2.3.4.0-3485/phoenix/phoenix-4.4.0.2.3.4.0-3485-client.jar).

Wildfly Cli Commands:

| module add --name=org.apache.phoenix  
--resources=/path/to/phoenix-4.4.0.2.4.0.0-169-client.jar 
--dependencies=javax.api,sun.jdk,org.apache.log4j,javax.transaction.api
/subsystem=datasources/jdbc-driver=phoenix:add(driver-name=phoenix,driver-module-name=org.apache.phoenix,driver-class-name=org.apache.phoenix.jdbc.PhoenixDriver)
 |


# Then manually modified "module.xml". See below.
/subsystem=datasources/data-source=PhoenixDS:add(jndi-name=java:jboss/datasources/PhoenixDS,
  driver-name=phoenix, connection-url=jdbc:phoenix:server01:/hbase-unsecure, 
enabled=true, use-java-context=true)
/subsystem=datasources/data-source=PhoenixDS/connection-properties=phoenix.connection.autoCommit:add(value=true)
# Then manually modified "standalone-full.xml". See below.



wildfly-10.0.0.Final/modules/org/apache/phoenix/main/module.xml--

                    
    
                                                --
wildfly-10.0.0.Final/standalone/configuration/standalone-full.xml

--
... 
jdbc:phoenix:server01:/hbase-unsecure 
 true 
 phoenix  
SELECT 1 FROM SYSTEM.CATALOG LIMIT 
1 ...--

Other Notes:
I am able to connect to Apache Phoenix with the following command.
/usr/hdp/2.4.0.0-169/phoenix/bin/sqlline.py server01:/hbase-unsecure






  

Re: Flashback queries support in select statement

2016-04-13 Thread James Taylor
Hi Kannan,
The only mechanism available is the one you mentioned:
https://phoenix.apache.org/faq.html#Can_phoenix_work_on_tables_with_arbitrary_timestamp_as_flexible_as_HBase_API

FWIW, opening a new connection is only creating a few Java objects, so
there's no real overhead in just opening a new connection.

The number of versions is controlled by the regular HBase VERSIONS
parameter specified at CREATE TABLE or ALTER TABLE. The cost would be due
to actually having many versions (i.e. more data to scan over), but not
with the declaration of how many versions you'd like to keep.

Thanks,
James

On Wed, Apr 13, 2016 at 3:01 PM,  wrote:

> Any help?
>
>
>
> *From:* Ramanathan, Kannan: IT (NYK)
> *Sent:* Wednesday, April 13, 2016 15:19
> *To:* user@phoenix.apache.org
> *Subject:* Flashback queries support in select statement
>
>
>
> Hi,
>
>
>
> Is flashback query (queries to look at the state of a record in the past)
> supported in select statement? I understand it can be done during JDBC
> connection creation. I am checking something like this is available:
>
>
>
> select ‘as-of:2016-04-13’ * from TABLE;
>
>
>
> Also, is there any maximum limit on versions options in create statement?
> Just by virtue of having higher version number in the table (even if there
> aren’t that many version records stored) will there be any performance
> impact?
>
>
>
> Thanks in advance,
>
> Kannan.
>
> ___
>
> This message is for information purposes only, it is not a recommendation,
> advice, offer or solicitation to buy or sell a product or service nor an
> official confirmation of any transaction. It is directed at persons who are
> professionals and is not intended for retail customer use. Intended for
> recipient only. This message is subject to the terms at:
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see:
> www.barclays.com/salesandtradingdisclaimer regarding market commentary
> from Barclays Sales and/or Trading, who are active market participants; and
> in respect of Barclays Research, including disclosures relating to specific
> issuers, please see http://publicresearch.barclays.com.
>
> ___
>
> ___
>
> This message is for information purposes only, it is not a recommendation,
> advice, offer or solicitation to buy or sell a product or service nor an
> official confirmation of any transaction. It is directed at persons who are
> professionals and is not intended for retail customer use. Intended for
> recipient only. This message is subject to the terms at:
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see:
> www.barclays.com/salesandtradingdisclaimer regarding market commentary
> from Barclays Sales and/or Trading, who are active market participants; and
> in respect of Barclays Research, including disclosures relating to specific
> issuers, please see http://publicresearch.barclays.com.
>
> ___
>


RE: Flashback queries support in select statement

2016-04-13 Thread kannan.ramanathan
Any help?

From: Ramanathan, Kannan: IT (NYK)
Sent: Wednesday, April 13, 2016 15:19
To: user@phoenix.apache.org
Subject: Flashback queries support in select statement

Hi,

Is flashback query (queries to look at the state of a record in the past) 
supported in select statement? I understand it can be done during JDBC 
connection creation. I am checking something like this is available:

select 'as-of:2016-04-13' * from TABLE;

Also, is there any maximum limit on versions options in create statement? Just 
by virtue of having higher version number in the table (even if there aren't 
that many version records stored) will there be any performance impact?

Thanks in advance,
Kannan.

___

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer
 regarding market commentary from Barclays Sales and/or Trading, who are active 
market participants; and in respect of Barclays Research, including disclosures 
relating to specific issuers, please see http://publicresearch.barclays.com.

___

___

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
Barclays Sales and/or Trading, who are active market participants; and in 
respect of Barclays Research, including disclosures relating to specific 
issuers, please see http://publicresearch.barclays.com.

___


Undefined column. columnName=IS_ROW_TIMESTAMP

2016-04-13 Thread Pindi, Srinivas
Problem Statement:

While we are trying to create a phoenix view and we are getting the following 
exception.



When I looked at the source code here is what I found:



if (currentServerSideTableTimeStamp < 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0) {

columnsToAdd += PhoenixDatabaseMetaData.IS_ROW_TIMESTAMP + " " + 
PBoolean.INSTANCE.getSqlTypeName();

}



Version:

Serverphoenix-4.6.1-HBase-1.0-1.17.0.21

Client phoenix-4.6.1-HBase-1.0-1.17.0.21



Error:

Caused by: java.sql.SQLException: Error running CREATE VIEW XYZ  ("A" VARCHAR, 
"B" VARCHAR) AS SELECT * FROM HBASE_TABLE_1 WHERE (KEY  >= '0-02UsG-0' AND KEY  
<= '0-02UsG-g') AND UPDATED_DATE IS NOT NULL

...

...

... 90 more

Caused by: org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 
(42703): Undefined column. columnName=IS_ROW_TIMESTAMP

at org.apache.phoenix.schema.PTableImpl.getColumn(PTableImpl.java:647)

at 
org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.resolveColumn(FromCompiler.java:361)

at 
org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:386)

at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:553)

at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:541)

at 
org.apache.phoenix.jdbc.PhoenixPreparedStatement.getParameterMetaData(PhoenixPreparedStatement.java:246)

at 
org.apache.phoenix.schema.MetaDataClient.addColumnMutation(MetaDataClient.java:707)

at 
org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:1943)





This e-mail and files transmitted with it are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not the intended recipient, or the employee or agent 
responsible to deliver it to the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you are not one of the named recipient(s) or otherwise 
have reason to believe that you received this message in error, please 
immediately notify sender by e-mail, and destroy the original message. Thank 
You.


Re: apache phoenix json api

2016-04-13 Thread Josh Elser
For reference materials: definitely check out 
https://calcite.apache.org/avatica/


While JSON is easy to get started with, there are zero guarantees on 
compatibility between versions. If you use protobuf, we should be able 
to hide all schema drift from you as a client (e.g. applications you 
write against Phoenix 4.7 should continue to work against 4.8, 4.9, etc).


Good luck with the PHP client -- feel free to reach out if you have more 
issues. Let us know you have something to shared. I'm sure others would 
also find it very useful.


F21 wrote:

I am currently building a golang client as well, so I've been looking
the api over the last few weeks.

I am not sure about the decision to have to create a statement first,
but in terms of go, it fits the sql package very well, where statements
are opened and closed.

I don't think there are any books (as of yet), but the references and
digging through the code should be quite useful. I also recommend
checking out the avatica project (which is a sub project of calcite)
which is used to power the query server.

Also, the query server uses protobufs by default now, so it would
probably be better to use that rather than the JSON api.

On 13/04/2016 10:21 PM, Plamen Paskov wrote:

thanks for your quick and accurate answer ! it's working now!
can you give me a brief explanation of why is it to mantain the state
via the json api so i can better understand how to create a php
wrapper library. if there are some books or references where i can
read more about apache phoenix will be very helpful.
thanks

On 13.04.2016 13:29, F21 wrote:

Your PrepareAndExecute request is missing a statementId:
https://calcite.apache.org/docs/avatica_json_reference.html#prepareandexecuterequest


Before calling PrepareAndExecute, you need to send a CreateStatement
request to the server so that it can give you a statementId. Then,
use that statementId in your PrepareAndExecute request and all should
be fine :)


On 13/04/2016 8:24 PM, Plamen Paskov wrote:

Hi guys,
I just setup apache phoenix 4.7 and set the serialization to JSON.
Now i'm trying to run a select statement but what i receive is this:

{
"response": "executeResults",
"missingStatement": true,
"rpcMetadata": {
"response": "rpcMetadata",
"serverAddress": "ip-172-31-27-198:8765"
},
"results": null
}

My request looks like this:

curl -XPOST -H 'request: {"request":"prepareAndExecute",
"connectionId":"1", "sql":"select * from us_population",
"maxRowCount":-1}' http://52.31.63.96:8765/

Running the select above from the command line is fine and it
returns 2 rows :

sqlline version 1.1.8
0: jdbc:phoenix:localhost> select * from us_population;
+---+--+--+

| STATE | CITY | POPULATION |
+---+--+--+

| CA | Los Angeles | 3844829 |
| NY | New York | 8143197 |
+---+--+--+

2 rows selected (0.087 seconds)

Can you give me some direction what i'm doing wrong as i'm not java
dev and it's not possible for me to read and understand the source
code.

Thanks in advance !








Using transaction in custom coprocessor

2016-04-13 Thread Mohammad Adnan Raza
Hello everyone,

I have requirement to use transaction in my project. My requirement is - a
client starts transaction and do some upsert operation. I'll have a
coprocessor that will do few more puts. Now what I want is all these
operation should go in single transaction. Meaning if client rollbacks her
transaction my puts in coprocessor should also get rolledback.

My question is . is it possible to use transaction started in client in
coprocessors?


-- 

*With Best Regards,*

*   Mohammad Adnan*


Re: apache phoenix json api

2016-04-13 Thread F21
I am currently building a golang client as well, so I've been looking 
the api over the last few weeks.


I am not sure about the decision to have to create a statement first, 
but in terms of go, it fits the sql package very well, where statements 
are opened and closed.


I don't think there are any books (as of yet), but the references and 
digging through the code should be quite useful. I also recommend 
checking out the avatica project (which is a sub project of calcite) 
which is used to power the query server.


Also, the query server uses protobufs by default now, so it would 
probably be better to use that rather than the JSON api.


On 13/04/2016 10:21 PM, Plamen Paskov wrote:

thanks for your quick and accurate answer ! it's working now!
can you give me a brief explanation of why is it to mantain the state 
via the json api so i can better understand how to create a php 
wrapper library. if there are some books or references where i can 
read more about apache phoenix will be very helpful.

thanks

On 13.04.2016 13:29, F21 wrote:
Your PrepareAndExecute request is missing a statementId: 
https://calcite.apache.org/docs/avatica_json_reference.html#prepareandexecuterequest


Before calling PrepareAndExecute, you need to send a CreateStatement 
request to the server so that it can give you a statementId. Then, 
use that statementId in your PrepareAndExecute request and all should 
be fine :)



On 13/04/2016 8:24 PM, Plamen Paskov wrote:

Hi guys,
I just setup apache phoenix 4.7 and set the serialization to JSON. 
Now i'm trying to run a select statement but what i receive is this:


{
  "response": "executeResults",
  "missingStatement": true,
  "rpcMetadata": {
"response": "rpcMetadata",
"serverAddress": "ip-172-31-27-198:8765"
  },
  "results": null
}

My request looks like this:

curl -XPOST -H 'request: {"request":"prepareAndExecute", 
"connectionId":"1", "sql":"select * from us_population", 
"maxRowCount":-1}' http://52.31.63.96:8765/


Running the select above from the command line is fine and it 
returns 2 rows :


sqlline version 1.1.8
0: jdbc:phoenix:localhost> select * from us_population;
+---+--+--+ 

| STATE |   CITY   | 
POPULATION|
+---+--+--+ 

| CA| Los Angeles  | 
3844829  |
| NY| New York | 
8143197  |
+---+--+--+ 


2 rows selected (0.087 seconds)

Can you give me some direction what i'm doing wrong as i'm not java 
dev and it's not possible for me to read and understand the source 
code.


Thanks in advance !








Re: apache phoenix json api

2016-04-13 Thread F21
Your PrepareAndExecute request is missing a statementId: 
https://calcite.apache.org/docs/avatica_json_reference.html#prepareandexecuterequest


Before calling PrepareAndExecute, you need to send a CreateStatement 
request to the server so that it can give you a statementId. Then, use 
that statementId in your PrepareAndExecute request and all should be fine :)



On 13/04/2016 8:24 PM, Plamen Paskov wrote:

Hi guys,
I just setup apache phoenix 4.7 and set the serialization to JSON. Now 
i'm trying to run a select statement but what i receive is this:


{
  "response": "executeResults",
  "missingStatement": true,
  "rpcMetadata": {
"response": "rpcMetadata",
"serverAddress": "ip-172-31-27-198:8765"
  },
  "results": null
}

My request looks like this:

curl -XPOST -H 'request: {"request":"prepareAndExecute", 
"connectionId":"1", "sql":"select * from us_population", 
"maxRowCount":-1}' http://52.31.63.96:8765/


Running the select above from the command line is fine and it returns 
2 rows :


sqlline version 1.1.8
0: jdbc:phoenix:localhost> select * from us_population;
+---+--+--+ 

| STATE |   CITY   | 
POPULATION|
+---+--+--+ 

| CA| Los Angeles  | 
3844829  |
| NY| New York | 
8143197  |
+---+--+--+ 


2 rows selected (0.087 seconds)

Can you give me some direction what i'm doing wrong as i'm not java 
dev and it's not possible for me to read and understand the source code.


Thanks in advance !




apache phoenix json api

2016-04-13 Thread Plamen Paskov

Hi guys,
I just setup apache phoenix 4.7 and set the serialization to JSON. Now 
i'm trying to run a select statement but what i receive is this:


{
  "response": "executeResults",
  "missingStatement": true,
  "rpcMetadata": {
"response": "rpcMetadata",
"serverAddress": "ip-172-31-27-198:8765"
  },
  "results": null
}

My request looks like this:

curl -XPOST -H 'request: {"request":"prepareAndExecute", 
"connectionId":"1", "sql":"select * from us_population", 
"maxRowCount":-1}' http://52.31.63.96:8765/


Running the select above from the command line is fine and it returns 2 
rows :


sqlline version 1.1.8
0: jdbc:phoenix:localhost> select * from us_population;
+---+--+--+
| STATE |   CITY   | 
POPULATION|

+---+--+--+
| CA| Los Angeles  | 
3844829  |
| NY| New York | 
8143197  |

+---+--+--+
2 rows selected (0.087 seconds)

Can you give me some direction what i'm doing wrong as i'm not java dev 
and it's not possible for me to read and understand the source code.


Thanks in advance !