IGNITE-14058: Bool arrays now return as bool array, not int array
This closes #4
diff --git a/pyignite/datatypes/primitive_arrays.py b/pyignite/datatypes/primitive_arrays.py
index bca4fd9..3763b96 100644
--- a/pyignite/datatypes/primitive_arrays.py
+++ b/pyignite/datatypes/primitive_arrays.py
@@ -297,3 +297,12 @@
_type_id = TYPE_BOOLEAN_ARR
primitive_type = Bool
type_code = TC_BOOL_ARRAY
+
+ @classmethod
+ def to_python(cls, ctype_object, *args, **kwargs):
+ if not ctype_object:
+ return None
+ result = [False] * ctype_object.length
+ for i in range(ctype_object.length):
+ result[i] = ctype_object.data[i] != 0
+ return result
diff --git a/tests/test_datatypes.py b/tests/test_datatypes.py
index ae66c38..83e9a60 100644
--- a/tests/test_datatypes.py
+++ b/tests/test_datatypes.py
@@ -65,6 +65,9 @@
# array of bool
([True, False, True], None),
+ ([True, False], BoolArrayObject),
+ ([False, True], BoolArrayObject),
+ ([True, False, True, False], BoolArrayObject),
# string
('Little Mary had a lamb', None),
@@ -140,6 +143,10 @@
assert result.status == 0
assert result.value == value
+ if isinstance(result.value, list):
+ for res, val in zip(result.value, value):
+ assert type(res) == type(val)
+
@pytest.mark.parametrize(
'value',