ColinLeeo commented on code in PR #388: URL: https://github.com/apache/tsfile/pull/388#discussion_r1975567620
########## python/tsfile/schema.py: ########## @@ -17,57 +17,110 @@ # from typing import List -from .constants import TSDataType, Category, TSEncoding, Compressor +from .constants import TSDataType, ColumnCategory, TSEncoding, Compressor + class TimeseriesSchema: timeseries_name = None data_type = None encoding_type = None compression_type = None - def __init__(self, timeseries_name : str, data_type : TSDataType, encoding_type : TSEncoding = None, compression_type : Compressor = None): + def __init__(self, timeseries_name: str, data_type: TSDataType, encoding_type: TSEncoding = TSEncoding.PLAIN, + compression_type: Compressor = Compressor.UNCOMPRESSED): self.timeseries_name = timeseries_name self.data_type = data_type - self.encoding_type = encoding_type if encoding_type is not None else TSEncoding.PLAIN - self.compression_type = compression_type if compression_type is not None else Compressor.UNCOMPRESSED + self.encoding_type = encoding_type + self.compression_type = compression_type + + def get_timeseries_name(self): + return self.timeseries_name + + def get_data_type(self): + return self.data_type + + def get_encoding_type(self): + return self.encoding_type + + def get_compression_type(self): + return self.compression_type + class DeviceSchema: device_name = None timeseries_list = None - def __init__(self, device_name : str, timeseries_list : List[TimeseriesSchema]): + + def __init__(self, device_name: str, timeseries_list: List[TimeseriesSchema]): self.device_name = device_name self.timeseries_list = timeseries_list + def get_device_name(self): + return self.device_name + + def get_timeseries_list(self): + return self.timeseries_list + + class ColumnSchema: column_name = None data_type = None - category = None - def __init__(self, column_name : str, data_type : TSDataType, category : Category): + + def __init__(self, column_name: str, data_type: TSDataType, category: ColumnCategory = ColumnCategory.FIELD): self.column_name = column_name self.data_type = data_type self.category = category + def get_column_name(self): + return self.column_name + + def get_data_type(self): + return self.data_type + + def get_category(self): + return self.category + class TableSchema: table_name = None columns = None - def __init__(self, table_name : str, columns : List[ColumnSchema]): + + def __init__(self, table_name: str, columns: List[ColumnSchema]): self.table_name = table_name self.columns = columns + def get_table_name(self): + return self.table_name + + def get_columns(self): + return self.columns + + class ResultSetMetaData: column_list = None data_types = None - device_name = None - def __init__(self, column_list : List[str], data_types : List[TSDataType]): + device_id = None + + def __init__(self, column_list: List[str], data_types: List[TSDataType]): self.column_list = column_list self.data_types = data_types - def set_device_name(self, device_name : str): - self.device_name = device_name - def get_data_type(self, column_index : int) -> TSDataType: + def set_device_name(self, device_id: str): + self.device_id = device_id Review Comment: fixed ########## python/tsfile/tablet.py: ########## @@ -87,11 +91,9 @@ def add_timestamp(self, row_index: int, timestamp: int): self.timestamp_list[row_index] = timestamp def _check_numeric_range(self, value: Union[int, float], data_type: TSDataType): + if math.isnan(value) or math.isinf(value): + return Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@tsfile.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org