HTHou commented on code in PR #11231:
URL: https://github.com/apache/iotdb/pull/11231#discussion_r1356008902
##########
iotdb-client/client-py/iotdb/utils/Field.py:
##########
@@ -61,71 +58,73 @@ def get_data_type(self):
def is_null(self):
return self.__data_type is None
- def set_bool_value(self, value):
- self.__bool_value = value
+ def set_bool_value(self, value: bool):
+ self.value = value
def get_bool_value(self):
if self.__data_type is None:
raise Exception("Null Field Exception!")
- return self.__bool_value
+ if self.__data_type != TSDataType.BOOLEAN:
+ return None
+ return self.value
- def set_int_value(self, value):
- self.__int_value = value
+ def set_int_value(self, value: int):
+ self.value = value
def get_int_value(self):
if self.__data_type is None:
raise Exception("Null Field Exception!")
- return self.__int_value
+ if self.__data_type != TSDataType.INT32:
+ return None
+ return np.int32(self.value)
- def set_long_value(self, value):
- self.__long_value = value
+ def set_long_value(self, value: int):
+ self.value = value
def get_long_value(self):
if self.__data_type is None:
raise Exception("Null Field Exception!")
- return self.__long_value
+ if self.__data_type != TSDataType.INT64:
+ return None
+ return np.int64(self.value)
- def set_float_value(self, value):
- self.__float_value = value
+ def set_float_value(self, value: float):
+ self.value = value
def get_float_value(self):
if self.__data_type is None:
raise Exception("Null Field Exception!")
- return self.__float_value
+ if self.__data_type != TSDataType.FLOAT:
+ return None
+ return np.float32(self.value)
Review Comment:
No. If self.value == None, I think the result should be None. Added check
for the self.value.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]