@@ -76,8 +76,9 @@ public async Task<long> ReadAllFilesDirectly()
7676 {
7777 using var reader = new FileReader ( filePath ) ;
7878 using var batchReader = reader . GetRecordBatchReader ( ) ;
79- while ( await batchReader . ReadNextRecordBatchAsync ( ) is { } batch )
79+ while ( await batchReader . ReadNextRecordBatchAsync ( ) is { } batch_ )
8080 {
81+ using var batch = batch_ ;
8182 rowsRead += batch . Length ;
8283 }
8384 }
@@ -91,8 +92,9 @@ public async Task<long> ReadAllData()
9192 var dataset = new DatasetReader ( _datasetDirectory , new HivePartitioning . Factory ( ) ) ;
9293 using var reader = dataset . ToBatches ( ) ;
9394 long rowsRead = 0 ;
94- while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch )
95+ while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch_ )
9596 {
97+ using var batch = batch_ ;
9698 rowsRead += batch . Length ;
9799 }
98100
@@ -106,8 +108,9 @@ public async Task<long> FilterPartitions()
106108 var filter = Col . Named ( "group" ) . IsEqualTo ( "group-2" ) . And ( Col . Named ( "day" ) . IsEqualTo ( 2 ) ) ;
107109 using var reader = dataset . ToBatches ( filter ) ;
108110 long rowsRead = 0 ;
109- while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch )
111+ while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch_ )
110112 {
113+ using var batch = batch_ ;
111114 rowsRead += batch . Length ;
112115 }
113116
@@ -121,8 +124,9 @@ public async Task<long> FilterFileData()
121124 var filter = Col . Named ( "id" ) . IsEqualTo ( 5 ) ;
122125 using var reader = dataset . ToBatches ( filter ) ;
123126 long rowsRead = 0 ;
124- while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch )
127+ while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch_ )
125128 {
129+ using var batch = batch_ ;
126130 rowsRead += batch . Length ;
127131 }
128132
@@ -135,8 +139,9 @@ public async Task<long> FilterToFileColumns()
135139 var dataset = new DatasetReader ( _datasetDirectory , new HivePartitioning . Factory ( ) ) ;
136140 using var reader = dataset . ToBatches ( columns : new [ ] { "id" , "ints" , "doubles" } ) ;
137141 long rowsRead = 0 ;
138- while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch )
142+ while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch_ )
139143 {
144+ using var batch = batch_ ;
140145 rowsRead += batch . Length ;
141146 }
142147
@@ -149,8 +154,9 @@ public async Task<long> FilterToSingleColumn()
149154 var dataset = new DatasetReader ( _datasetDirectory , new HivePartitioning . Factory ( ) ) ;
150155 using var reader = dataset . ToBatches ( columns : new [ ] { "ints" } ) ;
151156 long rowsRead = 0 ;
152- while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch )
157+ while ( await reader . ReadNextRecordBatchAsync ( ) is { } batch_ )
153158 {
159+ using var batch = batch_ ;
154160 rowsRead += batch . Length ;
155161 }
156162
0 commit comments