Apache Phoenix - Timeout crawler - Build https://builds.apache.org/job/Phoenix-master/1965/

2018-03-21 Thread Apache Jenkins Server
[...truncated 59 lines...]

Apache-Phoenix | 4.x-HBase-1.1 | Build Successful

2018-03-21 Thread Apache Jenkins Server
4.x-HBase-1.1 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf?p=phoenix.git;a=shortlog;h=refs/heads/4.x-HBase-1.1

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.x-HBase-1.1/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.x-HBase-1.1/lastCompletedBuild/testReport/

Changes
[elserj] PHOENIX-4636 Add the python PQS driver



Build times for last couple of runsLatest build time is the right most | Legend blue: normal, red: test failure, gray: timeout


Build failed in Jenkins: Phoenix-4.x-HBase-1.2 #298

2018-03-21 Thread Apache Jenkins Server
See 


Changes:

[elserj] PHOENIX-4636 Add the python PQS driver

--
[...truncated 156.84 KB...]
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:7873)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2008)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:1990)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33652)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2188)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133)
at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108)
at java.lang.Thread.run(Thread.java:745)

at 
org.apache.phoenix.end2end.SystemTablePermissionsIT.testSystemTablePermissions(SystemTablePermissionsIT.java:86)
Caused by: org.apache.hadoop.hbase.security.AccessDeniedException: 
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient 
permissions  (user=regularUser1, scope=default:SYSTEMTABLEPERMISSIONSIT, 
actions=[READ, EXEC])
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.requireAccess(PhoenixAccessController.java:494)
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.preGetTable(PhoenixAccessController.java:104)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:155)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:80)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:151)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:16267)
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:7873)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2008)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:1990)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33652)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2188)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133)
at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108)
at java.lang.Thread.run(Thread.java:745)

Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException: 
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient 
permissions  (user=regularUser1, scope=default:SYSTEMTABLEPERMISSIONSIT, 
actions=[READ, EXEC])
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.requireAccess(PhoenixAccessController.java:494)
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.preGetTable(PhoenixAccessController.java:104)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:155)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:80)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:151)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:16267)
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:7873)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2008)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:1990)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33652)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2188)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133)
at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108)
at java.lang.Thread.run(Thread.java:745)


[ERROR] 
testSystemTablePermissions[isNamespaceMapped=true](org.apache.phoenix.end2end.SystemTablePermissionsIT)
  Time elapsed: 59.929 s  <<< ERROR!

Build failed in Jenkins: Phoenix | Master #1965

2018-03-21 Thread Apache Jenkins Server
See 


Changes:

[elserj] PHOENIX-4636 Add the python PQS driver

--
[...truncated 158.34 KB...]
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2170)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:36617)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2352)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:124)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:297)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:277)


[INFO] Running org.apache.phoenix.end2end.SpillableGroupByIT
[INFO] Running 
org.apache.phoenix.end2end.SysTableNamespaceMappedStatsCollectorIT
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.504 s 
- in org.apache.phoenix.end2end.RenewLeaseIT
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.087 s 
- in org.apache.phoenix.end2end.SpillableGroupByIT
[INFO] Running org.apache.phoenix.end2end.TableSnapshotReadsMapReduceIT
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 101.028 
s - in org.apache.phoenix.end2end.RegexBulkLoadToolIT
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.227 s 
- in org.apache.phoenix.end2end.TableSnapshotReadsMapReduceIT
[INFO] Running org.apache.phoenix.end2end.UpdateCacheAcrossDifferentClientsIT
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 146.57 
s <<< FAILURE! - in org.apache.phoenix.end2end.SystemTablePermissionsIT
[ERROR] 
testSystemTablePermissions[isNamespaceMapped=false](org.apache.phoenix.end2end.SystemTablePermissionsIT)
  Time elapsed: 77.747 s  <<< ERROR!
java.lang.reflect.UndeclaredThrowableException
at 
org.apache.phoenix.end2end.SystemTablePermissionsIT.testSystemTablePermissions(SystemTablePermissionsIT.java:86)
Caused by: org.apache.phoenix.exception.PhoenixIOException: 
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient 
permissions  (user=regularUser1, scope=default:SYSTEMTABLEPERMISSIONSIT, 
actions=[READ, EXEC])
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.requireAccess(PhoenixAccessController.java:495)
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.preGetTable(PhoenixAccessController.java:104)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:161)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:81)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:157)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:16267)
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8356)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2188)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2170)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:36617)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2352)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:124)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:297)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:277)

at 
org.apache.phoenix.end2end.SystemTablePermissionsIT.testSystemTablePermissions(SystemTablePermissionsIT.java:86)
Caused by: org.apache.hadoop.hbase.security.AccessDeniedException: 
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient 
permissions  (user=regularUser1, scope=default:SYSTEMTABLEPERMISSIONSIT, 
actions=[READ, EXEC])
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.requireAccess(PhoenixAccessController.java:495)
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.preGetTable(PhoenixAccessController.java:104)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:161)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:81)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:157)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generate

Build failed in Jenkins: Phoenix-4.x-HBase-1.3 #68

2018-03-21 Thread Apache Jenkins Server
See 


Changes:

[elserj] PHOENIX-4636 Add the python PQS driver

--
[...truncated 161.64 KB...]
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:155)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:80)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:151)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:16267)
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8148)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2116)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2098)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:34954)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2347)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)

at 
org.apache.phoenix.end2end.SystemTablePermissionsIT.testSystemTablePermissions(SystemTablePermissionsIT.java:86)
Caused by: org.apache.hadoop.hbase.security.AccessDeniedException: 
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient 
permissions  (user=regularUser1, scope=default:SYSTEMTABLEPERMISSIONSIT, 
actions=[READ, EXEC])
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.requireAccess(PhoenixAccessController.java:494)
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.preGetTable(PhoenixAccessController.java:104)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:155)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:80)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:151)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:16267)
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8148)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2116)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2098)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:34954)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2347)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)

Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException: 
org.apache.hadoop.hbase.security.AccessDeniedException: Insufficient 
permissions  (user=regularUser1, scope=default:SYSTEMTABLEPERMISSIONSIT, 
actions=[READ, EXEC])
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.requireAccess(PhoenixAccessController.java:494)
at 
org.apache.phoenix.coprocessor.PhoenixAccessController.preGetTable(PhoenixAccessController.java:104)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost$1.call(PhoenixMetaDataCoprocessorHost.java:155)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.execOperation(PhoenixMetaDataCoprocessorHost.java:80)
at 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.preGetTable(PhoenixMetaDataCoprocessorHost.java:151)
at 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getTable(MetaDataEndpointImpl.java:551)
at 
org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:16267)
at 
org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8148)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2116)
at 
org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2098)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:34954)
 

Apache Phoenix - Timeout crawler - Build https://builds.apache.org/job/Phoenix-4.x-HBase-0.98/1839/

2018-03-21 Thread Apache Jenkins Server
[...truncated 59 lines...]

Build failed in Jenkins: Phoenix | 4.x-HBase-0.98 #1839

2018-03-21 Thread Apache Jenkins Server
See 


Changes:

[elserj] PHOENIX-4636 Add the python PQS driver

--
[...truncated 111.45 KB...]
at 
org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:80)
at 
org.apache.phoenix.util.ServerUtil.throwIOException(ServerUtil.java:62)
at 
org.apache.phoenix.index.PhoenixTransactionalIndexer.postBatchMutateIndispensably(PhoenixTransactionalIndexer.java:240)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$37.call(RegionCoprocessorHost.java:1040)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionOperation.call(RegionCoprocessorHost.java:1656)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1733)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1688)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.postBatchMutateIndispensably(RegionCoprocessorHost.java:1036)
at 
org.apache.hadoop.hbase.regionserver.HRegion.doMiniBatchMutation(HRegion.java:2767)
at 
org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2359)
at 
org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2314)
at 
org.apache.hadoop.hbase.regionserver.HRegion.batchMutate(HRegion.java:2318)
at 
org.apache.hadoop.hbase.regionserver.HRegionServer.doBatchOp(HRegionServer.java:4678)
at 
org.apache.hadoop.hbase.regionserver.HRegionServer.doNonAtomicRegionMutation(HRegionServer.java:3835)
at 
org.apache.hadoop.hbase.regionserver.HRegionServer.multi(HRegionServer.java:3680)
at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:32500)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2195)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:104)
at 
org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133)
at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: 
Failed 1 action: RegionOpeningException: 1 time, servers with issues: 
asf922.gq1.ygridcore.net,37263,1521674745001, 
at 
org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.makeException(AsyncProcess.java:211)
at 
org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.access$500(AsyncProcess.java:195)
at 
org.apache.hadoop.hbase.client.AsyncProcess.getErrors(AsyncProcess.java:1082)
at 
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.processBatchCallback(HConnectionManager.java:2479)
at org.apache.hadoop.hbase.client.HTable.batchCallback(HTable.java:898)
at org.apache.hadoop.hbase.client.HTable.batchCallback(HTable.java:913)
at org.apache.hadoop.hbase.client.HTable.batch(HTable.java:888)
at 
org.apache.phoenix.hbase.index.write.ParallelWriterIndexCommitter$1.call(ParallelWriterIndexCommitter.java:170)
at 
org.apache.phoenix.hbase.index.write.ParallelWriterIndexCommitter$1.call(ParallelWriterIndexCommitter.java:133)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
... 1 more
: 1 time, servers with issues: asf922.gq1.ygridcore.net,37263,1521674745001, 
at 
org.apache.phoenix.tx.ParameterizedTransactionIT.testNonTxToTxTable(ParameterizedTransactionIT.java:288)
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: 
Failed 1 action: org.apache.hadoop.hbase.DoNotRetryIOException: Failed 1 
action: RegionOpeningException: 1 time, servers with issues: 
asf922.gq1.ygridcore.net,37263,1521674745001, 
at 
org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:80)
at 
org.apache.phoenix.util.ServerUtil.throwIOException(ServerUtil.java:62)
at 
org.apache.phoenix.index.PhoenixTransactionalIndexer.postBatchMutateIndispensably(PhoenixTransactionalIndexer.java:240)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$37.call(RegionCoprocessorHost.java:1040)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionOperation.call(RegionCoprocessorHost.java:1656)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1733)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1688)
at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.postBatchMutateIn

