Jain,

First off, you did receive row data, it was just empty: "firstFrame":{"offset":0,"done":true,"rows":[]} The "column data" you're referring to is the _schema_ of the table you issued the query against.

However, this wasn't the data you thought you were asking for. You don't want to use the "prepare" request, but the "prepareAndExecute" request. You didn't get any data because no query was actually executed. The paradigm with "prepare" and "execute" is similar to the JDBC methods (prepare one query with unbound parameters, and execute many queries against it). "prepareAndExecute" accepts an explicit query string, runs that query, and returns the results.

If you are trying to build your own driver, please be prepared to invest time in understanding how the protocol works. This will require a fair bit of effort on your side. If you follow through, please do share the results as I'm sure others would benefit from a PHP Avatica driver.

- Josh

On 5/31/17 2:48 AM, Hemant Jain wrote:
Hello Sir,

Hope you are doing well !

I am PHP developer and I want to fetch the real time data from Hbase and I
have read about Apache phoenix which is provide SQL layer on Hbase.

So I have decided to use Apache phoenix in my project but  how can I get
data from phoenix to PHP. I have read artical  about  Apache Avatica which
support json request and response. I have tried to fetch data using json
request but only I am getting column data of table not row data. Is it
support but avatica or not ?

Please find my request and response.

*Refer Document*

https://calcite.apache.org/avatica

*Request Data *

$headers[] = 'request: {"request": "prepare","connectionId": "1","sql":
"select count(*) from \"users_data\"","maxRowCount": 1}';

*Response Data :*

{"response":"executeResults","missingStatement":false,"rpcMetadata":{"response":"rpcMetadata","serverAddress":"c6401.ambari.apache.org:8765"},"results":[{"response":"resultSet","connectionId":"1","statementId":35,"ownStatement":true,"signature":{"columns":[{"ordinal":0,"autoIncrement":false,"caseSensitive":false,"searchable":true,"currency":false,"nullable":0,"signed":false,"displaySize":40,"label":"ROWKEY","columnName":"ROWKEY","schemaName":"","precision":0,"scale":0,"tableName":"users_data","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"},{"ordinal":1,"autoIncrement":false,"caseSensitive":true,"searchable":true,"currency":false,"nullable":1,"signed":false,"displaySize":40,"label":"firstName","columnName":"firstName","schemaName":"","precision":0,"scale":0,"tableName":"users_data","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"},{"ordinal":2,"autoIncrement":false,"caseSensitive":true,"searchable":true,"currency":false,"nullable":1,"signed":false,"displaySize":40,"label":"lastName","columnName":"lastName","schemaName":"","precision":0,"scale":0,"tableName":"users_data","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"},{"ordinal":3,"autoIncrement":false,"caseSensitive":true,"searchable":true,"currency":false,"nullable":1,"signed":false,"displaySize":40,"label":"gender","columnName":"gender","schemaName":"","precision":0,"scale":0,"tableName":"users_data","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"},{"ordinal":4,"autoIncrement":false,"caseSensitive":true,"searchable":true,"currency":false,"nullable":1,"signed":false,"displaySize":40,"label":"mail","columnName":"mail","schemaName":"","precision":0,"scale":0,"tableName":"users_data","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"},{"ordinal":5,"autoIncrement":false,"caseSensitive":true,"searchable":true,"currency":false,"nullable":1,"signed":false,"displaySize":40,"label":"mobile","columnName":"mobile","schemaName":"","precision":0,"scale":0,"tableName":"users_data","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"}],"sql":null,"parameters":[],"cursorFactory":{"style":"LIST","clazz":null,"fieldNames":null},"statementType":null},"firstFrame":{"offset":0,"done":true,"rows":[]},"updateCount":-1,"rpcMetadata":{"response":"rpcMetadata","serverAddress":"c6401.ambari.apache.org:8765"}}]}

I can only able to see table column data but not row data.

Could you suggest me I am using right way to fetch data from Hbase to PHP
if yes then could help me where I am doing wrong.

Thanks in Advance.


Let me know your concerns.

Thanks,
Jain Hemant

Reply via email to