You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug]: The to_dict() method in the schema does not completely convert an object to a json dict, datatype and function type are still an IntEnum class
#2538
Open
1 task done
zhuwenxing opened this issue
Jan 2, 2025
· 0 comments
The to_dict() method in the schema does not completely convert an object to a json dict, datatype and function type are still an IntEnum class
Expected Behavior
DataType/FunctionType object can be represented as a dictionary
def to_dict(self) -> dict:
"""Convert DataType to a plain dictionary.
Returns:
dict: A dictionary containing the name and value of the DataType.
"""
return {
"name": self.name,
"value": self.value
}
@classmethod
def from_dict(cls, d: dict) -> "DataType":
"""Create DataType from a dictionary.
Args:
d (dict): Dictionary containing DataType information.
Must have either 'value' or 'name' key.
Returns:
DataType: The corresponding DataType enum value.
"""
if "value" in d:
return cls(d["value"])
return cls[d["name"].upper()]
Steps/Code To Reproduce behavior
No response
Environment details
- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0):
- Milvus configuration (Settings you made in `server_config.yaml`):
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Describe the bug
The to_dict() method in the schema does not completely convert an object to a json dict, datatype and function type are still an IntEnum class
Expected Behavior
DataType/FunctionType object can be represented as a dictionary
Steps/Code To Reproduce behavior
No response
Environment details
Anything else?
No response
The text was updated successfully, but these errors were encountered: