@@ -68,23 +68,23 @@ def _normalize_mapping(mapping):
6868 def _get_projection (self ):
6969 projection = {"_id" : False }
7070 for fname , ftype in self .typemap .items ():
71- value = self ._get_field_projection_value (fname , ftype )
72- if isinstance (value , bool ):
73- projection [fname ] = value
74- else :
75- projection .update (value )
71+ fname , ftype , projection = self ._get_field_projection_value (fname , ftype , projection )
72+ # if isinstance(value, bool):
73+ # projection[fname] = value
74+ # else:
75+ # projection.update(value)
7676 return projection
7777
78- def _get_field_projection_value (self , fname , ftype ):
78+ def _get_field_projection_value (self , fname , ftype , projection ):
7979 value = True
8080 if isinstance (ftype , pa .ListType ):
81- return self ._get_field_projection_value (fname , ftype .value_field .type )
81+ fname , ftype , projection = self ._get_field_projection_value (fname , ftype .value_field .type , projection )
82+ return fname , ftype , projection
8283 if isinstance (ftype , pa .StructType ):
83- projection = {}
8484 for nested_ftype in ftype :
85- projection [ fname + "." + nested_ftype . name ] = self ._get_field_projection_value (fname + "." + nested_ftype .name , nested_ftype .type )
86- value = projection
87- return value
85+ fname , ftype , projection = self ._get_field_projection_value (fname + "." + nested_ftype .name , nested_ftype .type )
86+ return fname , ftype , projection
87+ return fname , ftype , projection . update ({ fname : True })
8888
8989 def __eq__ (self , other ):
9090 if isinstance (other , type (self )):
0 commit comments