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

colinlee pushed a commit to branch colin_fix_null
in repository https://gitbox.apache.org/repos/asf/tsfile.git

commit c5ee8dbe2496e88d34df872811c7f5a2b9e20213
Author: ColinLee <[email protected]>
AuthorDate: Wed Apr 9 14:26:24 2025 +0800

    fix python is null error.
---
 .gitignore                          | 2 +-
 python/tests/test_write_and_read.py | 7 +++++++
 python/tsfile/tsfile_reader.pyx     | 4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index fa3c6a26..b9070546 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,7 +38,7 @@ python/tests/*.tsfile
 
 cpp/cmake-build-debug-mingw/
 cpp/third_party/googletest-release-1.12.1.zip
-
+cpp/third_party/zlib-1.2.13/zconf.h
 .vscode/
 
 build/*
diff --git a/python/tests/test_write_and_read.py 
b/python/tests/test_write_and_read.py
index 817c3f67..6d0dbe7a 100644
--- a/python/tests/test_write_and_read.py
+++ b/python/tests/test_write_and_read.py
@@ -62,6 +62,8 @@ def test_row_record_write_and_read():
 
 def test_tablet_write_and_read():
     try:
+        if os.path.exists("record_write_and_read.tsfile"):
+            os.remove("record_write_and_read.tsfile")
         writer = TsFileWriter("tablet_write_and_read.tsfile")
         measurement_num = 30
         for i in range(measurement_num):
@@ -124,6 +126,11 @@ def test_table_writer_and_reader():
                 while result.next():
                     cur_time = result.get_value_by_name("time")
                     assert result.get_value_by_name("device") == "device" + 
str(cur_time)
+                    assert result.is_null_by_name("device") == False
+                    assert result.is_null_by_name("value") == False
+                    assert result.is_null_by_index(1) == False
+                    assert result.is_null_by_index(2) == False
+                    assert result.is_null_by_index(3) == False
                     assert result.get_value_by_name("value") == cur_time * 
100.0
                     cur_line = cur_line + 1
                 assert cur_line == 11
diff --git a/python/tsfile/tsfile_reader.pyx b/python/tsfile/tsfile_reader.pyx
index f9106be5..e8d38d7d 100644
--- a/python/tsfile/tsfile_reader.pyx
+++ b/python/tsfile/tsfile_reader.pyx
@@ -208,7 +208,7 @@ cdef class ResultSetPy:
             raise IndexError(
                 f"Column index {index} out of range (column count: 
{len(self.metadata.column_list)})"
             )
-        return tsfile_result_set_is_null_by_index(self.result, index - 1)
+        return tsfile_result_set_is_null_by_index(self.result, index)
 
     def is_null_by_name(self, name : str):
         """
@@ -216,7 +216,7 @@ cdef class ResultSetPy:
         """
         self.check_result_set_invalid()
         ind = self.metadata.get_column_name_index(name, self.is_tree)
-        return self.is_null_by_index(ind + 1)
+        return self.is_null_by_index(ind)
 
     def check_result_set_invalid(self):
         if not self.valid:

Reply via email to