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

HTHou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 79c38ae35d0 Fix numeric run-length column decoding in the Python 
client (#19485)
79c38ae35d0 is described below

commit 79c38ae35d02a01910beefd0c3bf5b6c5583e94b
Author: DaZuiZui <[email protected]>
AuthorDate: Wed Dec 2 10:00:21 2026 +0800

    Fix numeric run-length column decoding in the Python client (#19485)
    
    Generated-by: OpenAI Codex
---
 .../client-py/iotdb/tsfile/utils/tsblock_serde.py  |  5 +-
 .../client-py/tests/unit/test_run_length_column.py | 62 ++++++++++++++++++++++
 2 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/iotdb-client/client-py/iotdb/tsfile/utils/tsblock_serde.py 
b/iotdb-client/client-py/iotdb/tsfile/utils/tsblock_serde.py
index cc5577e885c..027eb2cd8b2 100644
--- a/iotdb-client/client-py/iotdb/tsfile/utils/tsblock_serde.py
+++ b/iotdb-client/client-py/iotdb/tsfile/utils/tsblock_serde.py
@@ -237,10 +237,7 @@ def repeat(column, data_type, position_count):
         else:
             return np.array(column * position_count, dtype=object)
     else:
-        res = bytearray()
-        for _ in range(position_count):
-            res.extend(column if isinstance(column, bytes) else bytes(column))
-        return bytes(res)
+        return column.repeat(position_count)
 
 
 def read_dictionary_column(buffer, data_type, position_count):
diff --git a/iotdb-client/client-py/tests/unit/test_run_length_column.py 
b/iotdb-client/client-py/tests/unit/test_run_length_column.py
new file mode 100644
index 00000000000..dc209d90950
--- /dev/null
+++ b/iotdb-client/client-py/tests/unit/test_run_length_column.py
@@ -0,0 +1,62 @@
+# 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 struct
+
+import pytest
+
+from iotdb.utils.SessionDataSet import SessionDataSet
+
+
[email protected]
+def constant_int32_result():
+    # One INT32 column, two rows. The time column is plain INT64 and the
+    # value column uses RLE with a single non-null INT32 inside it.
+    header = struct.pack(">iBiBB", 1, 1, 2, 2, 4)
+    timestamps = struct.pack(">?qq", False, 1, 2)
+    constant = struct.pack(">B?i", 1, False, 42)
+    return SessionDataSet(
+        sql="select 42 as v from t",
+        column_name_list=["v"],
+        column_type_list=["INT32"],
+        column_name_index={"v": 0},
+        query_id=1,
+        statement_id=1,
+        client=None,
+        session_id=1,
+        query_result=[header + timestamps + constant],
+        ignore_timestamp=True,
+        time_out=0,
+        more_data=False,
+        fetch_size=100,
+        zone_id="UTC",
+        time_precision="ms",
+        column_index_2_tsblock_column_index_list=[0],
+    )
+
+
+def test_run_length_int32_rows(constant_int32_result):
+    values = []
+    while constant_int32_result.has_next():
+        row = constant_int32_result.next()
+        values.append(row.get_fields()[0].get_int_value())
+    assert values == [42, 42]
+
+
+def test_run_length_int32_dataframe(constant_int32_result):
+    assert constant_int32_result.todf()["v"].tolist() == [42, 42]

Reply via email to