[20/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
PHOENIX-4636 Add the python PQS driver


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/35248893
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/35248893
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/35248893

Branch: refs/heads/4.x-HBase-1.2
Commit: 35248893f0454d6d42a9b59b7c59bc4383d982fd
Parents: c9e46a6
Author: Josh Elser 
Authored: Mon Mar 19 17:36:02 2018 -0400
Committer: Josh Elser 
Committed: Wed Mar 21 16:12:49 2018 -0400

--
 dev/make_rc.sh  |5 +
 pom.xml |6 +
 python/.gitignore   |8 +
 python/.gitlab-ci.yml   |  149 ++
 python/NEWS.rst |   44 +
 python/README.rst   |  136 ++
 python/RELEASING.rst|   12 +
 python/ci/build-env/Dockerfile  |7 +
 python/ci/phoenix/Dockerfile|   33 +
 python/ci/phoenix/docker-entrypoint.sh  |   24 +
 python/ci/phoenix/hbase-site.xml|   12 +
 python/doc/Makefile |  192 ++
 python/doc/api.rst  |   30 +
 python/doc/conf.py  |  287 +++
 python/doc/index.rst|   27 +
 python/doc/versions.rst |3 +
 python/docker-compose.yml   |   21 +
 python/examples/basic.py|   27 +
 python/examples/shell.py|   33 +
 python/gen-protobuf.sh  |   38 +
 python/phoenixdb/__init__.py|   68 +
 python/phoenixdb/avatica/__init__.py|   16 +
 python/phoenixdb/avatica/client.py  |  510 ++
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 ++
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 +
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 ++
 python/phoenixdb/connection.py  |  187 ++
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/errors.py  |   93 +
 python/phoenixdb/tests/__init__.py  |   44 +
 python/phoenixdb/tests/dbapi20.py   |  857 +
 python/phoenixdb/tests/test_avatica.py  |   25 +
 python/phoenixdb/tests/test_connection.py   |   42 +
 python/phoenixdb/tests/test_db.py   |   99 ++
 python/phoenixdb/tests/test_dbapi20.py  |  122 ++
 python/phoenixdb/tests/test_errors.py   |   60 +
 python/phoenixdb/tests/test_types.py|  327 
 python/phoenixdb/types.py   |  202 +++
 python/requirements.txt |   20 +
 python/setup.cfg|   34 +
 python/setup.py |   64 +
 python/tox.ini  |   24 +
 43 files changed, 8025 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index a788a5f..47439d3 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -40,6 +40,7 @@ DIR_BIN=$DIR_REL_BIN_PATH/bin
 DIR_PHERF_CONF=phoenix-pherf/config
 DIR_EXAMPLES=$DIR_REL_BIN_PATH/examples
 DIR_DOCS=dev/release_files
+DIR_PYTHON=$DIR_REL_BIN_PATH/python
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
@@ -64,6 +65,7 @@ mkdir $DIR_REL_BIN_TAR_PATH;
 mkdir $DIR_REL_SRC_TAR_PATH;
 mkdir $DIR_EXAMPLES;
 mkdir $DIR_BIN;
+mkdir $DIR_PYTHON;
 
 # Move src tar
 mv $REL_SRC.tar.gz $DIR_REL_SRC_TAR_PATH;
@@ -87,6 +89,9 @@ cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 # Copy examples
 cp -r examples/* $DIR_EXAMPLES
 
+# Copy the python driver
+cp -r python/* $DIR_PYTHON
+
 # Generate bin tar
 tar cvzf $DIR_REL_BIN_TAR_PATH/$DIR_REL_BIN.tar.gz -C $DIR_REL_ROOT 
apache-phoenix-$PHOENIX-bin;
 rm -rf $DIR_REL_BIN_PATH;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 0724fd5..1f8c67e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -477,6 +477,12 @@
 
 bin/argparse-1.4.0/argparse.py
+python/ci/**
+python/phoenixdb/avatica/proto/*
+python/*.rst
+python/doc/*.rst
+python/doc/conf.py
+python/doc/Makefile
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/python/.gitignore
--
diff --git a/python/.

[21/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/python/phoenixdb/types.py
--
diff --git a/python/phoenixdb/types.py b/python/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Type object that can be used to describe boolean columns. This is a 
phoenixdb-specific extension."""
+
+
+# XXX ARRAY
+
+if sys.version_info[0] < 3:
+_long = long  # noqa: F821
+else:
+_long = int
+
+JAVA_CLASSES = {
+'bool_value': [
+('java.lang.Boolean', common_pb2.BOOLEAN, None, None),
+],
+'string_valu

[13/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/python/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  f

[18/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/python/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  f

[12/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/python/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/cursor.py b/python/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is None:
+return
+
+for colu

[22/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/python/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/cursor.py b/python/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is None:
+return
+
+for colu

[19/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/python/phoenixdb/avatica/proto/common_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/common_pb2.py 
b/python/phoenixdb/avatica/proto/common_pb2.py
new file mode 100644
index 000..3c99502
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/common_pb2.py
@@ -0,0 +1,1667 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: common.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='common.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01
 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 
\x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 
\x01(\x08\x12\x11\n\tread_only\x18\x03 
\x01(\x08\x12\x15\n\rhas_read_only\x18\x08 
\x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 
\x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 
\x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 
\x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 
\x01(\t\x12%\n\nparameters\x18\x03 
\x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 
\x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 
\x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01
 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x
 01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 
\x01(\x08\x12\x12\n\nsearchable\x18\x04 
\x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 
\x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 
\x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t 
\x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n 
\x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c 
\x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e 
\x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f 
\x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 
\x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 
\x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 
\x01(\t\x12\x1a\n\x04type\x18\x14 
\x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 
\x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 
\x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18
 \x05 
\x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01
 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 
\x01(\r\x12\x16\n\x0eparameter_type\x18\x04 
\x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 
\x01(\t\x12\x0c\n\x04name\x18\x07 
\x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 
\x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 
\x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 
\x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01
 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 
\x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 
\x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01
 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(
 \t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 
\x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 
\x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 
\x01(\x08\x12!\n\x0cscalar_value\x18\x04 
\x01(\x0b\x32\x0b.TypedValue\"\xf2\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 
\x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 
\x01(\x08\x12\x14\n\x0cstring_value\x18\x03 
\x01(\t\x12\x14\n\x0cnumber_value\x18\x04 
\x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 
\x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 
\x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\x12 \n\x0b\x61rray_value\x18\x08 
\x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x0e\x63omponent_type\x18\t 
\x01(\x0e\x32\x04.Rep\x12\x17\n\x0fimplicitly_null\x18\n 
\x01

[30/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
PHOENIX-4636 Add the python PQS driver


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d88e4972
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d88e4972
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d88e4972

Branch: refs/heads/4.x-HBase-0.98
Commit: d88e4972e7b4a0567ca1946d760c3f3c90bd7806
Parents: 37b1e11
Author: Josh Elser 
Authored: Mon Mar 19 17:36:02 2018 -0400
Committer: Josh Elser 
Committed: Wed Mar 21 16:13:27 2018 -0400

--
 dev/make_rc.sh  |5 +
 pom.xml |6 +
 python/.gitignore   |8 +
 python/.gitlab-ci.yml   |  149 ++
 python/NEWS.rst |   44 +
 python/README.rst   |  136 ++
 python/RELEASING.rst|   12 +
 python/ci/build-env/Dockerfile  |7 +
 python/ci/phoenix/Dockerfile|   33 +
 python/ci/phoenix/docker-entrypoint.sh  |   24 +
 python/ci/phoenix/hbase-site.xml|   12 +
 python/doc/Makefile |  192 ++
 python/doc/api.rst  |   30 +
 python/doc/conf.py  |  287 +++
 python/doc/index.rst|   27 +
 python/doc/versions.rst |3 +
 python/docker-compose.yml   |   21 +
 python/examples/basic.py|   27 +
 python/examples/shell.py|   33 +
 python/gen-protobuf.sh  |   38 +
 python/phoenixdb/__init__.py|   68 +
 python/phoenixdb/avatica/__init__.py|   16 +
 python/phoenixdb/avatica/client.py  |  510 ++
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 ++
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 +
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 ++
 python/phoenixdb/connection.py  |  187 ++
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/errors.py  |   93 +
 python/phoenixdb/tests/__init__.py  |   44 +
 python/phoenixdb/tests/dbapi20.py   |  857 +
 python/phoenixdb/tests/test_avatica.py  |   25 +
 python/phoenixdb/tests/test_connection.py   |   42 +
 python/phoenixdb/tests/test_db.py   |   99 ++
 python/phoenixdb/tests/test_dbapi20.py  |  122 ++
 python/phoenixdb/tests/test_errors.py   |   60 +
 python/phoenixdb/tests/test_types.py|  327 
 python/phoenixdb/types.py   |  202 +++
 python/requirements.txt |   20 +
 python/setup.cfg|   34 +
 python/setup.py |   64 +
 python/tox.ini  |   24 +
 43 files changed, 8025 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index a788a5f..47439d3 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -40,6 +40,7 @@ DIR_BIN=$DIR_REL_BIN_PATH/bin
 DIR_PHERF_CONF=phoenix-pherf/config
 DIR_EXAMPLES=$DIR_REL_BIN_PATH/examples
 DIR_DOCS=dev/release_files
+DIR_PYTHON=$DIR_REL_BIN_PATH/python
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
@@ -64,6 +65,7 @@ mkdir $DIR_REL_BIN_TAR_PATH;
 mkdir $DIR_REL_SRC_TAR_PATH;
 mkdir $DIR_EXAMPLES;
 mkdir $DIR_BIN;
+mkdir $DIR_PYTHON;
 
 # Move src tar
 mv $REL_SRC.tar.gz $DIR_REL_SRC_TAR_PATH;
@@ -87,6 +89,9 @@ cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 # Copy examples
 cp -r examples/* $DIR_EXAMPLES
 
+# Copy the python driver
+cp -r python/* $DIR_PYTHON
+
 # Generate bin tar
 tar cvzf $DIR_REL_BIN_TAR_PATH/$DIR_REL_BIN.tar.gz -C $DIR_REL_ROOT 
apache-phoenix-$PHOENIX-bin;
 rm -rf $DIR_REL_BIN_PATH;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/pom.xml
--
diff --git a/pom.xml b/pom.xml
index b5b7a4e..035006e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -478,6 +478,12 @@
 
 bin/argparse-1.4.0/argparse.py
+python/ci/**
+python/phoenixdb/avatica/proto/*
+python/*.rst
+python/doc/*.rst
+python/doc/conf.py
+python/doc/Makefile
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/python/.gitignore
--
diff --git a/python/

[02/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/python/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/cursor.py b/python/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is None:
+return
+
+for colu

[07/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/python/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/cursor.py b/python/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is None:
+return
+
+for colu

[11/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/python/phoenixdb/types.py
--
diff --git a/python/phoenixdb/types.py b/python/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Type object that can be used to describe boolean columns. This is a 
phoenixdb-specific extension."""
+
+
+# XXX ARRAY
+
+if sys.version_info[0] < 3:
+_long = long  # noqa: F821
+else:
+_long = int
+
+JAVA_CLASSES = {
+'bool_value': [
+('java.lang.Boolean', common_pb2.BOOLEAN, None, None),
+],
+'string_valu

[29/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/python/phoenixdb/avatica/proto/common_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/common_pb2.py 
b/python/phoenixdb/avatica/proto/common_pb2.py
new file mode 100644
index 000..3c99502
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/common_pb2.py
@@ -0,0 +1,1667 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: common.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='common.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01
 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 
\x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 
\x01(\x08\x12\x11\n\tread_only\x18\x03 
\x01(\x08\x12\x15\n\rhas_read_only\x18\x08 
\x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 
\x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 
\x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 
\x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 
\x01(\t\x12%\n\nparameters\x18\x03 
\x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 
\x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 
\x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01
 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x
 01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 
\x01(\x08\x12\x12\n\nsearchable\x18\x04 
\x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 
\x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 
\x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t 
\x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n 
\x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c 
\x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e 
\x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f 
\x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 
\x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 
\x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 
\x01(\t\x12\x1a\n\x04type\x18\x14 
\x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 
\x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 
\x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18
 \x05 
\x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01
 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 
\x01(\r\x12\x16\n\x0eparameter_type\x18\x04 
\x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 
\x01(\t\x12\x0c\n\x04name\x18\x07 
\x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 
\x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 
\x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 
\x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01
 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 
\x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 
\x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01
 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(
 \t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 
\x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 
\x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 
\x01(\x08\x12!\n\x0cscalar_value\x18\x04 
\x01(\x0b\x32\x0b.TypedValue\"\xf2\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 
\x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 
\x01(\x08\x12\x14\n\x0cstring_value\x18\x03 
\x01(\t\x12\x14\n\x0cnumber_value\x18\x04 
\x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 
\x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 
\x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\x12 \n\x0b\x61rray_value\x18\x08 
\x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x0e\x63omponent_type\x18\t 
\x01(\x0e\x32\x04.Rep\x12\x17\n\x0fimplicitly_null\x18\n 
\x01

[09/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/python/phoenixdb/avatica/proto/common_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/common_pb2.py 
b/python/phoenixdb/avatica/proto/common_pb2.py
new file mode 100644
index 000..3c99502
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/common_pb2.py
@@ -0,0 +1,1667 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: common.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='common.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01
 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 
\x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 
\x01(\x08\x12\x11\n\tread_only\x18\x03 
\x01(\x08\x12\x15\n\rhas_read_only\x18\x08 
\x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 
\x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 
\x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 
\x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 
\x01(\t\x12%\n\nparameters\x18\x03 
\x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 
\x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 
\x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01
 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x
 01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 
\x01(\x08\x12\x12\n\nsearchable\x18\x04 
\x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 
\x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 
\x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t 
\x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n 
\x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c 
\x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e 
\x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f 
\x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 
\x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 
\x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 
\x01(\t\x12\x1a\n\x04type\x18\x14 
\x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 
\x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 
\x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18
 \x05 
\x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01
 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 
\x01(\r\x12\x16\n\x0eparameter_type\x18\x04 
\x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 
\x01(\t\x12\x0c\n\x04name\x18\x07 
\x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 
\x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 
\x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 
\x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01
 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 
\x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 
\x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01
 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(
 \t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 
\x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 
\x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 
\x01(\x08\x12!\n\x0cscalar_value\x18\x04 
\x01(\x0b\x32\x0b.TypedValue\"\xf2\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 
\x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 
\x01(\x08\x12\x14\n\x0cstring_value\x18\x03 
\x01(\t\x12\x14\n\x0cnumber_value\x18\x04 
\x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 
\x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 
\x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\x12 \n\x0b\x61rray_value\x18\x08 
\x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x0e\x63omponent_type\x18\t 
\x01(\x0e\x32\x04.Rep\x12\x17\n\x0fimplicitly_null\x18\n 
\x01

[01/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 37b1e1162 -> d88e4972e
  refs/heads/4.x-HBase-1.1 3e87f5d3e -> 7fea8b64d
  refs/heads/4.x-HBase-1.2 c9e46a6fc -> 35248893f
  refs/heads/4.x-HBase-1.3 a67869eba -> ba6abf7e3
  refs/heads/5.x-HBase-2.0 7e8abb8a4 -> 8ee15d9f8
  refs/heads/master e9324cc81 -> 1b72808b9


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/python/phoenixdb/types.py
--
diff --git a/python/phoenixdb/types.py b/python/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Ty

[05/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
PHOENIX-4636 Add the python PQS driver


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8ee15d9f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8ee15d9f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8ee15d9f

Branch: refs/heads/5.x-HBase-2.0
Commit: 8ee15d9f8e0a01a4d65af91aa2320bf48fe1d641
Parents: 7e8abb8
Author: Josh Elser 
Authored: Mon Mar 19 17:36:02 2018 -0400
Committer: Josh Elser 
Committed: Wed Mar 21 16:10:44 2018 -0400

--
 dev/make_rc.sh  |5 +
 pom.xml |6 +
 python/.gitignore   |8 +
 python/.gitlab-ci.yml   |  149 ++
 python/NEWS.rst |   44 +
 python/README.rst   |  136 ++
 python/RELEASING.rst|   12 +
 python/ci/build-env/Dockerfile  |7 +
 python/ci/phoenix/Dockerfile|   33 +
 python/ci/phoenix/docker-entrypoint.sh  |   24 +
 python/ci/phoenix/hbase-site.xml|   12 +
 python/doc/Makefile |  192 ++
 python/doc/api.rst  |   30 +
 python/doc/conf.py  |  287 +++
 python/doc/index.rst|   27 +
 python/doc/versions.rst |3 +
 python/docker-compose.yml   |   21 +
 python/examples/basic.py|   27 +
 python/examples/shell.py|   33 +
 python/gen-protobuf.sh  |   38 +
 python/phoenixdb/__init__.py|   68 +
 python/phoenixdb/avatica/__init__.py|   16 +
 python/phoenixdb/avatica/client.py  |  510 ++
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 ++
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 +
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 ++
 python/phoenixdb/connection.py  |  187 ++
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/errors.py  |   93 +
 python/phoenixdb/tests/__init__.py  |   44 +
 python/phoenixdb/tests/dbapi20.py   |  857 +
 python/phoenixdb/tests/test_avatica.py  |   25 +
 python/phoenixdb/tests/test_connection.py   |   42 +
 python/phoenixdb/tests/test_db.py   |   99 ++
 python/phoenixdb/tests/test_dbapi20.py  |  122 ++
 python/phoenixdb/tests/test_errors.py   |   60 +
 python/phoenixdb/tests/test_types.py|  327 
 python/phoenixdb/types.py   |  202 +++
 python/requirements.txt |   20 +
 python/setup.cfg|   34 +
 python/setup.py |   64 +
 python/tox.ini  |   24 +
 43 files changed, 8025 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index a788a5f..47439d3 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -40,6 +40,7 @@ DIR_BIN=$DIR_REL_BIN_PATH/bin
 DIR_PHERF_CONF=phoenix-pherf/config
 DIR_EXAMPLES=$DIR_REL_BIN_PATH/examples
 DIR_DOCS=dev/release_files
+DIR_PYTHON=$DIR_REL_BIN_PATH/python
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
@@ -64,6 +65,7 @@ mkdir $DIR_REL_BIN_TAR_PATH;
 mkdir $DIR_REL_SRC_TAR_PATH;
 mkdir $DIR_EXAMPLES;
 mkdir $DIR_BIN;
+mkdir $DIR_PYTHON;
 
 # Move src tar
 mv $REL_SRC.tar.gz $DIR_REL_SRC_TAR_PATH;
@@ -87,6 +89,9 @@ cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 # Copy examples
 cp -r examples/* $DIR_EXAMPLES
 
+# Copy the python driver
+cp -r python/* $DIR_PYTHON
+
 # Generate bin tar
 tar cvzf $DIR_REL_BIN_TAR_PATH/$DIR_REL_BIN.tar.gz -C $DIR_REL_ROOT 
apache-phoenix-$PHOENIX-bin;
 rm -rf $DIR_REL_BIN_PATH;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/pom.xml
--
diff --git a/pom.xml b/pom.xml
index b0f442f..6bbd268 100644
--- a/pom.xml
+++ b/pom.xml
@@ -477,6 +477,12 @@
 
 bin/argparse-1.4.0/argparse.py
+python/ci/**
+python/phoenixdb/avatica/proto/*
+python/*.rst
+python/doc/*.rst
+python/doc/conf.py
+python/doc/Makefile
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/python/.gitignore
--
diff --git a/python/.

[27/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/python/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/cursor.py b/python/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is None:
+return
+
+for colu

[23/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/python/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  f

[10/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
PHOENIX-4636 Add the python PQS driver


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1b72808b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1b72808b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1b72808b

Branch: refs/heads/master
Commit: 1b72808b9f232a8d8029f76fc2a4f1708e48
Parents: e9324cc
Author: Josh Elser 
Authored: Mon Mar 19 17:36:02 2018 -0400
Committer: Josh Elser 
Committed: Wed Mar 21 16:12:27 2018 -0400

--
 dev/make_rc.sh  |5 +
 pom.xml |6 +
 python/.gitignore   |8 +
 python/.gitlab-ci.yml   |  149 ++
 python/NEWS.rst |   44 +
 python/README.rst   |  136 ++
 python/RELEASING.rst|   12 +
 python/ci/build-env/Dockerfile  |7 +
 python/ci/phoenix/Dockerfile|   33 +
 python/ci/phoenix/docker-entrypoint.sh  |   24 +
 python/ci/phoenix/hbase-site.xml|   12 +
 python/doc/Makefile |  192 ++
 python/doc/api.rst  |   30 +
 python/doc/conf.py  |  287 +++
 python/doc/index.rst|   27 +
 python/doc/versions.rst |3 +
 python/docker-compose.yml   |   21 +
 python/examples/basic.py|   27 +
 python/examples/shell.py|   33 +
 python/gen-protobuf.sh  |   38 +
 python/phoenixdb/__init__.py|   68 +
 python/phoenixdb/avatica/__init__.py|   16 +
 python/phoenixdb/avatica/client.py  |  510 ++
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 ++
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 +
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 ++
 python/phoenixdb/connection.py  |  187 ++
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/errors.py  |   93 +
 python/phoenixdb/tests/__init__.py  |   44 +
 python/phoenixdb/tests/dbapi20.py   |  857 +
 python/phoenixdb/tests/test_avatica.py  |   25 +
 python/phoenixdb/tests/test_connection.py   |   42 +
 python/phoenixdb/tests/test_db.py   |   99 ++
 python/phoenixdb/tests/test_dbapi20.py  |  122 ++
 python/phoenixdb/tests/test_errors.py   |   60 +
 python/phoenixdb/tests/test_types.py|  327 
 python/phoenixdb/types.py   |  202 +++
 python/requirements.txt |   20 +
 python/setup.cfg|   34 +
 python/setup.py |   64 +
 python/tox.ini  |   24 +
 43 files changed, 8025 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index a788a5f..47439d3 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -40,6 +40,7 @@ DIR_BIN=$DIR_REL_BIN_PATH/bin
 DIR_PHERF_CONF=phoenix-pherf/config
 DIR_EXAMPLES=$DIR_REL_BIN_PATH/examples
 DIR_DOCS=dev/release_files
+DIR_PYTHON=$DIR_REL_BIN_PATH/python
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
@@ -64,6 +65,7 @@ mkdir $DIR_REL_BIN_TAR_PATH;
 mkdir $DIR_REL_SRC_TAR_PATH;
 mkdir $DIR_EXAMPLES;
 mkdir $DIR_BIN;
+mkdir $DIR_PYTHON;
 
 # Move src tar
 mv $REL_SRC.tar.gz $DIR_REL_SRC_TAR_PATH;
@@ -87,6 +89,9 @@ cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 # Copy examples
 cp -r examples/* $DIR_EXAMPLES
 
+# Copy the python driver
+cp -r python/* $DIR_PYTHON
+
 # Generate bin tar
 tar cvzf $DIR_REL_BIN_TAR_PATH/$DIR_REL_BIN.tar.gz -C $DIR_REL_ROOT 
apache-phoenix-$PHOENIX-bin;
 rm -rf $DIR_REL_BIN_PATH;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 4af01d8..2824f1d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -477,6 +477,12 @@
 
 bin/argparse-1.4.0/argparse.py
+python/ci/**
+python/phoenixdb/avatica/proto/*
+python/*.rst
+python/doc/*.rst
+python/doc/conf.py
+python/doc/Makefile
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/python/.gitignore
--
diff --git a/python/.gitigno

[08/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/python/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  f

[04/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/python/phoenixdb/avatica/proto/common_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/common_pb2.py 
b/python/phoenixdb/avatica/proto/common_pb2.py
new file mode 100644
index 000..3c99502
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/common_pb2.py
@@ -0,0 +1,1667 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: common.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='common.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01
 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 
\x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 
\x01(\x08\x12\x11\n\tread_only\x18\x03 
\x01(\x08\x12\x15\n\rhas_read_only\x18\x08 
\x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 
\x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 
\x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 
\x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 
\x01(\t\x12%\n\nparameters\x18\x03 
\x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 
\x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 
\x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01
 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x
 01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 
\x01(\x08\x12\x12\n\nsearchable\x18\x04 
\x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 
\x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 
\x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t 
\x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n 
\x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c 
\x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e 
\x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f 
\x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 
\x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 
\x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 
\x01(\t\x12\x1a\n\x04type\x18\x14 
\x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 
\x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 
\x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18
 \x05 
\x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01
 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 
\x01(\r\x12\x16\n\x0eparameter_type\x18\x04 
\x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 
\x01(\t\x12\x0c\n\x04name\x18\x07 
\x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 
\x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 
\x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 
\x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01
 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 
\x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 
\x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01
 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(
 \t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 
\x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 
\x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 
\x01(\x08\x12!\n\x0cscalar_value\x18\x04 
\x01(\x0b\x32\x0b.TypedValue\"\xf2\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 
\x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 
\x01(\x08\x12\x14\n\x0cstring_value\x18\x03 
\x01(\t\x12\x14\n\x0cnumber_value\x18\x04 
\x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 
\x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 
\x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\x12 \n\x0b\x61rray_value\x18\x08 
\x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x0e\x63omponent_type\x18\t 
\x01(\x0e\x32\x04.Rep\x12\x17\n\x0fimplicitly_null\x18\n 
\x01

[14/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/python/phoenixdb/avatica/proto/common_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/common_pb2.py 
b/python/phoenixdb/avatica/proto/common_pb2.py
new file mode 100644
index 000..3c99502
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/common_pb2.py
@@ -0,0 +1,1667 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: common.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='common.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01
 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 
\x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 
\x01(\x08\x12\x11\n\tread_only\x18\x03 
\x01(\x08\x12\x15\n\rhas_read_only\x18\x08 
\x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 
\x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 
\x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 
\x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 
\x01(\t\x12%\n\nparameters\x18\x03 
\x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 
\x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 
\x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01
 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x
 01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 
\x01(\x08\x12\x12\n\nsearchable\x18\x04 
\x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 
\x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 
\x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t 
\x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n 
\x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c 
\x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e 
\x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f 
\x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 
\x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 
\x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 
\x01(\t\x12\x1a\n\x04type\x18\x14 
\x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 
\x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 
\x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18
 \x05 
\x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01
 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 
\x01(\r\x12\x16\n\x0eparameter_type\x18\x04 
\x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 
\x01(\t\x12\x0c\n\x04name\x18\x07 
\x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 
\x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 
\x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 
\x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01
 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 
\x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 
\x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01
 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(
 \t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 
\x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 
\x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 
\x01(\x08\x12!\n\x0cscalar_value\x18\x04 
\x01(\x0b\x32\x0b.TypedValue\"\xf2\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 
\x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 
\x01(\x08\x12\x14\n\x0cstring_value\x18\x03 
\x01(\t\x12\x14\n\x0cnumber_value\x18\x04 
\x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 
\x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 
\x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\x12 \n\x0b\x61rray_value\x18\x08 
\x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x0e\x63omponent_type\x18\t 
\x01(\x0e\x32\x04.Rep\x12\x17\n\x0fimplicitly_null\x18\n 
\x01

[28/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/python/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  f

[15/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
PHOENIX-4636 Add the python PQS driver


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ba6abf7e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ba6abf7e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ba6abf7e

Branch: refs/heads/4.x-HBase-1.3
Commit: ba6abf7e3db809d84f1402a00e57348afab896d8
Parents: a67869e
Author: Josh Elser 
Authored: Mon Mar 19 17:36:02 2018 -0400
Committer: Josh Elser 
Committed: Wed Mar 21 16:12:41 2018 -0400

--
 dev/make_rc.sh  |5 +
 pom.xml |6 +
 python/.gitignore   |8 +
 python/.gitlab-ci.yml   |  149 ++
 python/NEWS.rst |   44 +
 python/README.rst   |  136 ++
 python/RELEASING.rst|   12 +
 python/ci/build-env/Dockerfile  |7 +
 python/ci/phoenix/Dockerfile|   33 +
 python/ci/phoenix/docker-entrypoint.sh  |   24 +
 python/ci/phoenix/hbase-site.xml|   12 +
 python/doc/Makefile |  192 ++
 python/doc/api.rst  |   30 +
 python/doc/conf.py  |  287 +++
 python/doc/index.rst|   27 +
 python/doc/versions.rst |3 +
 python/docker-compose.yml   |   21 +
 python/examples/basic.py|   27 +
 python/examples/shell.py|   33 +
 python/gen-protobuf.sh  |   38 +
 python/phoenixdb/__init__.py|   68 +
 python/phoenixdb/avatica/__init__.py|   16 +
 python/phoenixdb/avatica/client.py  |  510 ++
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 ++
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 +
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 ++
 python/phoenixdb/connection.py  |  187 ++
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/errors.py  |   93 +
 python/phoenixdb/tests/__init__.py  |   44 +
 python/phoenixdb/tests/dbapi20.py   |  857 +
 python/phoenixdb/tests/test_avatica.py  |   25 +
 python/phoenixdb/tests/test_connection.py   |   42 +
 python/phoenixdb/tests/test_db.py   |   99 ++
 python/phoenixdb/tests/test_dbapi20.py  |  122 ++
 python/phoenixdb/tests/test_errors.py   |   60 +
 python/phoenixdb/tests/test_types.py|  327 
 python/phoenixdb/types.py   |  202 +++
 python/requirements.txt |   20 +
 python/setup.cfg|   34 +
 python/setup.py |   64 +
 python/tox.ini  |   24 +
 43 files changed, 8025 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index a788a5f..47439d3 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -40,6 +40,7 @@ DIR_BIN=$DIR_REL_BIN_PATH/bin
 DIR_PHERF_CONF=phoenix-pherf/config
 DIR_EXAMPLES=$DIR_REL_BIN_PATH/examples
 DIR_DOCS=dev/release_files
+DIR_PYTHON=$DIR_REL_BIN_PATH/python
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
@@ -64,6 +65,7 @@ mkdir $DIR_REL_BIN_TAR_PATH;
 mkdir $DIR_REL_SRC_TAR_PATH;
 mkdir $DIR_EXAMPLES;
 mkdir $DIR_BIN;
+mkdir $DIR_PYTHON;
 
 # Move src tar
 mv $REL_SRC.tar.gz $DIR_REL_SRC_TAR_PATH;
@@ -87,6 +89,9 @@ cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 # Copy examples
 cp -r examples/* $DIR_EXAMPLES
 
+# Copy the python driver
+cp -r python/* $DIR_PYTHON
+
 # Generate bin tar
 tar cvzf $DIR_REL_BIN_TAR_PATH/$DIR_REL_BIN.tar.gz -C $DIR_REL_ROOT 
apache-phoenix-$PHOENIX-bin;
 rm -rf $DIR_REL_BIN_PATH;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/pom.xml
--
diff --git a/pom.xml b/pom.xml
index deaf848..eabc872 100644
--- a/pom.xml
+++ b/pom.xml
@@ -477,6 +477,12 @@
 
 bin/argparse-1.4.0/argparse.py
+python/ci/**
+python/phoenixdb/avatica/proto/*
+python/*.rst
+python/doc/*.rst
+python/doc/conf.py
+python/doc/Makefile
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba6abf7e/python/.gitignore
--
diff --git a/python/.

[24/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/python/phoenixdb/avatica/proto/common_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/common_pb2.py 
b/python/phoenixdb/avatica/proto/common_pb2.py
new file mode 100644
index 000..3c99502
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/common_pb2.py
@@ -0,0 +1,1667 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: common.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='common.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0c\x63ommon.proto\"\xc0\x01\n\x14\x43onnectionProperties\x12\x10\n\x08is_dirty\x18\x01
 \x01(\x08\x12\x13\n\x0b\x61uto_commit\x18\x02 
\x01(\x08\x12\x17\n\x0fhas_auto_commit\x18\x07 
\x01(\x08\x12\x11\n\tread_only\x18\x03 
\x01(\x08\x12\x15\n\rhas_read_only\x18\x08 
\x01(\x08\x12\x1d\n\x15transaction_isolation\x18\x04 
\x01(\r\x12\x0f\n\x07\x63\x61talog\x18\x05 \x01(\t\x12\x0e\n\x06schema\x18\x06 
\x01(\t\"S\n\x0fStatementHandle\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\n\n\x02id\x18\x02 \x01(\r\x12\x1d\n\tsignature\x18\x03 
\x01(\x0b\x32\n.Signature\"\xb0\x01\n\tSignature\x12 \n\x07\x63olumns\x18\x01 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x0b\n\x03sql\x18\x02 
\x01(\t\x12%\n\nparameters\x18\x03 
\x03(\x0b\x32\x11.AvaticaParameter\x12&\n\x0e\x63ursor_factory\x18\x04 
\x01(\x0b\x32\x0e.CursorFactory\x12%\n\rstatementType\x18\x05 
\x01(\x0e\x32\x0e.StatementType\"\xad\x03\n\x0e\x43olumnMetaData\x12\x0f\n\x07ordinal\x18\x01
 \x01(\r\x12\x16\n\x0e\x61uto_increment\x18\x02 \x
 01(\x08\x12\x16\n\x0e\x63\x61se_sensitive\x18\x03 
\x01(\x08\x12\x12\n\nsearchable\x18\x04 
\x01(\x08\x12\x10\n\x08\x63urrency\x18\x05 
\x01(\x08\x12\x10\n\x08nullable\x18\x06 \x01(\r\x12\x0e\n\x06signed\x18\x07 
\x01(\x08\x12\x14\n\x0c\x64isplay_size\x18\x08 \x01(\r\x12\r\n\x05label\x18\t 
\x01(\t\x12\x13\n\x0b\x63olumn_name\x18\n 
\x01(\t\x12\x13\n\x0bschema_name\x18\x0b \x01(\t\x12\x11\n\tprecision\x18\x0c 
\x01(\r\x12\r\n\x05scale\x18\r \x01(\r\x12\x12\n\ntable_name\x18\x0e 
\x01(\t\x12\x14\n\x0c\x63\x61talog_name\x18\x0f 
\x01(\t\x12\x11\n\tread_only\x18\x10 \x01(\x08\x12\x10\n\x08writable\x18\x11 
\x01(\x08\x12\x1b\n\x13\x64\x65\x66initely_writable\x18\x12 
\x01(\x08\x12\x19\n\x11\x63olumn_class_name\x18\x13 
\x01(\t\x12\x1a\n\x04type\x18\x14 
\x01(\x0b\x32\x0c.AvaticaType\"}\n\x0b\x41vaticaType\x12\n\n\x02id\x18\x01 
\x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\x03rep\x18\x03 
\x01(\x0e\x32\x04.Rep\x12 \n\x07\x63olumns\x18\x04 
\x03(\x0b\x32\x0f.ColumnMetaData\x12\x1f\n\tcomponent\x18
 \x05 
\x01(\x0b\x32\x0c.AvaticaType\"\x91\x01\n\x10\x41vaticaParameter\x12\x0e\n\x06signed\x18\x01
 \x01(\x08\x12\x11\n\tprecision\x18\x02 \x01(\r\x12\r\n\x05scale\x18\x03 
\x01(\r\x12\x16\n\x0eparameter_type\x18\x04 
\x01(\r\x12\x11\n\ttype_name\x18\x05 \x01(\t\x12\x12\n\nclass_name\x18\x06 
\x01(\t\x12\x0c\n\x04name\x18\x07 
\x01(\t\"\xb3\x01\n\rCursorFactory\x12#\n\x05style\x18\x01 
\x01(\x0e\x32\x14.CursorFactory.Style\x12\x12\n\nclass_name\x18\x02 
\x01(\t\x12\x13\n\x0b\x66ield_names\x18\x03 
\x03(\t\"T\n\x05Style\x12\n\n\x06OBJECT\x10\x00\x12\n\n\x06RECORD\x10\x01\x12\x15\n\x11RECORD_PROJECTION\x10\x02\x12\t\n\x05\x41RRAY\x10\x03\x12\x08\n\x04LIST\x10\x04\x12\x07\n\x03MAP\x10\x05\"9\n\x05\x46rame\x12\x0e\n\x06offset\x18\x01
 \x01(\x04\x12\x0c\n\x04\x64one\x18\x02 \x01(\x08\x12\x12\n\x04rows\x18\x03 
\x03(\x0b\x32\x04.Row\"\"\n\x03Row\x12\x1b\n\x05value\x18\x01 
\x03(\x0b\x32\x0c.ColumnValue\"3\n\x10\x44\x61tabaseProperty\x12\x0c\n\x04name\x18\x01
 \x01(\t\x12\x11\n\tfunctions\x18\x02 \x03(
 \t\"4\n\x0bWireMessage\x12\x0c\n\x04name\x18\x01 
\x01(\t\x12\x17\n\x0fwrapped_message\x18\x02 
\x01(\x0c\"\x87\x01\n\x0b\x43olumnValue\x12\x1a\n\x05value\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\x12 \n\x0b\x61rray_value\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\x17\n\x0fhas_array_value\x18\x03 
\x01(\x08\x12!\n\x0cscalar_value\x18\x04 
\x01(\x0b\x32\x0b.TypedValue\"\xf2\x01\n\nTypedValue\x12\x12\n\x04type\x18\x01 
\x01(\x0e\x32\x04.Rep\x12\x12\n\nbool_value\x18\x02 
\x01(\x08\x12\x14\n\x0cstring_value\x18\x03 
\x01(\t\x12\x14\n\x0cnumber_value\x18\x04 
\x01(\x12\x12\x13\n\x0b\x62ytes_value\x18\x05 
\x01(\x0c\x12\x14\n\x0c\x64ouble_value\x18\x06 
\x01(\x01\x12\x0c\n\x04null\x18\x07 \x01(\x08\x12 \n\x0b\x61rray_value\x18\x08 
\x03(\x0b\x32\x0b.TypedValue\x12\x1c\n\x0e\x63omponent_type\x18\t 
\x01(\x0e\x32\x04.Rep\x12\x17\n\x0fimplicitly_null\x18\n 
\x01

[06/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/1b72808b/python/phoenixdb/types.py
--
diff --git a/python/phoenixdb/types.py b/python/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Type object that can be used to describe boolean columns. This is a 
phoenixdb-specific extension."""
+
+
+# XXX ARRAY
+
+if sys.version_info[0] < 3:
+_long = long  # noqa: F821
+else:
+_long = int
+
+JAVA_CLASSES = {
+'bool_value': [
+('java.lang.Boolean', common_pb2.BOOLEAN, None, None),
+],
+'string_valu

[26/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/d88e4972/python/phoenixdb/types.py
--
diff --git a/python/phoenixdb/types.py b/python/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Type object that can be used to describe boolean columns. This is a 
phoenixdb-specific extension."""
+
+
+# XXX ARRAY
+
+if sys.version_info[0] < 3:
+_long = long  # noqa: F821
+else:
+_long = int
+
+JAVA_CLASSES = {
+'bool_value': [
+('java.lang.Boolean', common_pb2.BOOLEAN, None, None),
+],
+'string_valu

[25/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
PHOENIX-4636 Add the python PQS driver


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7fea8b64
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7fea8b64
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7fea8b64

Branch: refs/heads/4.x-HBase-1.1
Commit: 7fea8b64d28e2c9d879e7ac800bfe5e45e70b4ea
Parents: 3e87f5d
Author: Josh Elser 
Authored: Mon Mar 19 17:36:02 2018 -0400
Committer: Josh Elser 
Committed: Wed Mar 21 16:13:15 2018 -0400

--
 dev/make_rc.sh  |5 +
 pom.xml |6 +
 python/.gitignore   |8 +
 python/.gitlab-ci.yml   |  149 ++
 python/NEWS.rst |   44 +
 python/README.rst   |  136 ++
 python/RELEASING.rst|   12 +
 python/ci/build-env/Dockerfile  |7 +
 python/ci/phoenix/Dockerfile|   33 +
 python/ci/phoenix/docker-entrypoint.sh  |   24 +
 python/ci/phoenix/hbase-site.xml|   12 +
 python/doc/Makefile |  192 ++
 python/doc/api.rst  |   30 +
 python/doc/conf.py  |  287 +++
 python/doc/index.rst|   27 +
 python/doc/versions.rst |3 +
 python/docker-compose.yml   |   21 +
 python/examples/basic.py|   27 +
 python/examples/shell.py|   33 +
 python/gen-protobuf.sh  |   38 +
 python/phoenixdb/__init__.py|   68 +
 python/phoenixdb/avatica/__init__.py|   16 +
 python/phoenixdb/avatica/client.py  |  510 ++
 python/phoenixdb/avatica/proto/__init__.py  |0
 python/phoenixdb/avatica/proto/common_pb2.py| 1667 ++
 python/phoenixdb/avatica/proto/requests_pb2.py  | 1206 +
 python/phoenixdb/avatica/proto/responses_pb2.py |  917 ++
 python/phoenixdb/connection.py  |  187 ++
 python/phoenixdb/cursor.py  |  347 
 python/phoenixdb/errors.py  |   93 +
 python/phoenixdb/tests/__init__.py  |   44 +
 python/phoenixdb/tests/dbapi20.py   |  857 +
 python/phoenixdb/tests/test_avatica.py  |   25 +
 python/phoenixdb/tests/test_connection.py   |   42 +
 python/phoenixdb/tests/test_db.py   |   99 ++
 python/phoenixdb/tests/test_dbapi20.py  |  122 ++
 python/phoenixdb/tests/test_errors.py   |   60 +
 python/phoenixdb/tests/test_types.py|  327 
 python/phoenixdb/types.py   |  202 +++
 python/requirements.txt |   20 +
 python/setup.cfg|   34 +
 python/setup.py |   64 +
 python/tox.ini  |   24 +
 43 files changed, 8025 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/dev/make_rc.sh
--
diff --git a/dev/make_rc.sh b/dev/make_rc.sh
index 638968c..7d2e206 100755
--- a/dev/make_rc.sh
+++ b/dev/make_rc.sh
@@ -40,6 +40,7 @@ DIR_BIN=$DIR_REL_BIN_PATH/bin
 DIR_PHERF_CONF=phoenix-pherf/config
 DIR_EXAMPLES=$DIR_REL_BIN_PATH/examples
 DIR_DOCS=dev/release_files
+DIR_PYTHON=$DIR_REL_BIN_PATH/python
 
 # Verify no target exists
 mvn clean; rm -rf $DIR_REL_BASE;
@@ -64,6 +65,7 @@ mkdir $DIR_REL_BIN_TAR_PATH;
 mkdir $DIR_REL_SRC_TAR_PATH;
 mkdir $DIR_EXAMPLES;
 mkdir $DIR_BIN;
+mkdir $DIR_PYTHON;
 
 # Move src tar
 mv $REL_SRC.tar.gz $DIR_REL_SRC_TAR_PATH;
@@ -87,6 +89,9 @@ cp $DIR_DOCS/* $DIR_REL_BIN_PATH;
 # Copy examples
 cp -r examples/* $DIR_EXAMPLES
 
+# Copy the python driver
+cp -r python/* $DIR_PYTHON
+
 # Generate bin tar
 tar cvzf $DIR_REL_BIN_TAR_PATH/$DIR_REL_BIN.tar.gz -C $DIR_REL_ROOT 
apache-phoenix-$PHOENIX-bin;
 rm -rf $DIR_REL_BIN_PATH;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 53ea215..f6ceee4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -474,6 +474,12 @@
 examples/pig/testdata
 
 **/patchprocess/**
+python/ci/**
+python/phoenixdb/avatica/proto/*
+python/*.rst
+python/doc/*.rst
+python/doc/conf.py
+python/doc/Makefile
   
 
   

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7fea8b64/python/.gitignore
-

[17/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/python/phoenixdb/cursor.py
--
diff --git a/python/phoenixdb/cursor.py b/python/phoenixdb/cursor.py
new file mode 100644
index 000..8be7bed
--- /dev/null
+++ b/python/phoenixdb/cursor.py
@@ -0,0 +1,347 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import collections
+from phoenixdb.types import TypeHelper
+from phoenixdb.errors import ProgrammingError, InternalError
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = ['Cursor', 'ColumnDescription', 'DictCursor']
+
+logger = logging.getLogger(__name__)
+
+# TODO see note in Cursor.rowcount()
+MAX_INT = 2 ** 64 - 1
+
+ColumnDescription = collections.namedtuple('ColumnDescription', 'name 
type_code display_size internal_size precision scale null_ok')
+"""Named tuple for representing results from :attr:`Cursor.description`."""
+
+
+class Cursor(object):
+"""Database cursor for executing queries and iterating over results.
+
+You should not construct this object manually, use 
:meth:`Connection.cursor() ` instead.
+"""
+
+arraysize = 1
+"""
+Read/write attribute specifying the number of rows to fetch
+at a time with :meth:`fetchmany`. It defaults to 1 meaning to
+fetch a single row at a time.
+"""
+
+itersize = 2000
+"""
+Read/write attribute specifying the number of rows to fetch
+from the backend at each network roundtrip during iteration
+on the cursor. The default is 2000.
+"""
+
+def __init__(self, connection, id=None):
+self._connection = connection
+self._id = id
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = False
+self.arraysize = self.__class__.arraysize
+self.itersize = self.__class__.itersize
+self._updatecount = -1
+
+def __del__(self):
+if not self._connection._closed and not self._closed:
+self.close()
+
+def __enter__(self):
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if not self._closed:
+self.close()
+
+def __iter__(self):
+return self
+
+def __next__(self):
+row = self.fetchone()
+if row is None:
+raise StopIteration
+return row
+
+next = __next__
+
+def close(self):
+"""Closes the cursor.
+No further operations are allowed once the cursor is closed.
+
+If the cursor is used in a ``with`` statement, this method will
+be automatically called at the end of the ``with`` block.
+"""
+if self._closed:
+raise ProgrammingError('the cursor is already closed')
+if self._id is not None:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = None
+self._signature = None
+self._column_data_types = []
+self._frame = None
+self._pos = None
+self._closed = True
+
+@property
+def closed(self):
+"""Read-only attribute specifying if the cursor is closed or not."""
+return self._closed
+
+@property
+def description(self):
+if self._signature is None:
+return None
+description = []
+for column in self._signature.columns:
+description.append(ColumnDescription(
+column.column_name,
+column.type.name,
+column.display_size,
+None,
+column.precision,
+column.scale,
+None if column.nullable == 2 else bool(column.nullable),
+))
+return description
+
+def _set_id(self, id):
+if self._id is not None and self._id != id:
+self._connection._client.close_statement(self._connection._id, 
self._id)
+self._id = id
+
+def _set_signature(self, signature):
+self._signature = signature
+self._column_data_types = []
+self._parameter_data_types = []
+if signature is None:
+return
+
+for colu

[16/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/35248893/python/phoenixdb/types.py
--
diff --git a/python/phoenixdb/types.py b/python/phoenixdb/types.py
new file mode 100644
index 000..f41355a
--- /dev/null
+++ b/python/phoenixdb/types.py
@@ -0,0 +1,202 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import time
+import datetime
+from decimal import Decimal
+from phoenixdb.avatica.proto import common_pb2
+
+__all__ = [
+'Date', 'Time', 'Timestamp', 'DateFromTicks', 'TimeFromTicks', 
'TimestampFromTicks',
+'Binary', 'STRING', 'BINARY', 'NUMBER', 'DATETIME', 'ROWID', 'BOOLEAN',
+'JAVA_CLASSES', 'JAVA_CLASSES_MAP', 'TypeHelper',
+]
+
+
+def Date(year, month, day):
+"""Constructs an object holding a date value."""
+return datetime.date(year, month, day)
+
+
+def Time(hour, minute, second):
+"""Constructs an object holding a time value."""
+return datetime.time(hour, minute, second)
+
+
+def Timestamp(year, month, day, hour, minute, second):
+"""Constructs an object holding a datetime/timestamp value."""
+return datetime.datetime(year, month, day, hour, minute, second)
+
+
+def DateFromTicks(ticks):
+"""Constructs an object holding a date value from the given UNIX 
timestamp."""
+return Date(*time.localtime(ticks)[:3])
+
+
+def TimeFromTicks(ticks):
+"""Constructs an object holding a time value from the given UNIX 
timestamp."""
+return Time(*time.localtime(ticks)[3:6])
+
+
+def TimestampFromTicks(ticks):
+"""Constructs an object holding a datetime/timestamp value from the given 
UNIX timestamp."""
+return Timestamp(*time.localtime(ticks)[:6])
+
+
+def Binary(value):
+"""Constructs an object capable of holding a binary (long) string value."""
+return bytes(value)
+
+
+def time_from_java_sql_time(n):
+dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+return dt.time()
+
+
+def time_to_java_sql_time(t):
+return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000 + t.microsecond 
// 1000
+
+
+def date_from_java_sql_date(n):
+return datetime.date(1970, 1, 1) + datetime.timedelta(days=n)
+
+
+def date_to_java_sql_date(d):
+if isinstance(d, datetime.datetime):
+d = d.date()
+td = d - datetime.date(1970, 1, 1)
+return td.days
+
+
+def datetime_from_java_sql_timestamp(n):
+return datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=n)
+
+
+def datetime_to_java_sql_timestamp(d):
+td = d - datetime.datetime(1970, 1, 1)
+return td.microseconds // 1000 + (td.seconds + td.days * 24 * 3600) * 1000
+
+
+class ColumnType(object):
+
+def __init__(self, eq_types):
+self.eq_types = tuple(eq_types)
+self.eq_types_set = set(eq_types)
+
+def __eq__(self, other):
+return other in self.eq_types_set
+
+def __cmp__(self, other):
+if other in self.eq_types_set:
+return 0
+if other < self.eq_types:
+return 1
+else:
+return -1
+
+
+STRING = ColumnType(['VARCHAR', 'CHAR'])
+"""Type object that can be used to describe string-based columns."""
+
+BINARY = ColumnType(['BINARY', 'VARBINARY'])
+"""Type object that can be used to describe (long) binary columns."""
+
+NUMBER = ColumnType([
+'INTEGER', 'UNSIGNED_INT', 'BIGINT', 'UNSIGNED_LONG', 'TINYINT', 
'UNSIGNED_TINYINT',
+'SMALLINT', 'UNSIGNED_SMALLINT', 'FLOAT', 'UNSIGNED_FLOAT', 'DOUBLE', 
'UNSIGNED_DOUBLE', 'DECIMAL'
+])
+"""Type object that can be used to describe numeric columns."""
+
+DATETIME = ColumnType(['TIME', 'DATE', 'TIMESTAMP', 'UNSIGNED_TIME', 
'UNSIGNED_DATE', 'UNSIGNED_TIMESTAMP'])
+"""Type object that can be used to describe date/time columns."""
+
+ROWID = ColumnType([])
+"""Only implemented for DB API 2.0 compatibility, not used."""
+
+BOOLEAN = ColumnType(['BOOLEAN'])
+"""Type object that can be used to describe boolean columns. This is a 
phoenixdb-specific extension."""
+
+
+# XXX ARRAY
+
+if sys.version_info[0] < 3:
+_long = long  # noqa: F821
+else:
+_long = int
+
+JAVA_CLASSES = {
+'bool_value': [
+('java.lang.Boolean', common_pb2.BOOLEAN, None, None),
+],
+'string_valu

[03/30] phoenix git commit: PHOENIX-4636 Add the python PQS driver

2018-03-21 Thread elserj
http://git-wip-us.apache.org/repos/asf/phoenix/blob/8ee15d9f/python/phoenixdb/avatica/proto/requests_pb2.py
--
diff --git a/python/phoenixdb/avatica/proto/requests_pb2.py 
b/python/phoenixdb/avatica/proto/requests_pb2.py
new file mode 100644
index 000..203f945
--- /dev/null
+++ b/python/phoenixdb/avatica/proto/requests_pb2.py
@@ -0,0 +1,1206 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: requests.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+from google.protobuf import descriptor_pb2
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import common_pb2 as common__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+  name='requests.proto',
+  package='',
+  syntax='proto3',
+  
serialized_pb=_b('\n\x0erequests.proto\x1a\x0c\x63ommon.proto\"(\n\x0f\x43\x61talogsRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"0\n\x17\x44\x61tabasePropertyRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"P\n\x0eSchemasRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x15\n\rconnection_id\x18\x03 
\x01(\t\"\x95\x01\n\rTablesRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x11\n\ttype_list\x18\x04 \x03(\t\x12\x15\n\rhas_type_list\x18\x06 
\x01(\x08\x12\x15\n\rconnection_id\x18\x07 
\x01(\t\"*\n\x11TableTypesRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\x89\x01\n\x0e\x43olumnsRequest\x12\x0f\n\x07\x63\x61talog\x18\x01 
\x01(\t\x12\x16\n\x0eschema_pattern\x18\x02 
\x01(\t\x12\x1a\n\x12table_name_pattern\x18\x03 
\x01(\t\x12\x1b\n\x13\x63olumn_name_pattern\x18\x04 
\x01(\t\x12\x15\n\rconnection_id\x18\x05 \x01(\t\"(\n\x0fTypeInfoReque
 st\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"\xa1\x01\n\x18PrepareAndExecuteRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x14\n\x0cstatement_id\x18\x04 
\x01(\r\x12\x16\n\x0emax_rows_total\x18\x05 
\x01(\x03\x12\x1c\n\x14\x66irst_frame_max_size\x18\x06 
\x01(\x05\"c\n\x0ePrepareRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x0b\n\x03sql\x18\x02 \x01(\t\x12\x15\n\rmax_row_count\x18\x03 
\x01(\x04\x12\x16\n\x0emax_rows_total\x18\x04 
\x01(\x03\"\x80\x01\n\x0c\x46\x65tchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x0e\n\x06offset\x18\x03 
\x01(\x04\x12\x1b\n\x13\x66\x65tch_max_row_count\x18\x04 
\x01(\r\x12\x16\n\x0e\x66rame_max_size\x18\x05 
\x01(\x05\"/\n\x16\x43reateStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"D\n\x15\x43loseStatementRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\"\x8b\x01\n\x15Op
 enConnectionRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12.\n\x04info\x18\x02 \x03(\x0b\x32 
.OpenConnectionRequest.InfoEntry\x1a+\n\tInfoEntry\x12\x0b\n\x03key\x18\x01 
\x01(\t\x12\r\n\x05value\x18\x02 
\x01(\t:\x02\x38\x01\"/\n\x16\x43loseConnectionRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\"Y\n\x15\x43onnectionSyncRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12)\n\nconn_props\x18\x02 
\x01(\x0b\x32\x15.ConnectionProperties\"\xc7\x01\n\x0e\x45xecuteRequest\x12)\n\x0fstatementHandle\x18\x01
 \x01(\x0b\x32\x10.StatementHandle\x12%\n\x10parameter_values\x18\x02 
\x03(\x0b\x32\x0b.TypedValue\x12\'\n\x1f\x64\x65precated_first_frame_max_size\x18\x03
 \x01(\x04\x12\x1c\n\x14has_parameter_values\x18\x04 
\x01(\x08\x12\x1c\n\x14\x66irst_frame_max_size\x18\x05 
\x01(\x05\"m\n\x12SyncResultsRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1a\n\x05state\x18\x03 
\x01(\x0b\x32\x0b.QueryState\x12\x0e\n\x06offset\x18\x04 \x01(\x04\"&\n\rCommi
 tRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"(\n\x0fRollbackRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\"b\n\x1dPrepareAndExecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01 
\x01(\t\x12\x14\n\x0cstatement_id\x18\x02 
\x01(\r\x12\x14\n\x0csql_commands\x18\x03 
\x03(\t\"4\n\x0bUpdateBatch\x12%\n\x10parameter_values\x18\x01 
\x03(\x0b\x32\x0b.TypedValue\"a\n\x13\x45xecuteBatchRequest\x12\x15\n\rconnection_id\x18\x01
 \x01(\t\x12\x14\n\x0cstatement_id\x18\x02 \x01(\r\x12\x1d\n\x07updates\x18\x03 
\x03(\x0b\x32\x0c.UpdateBatchB\"\n org.apache.calcite.avatica.protob\x06proto3')
+  ,
+  dependencies=[common__pb2.DESCRIPTOR,])
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+
+
+
+_CATALOGSREQUEST = _descriptor.Descriptor(
+  name='CatalogsRequest',
+  full_name='CatalogsRequest',
+  filename=None,
+  file=DESCRIPTOR,
+  containing_type=None,
+  f

svn commit: r1827432 - in /phoenix/site: publish/hbasecon-phoenixcon-2018/ publish/language/ source/src/site/resources/hbasecon-phoenixcon-2018/

2018-03-21 Thread elserj
Author: elserj
Date: Wed Mar 21 18:44:48 2018
New Revision: 1827432

URL: http://svn.apache.org/viewvc?rev=1827432&view=rev
Log:
Push minor hbasecon+phoenixcon updates

Modified:
phoenix/site/publish/hbasecon-phoenixcon-2018/feed.xml
phoenix/site/publish/hbasecon-phoenixcon-2018/index.html
phoenix/site/publish/hbasecon-phoenixcon-2018/style.css
phoenix/site/publish/language/datatypes.html
phoenix/site/publish/language/functions.html
phoenix/site/publish/language/index.html
phoenix/site/source/src/site/resources/hbasecon-phoenixcon-2018/feed.xml
phoenix/site/source/src/site/resources/hbasecon-phoenixcon-2018/index.html
phoenix/site/source/src/site/resources/hbasecon-phoenixcon-2018/style.css

Modified: phoenix/site/publish/hbasecon-phoenixcon-2018/feed.xml
URL: 
http://svn.apache.org/viewvc/phoenix/site/publish/hbasecon-phoenixcon-2018/feed.xml?rev=1827432&r1=1827431&r2=1827432&view=diff
==
--- phoenix/site/publish/hbasecon-phoenixcon-2018/feed.xml (original)
+++ phoenix/site/publish/hbasecon-phoenixcon-2018/feed.xml Wed Mar 21 18:44:48 
2018
@@ -4,11 +4,11 @@
   https://jekyllrb.com/"; version="3.7.3">Jekyll
   https://hbase.apache.org/hbasecon-phoenixcon//hbasecon-phoenixcon-2018/feed.xml";
 rel="self" type="application/atom+xml" />
   https://hbase.apache.org/hbasecon-phoenixcon//hbasecon-phoenixcon-2018/"; 
rel="alternate" type="text/html" />
-  2018-03-20T22:18:10-04:00
+  2018-03-21T14:40:41-04:00
   
https://hbase.apache.org/hbasecon-phoenixcon//hbasecon-phoenixcon-2018/
 
   
-HBaseCon+PhoenixCon 2018
+HBaseCon+PhoenixCon
   
 
   

Modified: phoenix/site/publish/hbasecon-phoenixcon-2018/index.html
URL: 
http://svn.apache.org/viewvc/phoenix/site/publish/hbasecon-phoenixcon-2018/index.html?rev=1827432&r1=1827431&r2=1827432&view=diff
==
--- phoenix/site/publish/hbasecon-phoenixcon-2018/index.html (original)
+++ phoenix/site/publish/hbasecon-phoenixcon-2018/index.html Wed Mar 21 
18:44:48 2018
@@ -3,7 +3,7 @@
 
 
 
-HBaseCon+PhoenixCon 2018
+HBaseCon+PhoenixCon
 
 
 
@@ -39,7 +39,7 @@
 
 
 
-HBaseCon+PhoenixCon 
2018
+HBaseCon+PhoenixCon
 
 
 
@@ -54,6 +54,9 @@
 
   CFP
 
+
+  Registration
+
 
+
+   
+   
+   
+   Registration
+   
+   
+   
+   
+ Registration for HBaseCon and PhoenixCon will be handled 
through the DataWorks Summit registration system. This is not yet available.
+   Presently, the cost for both events is planned to be $200 per 
individual. This includes meals/snacks throughout the day.
+ As an additional benefit, attendees of HBaseCon and PhoenixCon 
will also have access to a 25% discount on the DataWorks Summit San Jose
+   registration fee. More details on this discount will be made 
available in the future.
+   
+   
+   
+
+
 
 
 
 
-
+



@@ -183,7 +202,7 @@
 
 
 
-
+



@@ -199,7 +218,7 @@
 
 
 
-
+



@@ -208,14 +227,14 @@



- Email us: mailto:d...@hbase.apache.org";>d...@apache.hbase.org
+ Email us: mailto:d...@hbase.apache.org";>d...@hbase.apache.org or mailto:d...@phoenix.apache.org";>d...@phoenix.apache.org



 
 
 
-
+




Modified: phoenix/site/publish/hbasecon-phoenixcon-2018/style.css
URL: 
http://svn.apache.org/viewvc/phoenix/site/publish/hbasecon-phoenixcon-2018/style.css?rev=1827432&r1=1827431&r2=1827432&view=diff
==
--- phoenix/site/publish/hbasecon-phoenixcon-2018/style.css (original)
+++ phoenix/site/publish/hbasecon-phoenixcon-2018/style.css Wed Mar 21 18:44:48 
2018
@@ -470,6 +470,9 @@ footer .footer-below {
   border: 5px solid black;
   padding: 15px;
   font-weight: bold;
+  /* Need the following when sponsors is on a gray row */
+  background-color: white;
+  color: black;
 }
 
 .sponsor-row-box img {

Modified: phoenix/site/publish/language/datatypes.html
URL: 
http://svn.apache.org/viewvc/phoenix/site/publish/language/datatypes.html?rev=1827432&r1=1827431&r2=1827432&view=diff
==
--- phoenix/site/publish/language/datatypes.html (original)
+++ phoenix/site/publish/language/datatypes.html Wed Mar 21 18:44:48 2018
@@ -1,7 +1,7 @@
 
 
 
 

Modifi

Build failed in Jenkins: Phoenix Compile Compatibility with HBase #582

2018-03-21 Thread Apache Jenkins Server
See 


--
[...truncated 39.68 KB...]
[ERROR] 
:[364,5]
 method does not override or implement a method from a supertype
[ERROR] 
:[370,5]
 method does not override or implement a method from a supertype
[ERROR] 
:[376,5]
 method does not override or implement a method from a supertype
[ERROR] 
:[382,5]
 method does not override or implement a method from a supertype
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on 
project phoenix-core: Compilation failure: Compilation failure: 
[ERROR] 
:[34,39]
 cannot find symbol
[ERROR]   symbol:   class MetricRegistry
[ERROR]   location: package org.apache.hadoop.hbase.metrics
[ERROR] 
:[144,16]
 cannot find symbol
[ERROR]   symbol:   class MetricRegistry
[ERROR]   location: class 
org.apache.phoenix.coprocessor.PhoenixMetaDataCoprocessorHost.PhoenixMetaDataControllerEnvironment
[ERROR] 
:[24,35]
 cannot find symbol
[ERROR]   symbol:   class DelegatingHBaseRpcController
[ERROR]   location: package org.apache.hadoop.hbase.ipc
[ERROR] 
:[25,35]
 cannot find symbol
[ERROR]   symbol:   class HBaseRpcController
[ERROR]   location: package org.apache.hadoop.hbase.ipc
[ERROR] 
:[37,37]
 cannot find symbol
[ERROR]   symbol: class DelegatingHBaseRpcController
[ERROR] 
:[56,38]
 cannot find symbol
[ERROR]   symbol:   class HBaseRpcController
[ERROR]   location: class 
org.apache.hadoop.hbase.ipc.controller.MetadataRpcController
[ERROR] 
:[26,35]
 cannot find symbol
[ERROR]   symbol:   class HBaseRpcController
[ERROR]   location: package org.apache.hadoop.hbase.ipc
[ERROR] 
:[40,12]
 cannot find symbol
[ERROR]   symbol:   class HBaseRpcController
[ERROR]   location: class 
org.apache.hadoop.hbase.ipc.controller.InterRegionServerMetadataRpcControllerFactory
[ERROR] 
:[46,12]
 cannot find symbol
[ERROR]   symbol:   class HBaseRpcController
[ERROR]   location: class 
org.apache.hadoop.hbase.ipc.controller.InterRegionServerMetadataRpcControllerFactory
[ERROR] 
:[52,12]
 cannot find symbol
[ERROR]   symbol:   class HBaseRpcController
[ERROR]   location: class 
org.apache.hadoop.hbase.ipc.controller.InterRegionServerMetadataRpcControllerFactory
[ERROR] 
:[57,46]
 cannot find