@@ -68,10 +68,6 @@ def __post_init__(self):
6868 if self .column_names is not None :
6969 self .names = self .column_names
7070
71- @property
72- def schema (self ):
73- return self .features .arrow_schema if self .features is not None else None
74-
7571 @property
7672 def read_csv_kwargs (self ):
7773 read_csv_kwargs = dict (
@@ -154,7 +150,7 @@ def _split_generators(self, dl_manager):
154150
155151 def _cast_table (self , pa_table : pa .Table ) -> pa .Table :
156152 if self .config .features is not None :
157- schema = self .config .schema
153+ schema = self .config .features . arrow_schema
158154 if all (not require_storage_cast (feature ) for feature in self .config .features .values ()):
159155 # cheaper cast
160156 pa_table = pa .Table .from_arrays ([pa_table [field .name ] for field in schema ], schema = schema )
@@ -164,14 +160,14 @@ def _cast_table(self, pa_table: pa.Table) -> pa.Table:
164160 return pa_table
165161
166162 def _generate_tables (self , files ):
167- schema = self .config .schema
163+ schema = self .config .features . arrow_schema if self . config . features else None
168164 # dtype allows reading an int column as str
169165 dtype = (
170166 {
171167 name : dtype .to_pandas_dtype () if not require_storage_cast (feature ) else object
172168 for name , dtype , feature in zip (schema .names , schema .types , self .config .features .values ())
173169 }
174- if schema
170+ if schema is not None
175171 else None
176172 )
177173 for file_idx , file in enumerate (files ):
0 commit comments