Skip to content

Commit

Permalink
[Py-client] Fix dataset contains null value contract error (#13762)
Browse files Browse the repository at this point in the history
* add test

* fix query dataset

* try IT

* try IT

* try IT

* try IT

* try IT

* fix

* fix IT
  • Loading branch information
HTHou committed Oct 15, 2024
1 parent 4cb90d2 commit 996238b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
12 changes: 1 addition & 11 deletions iotdb-client/client-py/iotdb/utils/IoTDBRpcDataSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,7 @@ def construct_one_data_frame(self):
data_array.dtype.newbyteorder("<")
)
if len(data_array) < total_length:
# INT32, INT64, BOOLEAN, TIMESTAMP, DATE
if (
data_type == 0
or data_type == 1
or data_type == 2
or data_type == 8
or data_type == 9
):
tmp_array = np.full(total_length, np.nan, np.float32)
else:
tmp_array = np.full(total_length, None, dtype=object)
tmp_array = np.full(total_length, None, dtype=object)

bitmap_buffer = self.__query_data_set.bitmapList[location]
buffer = _to_bitbuffer(bitmap_buffer)
Expand Down
27 changes: 27 additions & 0 deletions iotdb-client/client-py/tests/integration/test_new_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,32 @@ def session_test(use_session_pool=False):
assert rows == 10
assert columns == 5

session.insert_records(
[device_id, device_id],
[11, 12],
[measurements_new_type, ["s_02", "s_03", "s_04"]],
[
data_types_new_type,
[
TSDataType.TIMESTAMP,
TSDataType.BLOB,
TSDataType.STRING,
],
],
[
[date(1971, 1, 1), 11, b"\x12\x34", "test11"],
[12, b"\x12\x34", "test12"],
],
)

with session.execute_query_statement(
"select s_01,s_02,s_03,s_04 from root.sg_test_01.d_04 where time > 10"
) as dataset:
cnt = 0
while dataset.has_next():
cnt += 1
print(dataset.next())
assert cnt == 2

# close session connection.
session.close()

0 comments on commit 996238b

Please sign in to comment.