This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch try_fix_python
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/try_fix_python by this push:
new 89cf14f6 try
89cf14f6 is described below
commit 89cf14f6d0f2fb11909325bb2cbf2d3af3652360
Author: HTHou <[email protected]>
AuthorDate: Mon Aug 5 23:04:36 2024 +0800
try
---
python/test.py | 84 ++++++++++++++++++++++++------------------------
python/tsfile/tsfile.pxd | 2 +-
2 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/python/test.py b/python/test.py
index ebbea6fa..4138df15 100644
--- a/python/test.py
+++ b/python/test.py
@@ -87,48 +87,48 @@ def test_read_tsfile():
FILE_NAME = DATA_PATH + "/full_datatypes.tsfile"
# test read data
## 1. read all data
- df, _ = ts.read_tsfile(FILE_NAME, TABLE_NAME, ["level", "num", "bools",
"double"])
- assert df.shape == (1000, 5)
- assert df["level"].dtype == np.float32
- assert df["Time"].dtype == np.int64
- assert df["num"].dtype == np.int64
- assert df["bools"].dtype == np.bool_
- assert df["double"].dtype == np.float64
-
- ## 2. read with chunksize
- df, _ = ts.read_tsfile(FILE_NAME, TABLE_NAME, ["level", "num"],
chunksize=100)
- assert df.shape == (100, 3)
- assert df["level"].dtype == np.float32
- assert df["Time"].sum() == np.arange(1, 101).sum()
-
- ## 3. read with iterator
- chunk_num = 0
- with ts.read_tsfile(
- FILE_NAME, TABLE_NAME, ["level", "num"], iterator=True, chunksize=100
- ) as reader:
- for chunk, _ in reader:
- assert chunk.shape == (100, 3)
- assert chunk["level"].dtype == np.float32
- assert (
- chunk["Time"].sum()
- == np.arange(1 + chunk_num * 100, 101 + chunk_num * 100).sum()
- )
- chunk_num += 1
- assert chunk_num == 10
-
- ## 4. read with time scale
- df, _ = ts.read_tsfile(FILE_NAME, TABLE_NAME, ["num"], start_time=50,
end_time=99)
- assert df.shape == (50, 2)
- assert df["num"][0] == 10049
- assert df["num"][9] == 10058
-
- ## 5. read with time scale and chunksize
- df, _ = ts.read_tsfile(
- FILE_NAME, TABLE_NAME, ["num"], start_time=50, end_time=99,
chunksize=10
- )
- assert df.shape == (10, 2)
- assert df["num"][0] == 10049
- assert df["num"][9] == 10058
+ # df, _ = ts.read_tsfile(FILE_NAME, TABLE_NAME, ["level", "num", "bools",
"double"])
+ # assert df.shape == (1000, 5)
+ # assert df["level"].dtype == np.float32
+ # assert df["Time"].dtype == np.int64
+ # assert df["num"].dtype == np.int64
+ # assert df["bools"].dtype == np.bool_
+ # assert df["double"].dtype == np.float64
+ #
+ # ## 2. read with chunksize
+ # df, _ = ts.read_tsfile(FILE_NAME, TABLE_NAME, ["level", "num"],
chunksize=100)
+ # assert df.shape == (100, 3)
+ # assert df["level"].dtype == np.float32
+ # assert df["Time"].sum() == np.arange(1, 101).sum()
+ #
+ # ## 3. read with iterator
+ # chunk_num = 0
+ # with ts.read_tsfile(
+ # FILE_NAME, TABLE_NAME, ["level", "num"], iterator=True, chunksize=100
+ # ) as reader:
+ # for chunk, _ in reader:
+ # assert chunk.shape == (100, 3)
+ # assert chunk["level"].dtype == np.float32
+ # assert (
+ # chunk["Time"].sum()
+ # == np.arange(1 + chunk_num * 100, 101 + chunk_num *
100).sum()
+ # )
+ # chunk_num += 1
+ # assert chunk_num == 10
+ #
+ # ## 4. read with time scale
+ # df, _ = ts.read_tsfile(FILE_NAME, TABLE_NAME, ["num"], start_time=50,
end_time=99)
+ # assert df.shape == (50, 2)
+ # assert df["num"][0] == 10049
+ # assert df["num"][9] == 10058
+ #
+ # ## 5. read with time scale and chunksize
+ # df, _ = ts.read_tsfile(
+ # FILE_NAME, TABLE_NAME, ["num"], start_time=50, end_time=99,
chunksize=10
+ # )
+ # assert df.shape == (10, 2)
+ # assert df["num"][0] == 10049
+ # assert df["num"][9] == 10058
## 6. read with time scale and iterator
chunk_num = 0
diff --git a/python/tsfile/tsfile.pxd b/python/tsfile/tsfile.pxd
index a41794e2..1480371f 100644
--- a/python/tsfile/tsfile.pxd
+++ b/python/tsfile/tsfile.pxd
@@ -89,7 +89,7 @@ cdef extern from "./TsFile-cwrapper.h":
# writer tsfile data
ErrorCode tsfile_register_table(CTsFileWriter writer, TableSchema* schema)
ErrorCode tsfile_register_table_column(CTsFileWriter writer, const char*
table_name, ColumnSchema* schema)
- TsFileRowData create_tsfile_row(const char* table_name, timestamp
timestamp, int column_length)
+ TsFileRowData create_tsfile_row(const char* table_name, timestamp time,
int column_length)
ErrorCode insert_data_into_tsfile_row_int32(TsFileRowData row_data, char*
column_name, int value)
ErrorCode insert_data_into_tsfile_row_int64(TsFileRowData row_data, char*
column_name, long long value)
ErrorCode insert_data_into_tsfile_row_float(TsFileRowData row_data, char*
column_name, float value)