You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2021/06/01 03:18:51 UTC

[phoenix-queryserver] branch master updated: PHOENIX-6484 Python phoenixdb throws error on empty resultsets with array types

This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix-queryserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 5ccb85e  PHOENIX-6484 Python phoenixdb throws error on empty resultsets with array types
5ccb85e is described below

commit 5ccb85e712bddfe2a067d987adc14d8c913c6bc4
Author: Istvan Toth <st...@apache.org>
AuthorDate: Mon May 31 07:38:46 2021 +0200

    PHOENIX-6484 Python phoenixdb throws error on empty resultsets with array types
---
 python-phoenixdb/phoenixdb/tests/test_types.py | 2 ++
 python-phoenixdb/phoenixdb/types.py            | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/python-phoenixdb/phoenixdb/tests/test_types.py b/python-phoenixdb/phoenixdb/tests/test_types.py
index 19c730d..5d6cf8d 100644
--- a/python-phoenixdb/phoenixdb/tests/test_types.py
+++ b/python-phoenixdb/phoenixdb/tests/test_types.py
@@ -350,6 +350,8 @@ class TypesTest(DatabaseTestCase):
     def test_array(self):
         self.createTable("phoenixdb_test_tbl1", "CREATE TABLE {table} (id integer primary key, val integer[])")
         with self.conn.cursor() as cursor:
+            cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id")
+            self.assertEqual(cursor.fetchall(), [])
             cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, ARRAY[1, 2])")
             cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (2, ?)", [[2, 3]])
             cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (3, ?)", [[4]])
diff --git a/python-phoenixdb/phoenixdb/types.py b/python-phoenixdb/phoenixdb/types.py
index e446eca..21421b5 100644
--- a/python-phoenixdb/phoenixdb/types.py
+++ b/python-phoenixdb/phoenixdb/types.py
@@ -221,10 +221,11 @@ JDBC_TO_REP = dict([
     (-16, common_pb2.STRING),  # LONGNVARCHAR
     (2011, common_pb2.STRING),  # NCLOB
     (2009, common_pb2.STRING),  # SQLXML
+    # Returned by Avatica for Arrays in EMPTY resultsets
+    (2000, common_pb2.BYTE_STRING)  # JAVA_OBJECT
     # These are defined by JDBC, but cannot be mapped
     # NULL
     # OTHER
-    # JAVA_OBJECT
     # DISTINCT
     # STRUCT
     # ARRAY 2003 - We are handling this as a special case