@@ -165,71 +165,8 @@ def from_column(cls, col: dict[str, Any]):
165165 )
166166
167167
168- class ResultMetadataV2Field :
169- """ResultMetadataV2Field represents the type information of one sub-type in a nested type."""
170-
171- def __init__ (
172- self ,
173- type_code : int ,
174- is_nullable : bool ,
175- internal_size : int | None = None ,
176- precision : int | None = None ,
177- scale : int | None = None ,
178- fields : list [ResultMetadataV2 ] | None = None ,
179- ):
180- self ._type_code = type_code
181- self ._is_nullable = is_nullable
182- self ._internal_size = internal_size
183- self ._precision = precision
184- self ._scale = scale
185- self ._fields = fields
186-
187- @classmethod
188- def from_column (cls , col : dict [str , Any ]) -> ResultMetadataV2Field :
189- """Initializes a ResultMetadataV2Field object from a child of the column description in the query response."""
190- fields = None
191- if col .get ("fields" ) is not None :
192- fields = [cls .from_column (f ) for f in col ["fields" ]]
193- return cls (
194- FIELD_NAME_TO_ID [
195- col ["extTypeName" ].upper ()
196- if col .get ("extTypeName" )
197- else col ["type" ].upper ()
198- ],
199- col ["nullable" ],
200- col ["length" ],
201- col ["precision" ],
202- col ["scale" ],
203- fields ,
204- )
205-
206- @property
207- def type_code (self ) -> int :
208- return self ._type_code
209-
210- @property
211- def is_nullable (self ) -> bool :
212- return self ._is_nullable
213-
214- @property
215- def internal_size (self ) -> int | None :
216- return self ._internal_size
217-
218- @property
219- def precision (self ) -> int | None :
220- return self ._precision
221-
222- @property
223- def scale (self ) -> int | None :
224- return self ._scale
225-
226- @property
227- def fields (self ) -> list [ResultMetadataV2Field ] | None :
228- return self ._fields
229-
230-
231168class ResultMetadataV2 :
232- """ResultMetadataV2Field represents the type information of a single column.
169+ """ResultMetadataV2 represents the type information of a single column.
233170
234171 It is a replacement for ResultMetadata that contains additional attributes, currently
235172 `vector_dimension` and `fields`. This class will be unified with ResultMetadata in the
@@ -272,7 +209,9 @@ def from_column(cls, col: dict[str, Any]) -> ResultMetadataV2:
272209
273210 fields = None
274211 if type_code == FIELD_NAME_TO_ID ["VECTOR" ] and col .get ("fields" ) is not None :
275- fields = [ResultMetadataV2Field .from_column (f ) for f in col ["fields" ]]
212+ fields = [
213+ ResultMetadataV2 .from_column ({"name" : None , ** f }) for f in col ["fields" ]
214+ ]
276215
277216 return cls (
278217 col ["name" ],
@@ -360,7 +299,7 @@ def vector_dimension(self) -> int | None:
360299 return self ._vector_dimension
361300
362301 @property
363- def fields (self ) -> list [ResultMetadataV2Field ] | None :
302+ def fields (self ) -> list [ResultMetadataV2 ] | None :
364303 return self ._fields
365304
366305
0 commit comments