@@ -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- if isinstance ( ftype , pa . StructType ):
72- for nested_ftype in ftype :
73- projection [fname + "." + nested_ftype . name ] = self . _get_field_projection_value ( nested_ftype . type )
74- else :
75- projection [ fname ] = self . _get_field_projection_value ( ftype )
71+ value = self . _get_field_projection_value ( fname , ftype )
72+ if isinstance ( value , bool ) :
73+ projection [updated_name ] = value
74+ elif isinstance ( value , dict [ str , bool ]) :
75+ projection . update ( value )
7676 return projection
7777
78- def _get_field_projection_value (self , ftype ):
78+ def _get_field_projection_value (self , fname , ftype ):
7979 value = True
8080 if isinstance (ftype , pa .ListType ):
81- return self ._get_field_projection_value (ftype .value_field .type )
81+ return self ._get_field_projection_value (fname , ftype .value_field .type )
8282 if isinstance (ftype , pa .StructType ):
8383 projection = {}
8484 for nested_ftype in ftype :
85- projection [nested_ftype .name ] = self ._get_field_projection_value (nested_ftype .type )
85+ projection [fname + "." + nested_ftype .name ] = self ._get_field_projection_value (fname + "." + nested_ftype . name , nested_ftype .type )
8686 value = projection
87- return value
87+ return fname , value
8888
8989 def __eq__ (self , other ):
9090 if isinstance (other , type (self )):
0 commit comments