refactor: simplify batch processing by removing partition dependency and introducing batch accumulator
This commit is contained in:
@@ -90,7 +90,7 @@ func (ex *GenericExtractor) ProcessPartition(
|
||||
return rowsRead, err
|
||||
}
|
||||
|
||||
if err := flush(ctx, &partition, batchSize, batchRows, chBatchesOut); err != nil {
|
||||
if err := flush(ctx, batchSize, batchRows, chBatchesOut); err != nil {
|
||||
return rowsRead, err
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func (ex *GenericExtractor) ProcessPartition(
|
||||
batchRows = append(batchRows, rowValues)
|
||||
if len(batchRows) >= batchSize {
|
||||
// logrus.Debugf("Batch size reached, flushing batch with %v rows (rowsRead=%v)", len(batchRows), rowsRead)
|
||||
if err := flush(ctx, &partition, batchSize, batchRows, chBatchesOut); err != nil {
|
||||
if err := flush(ctx, batchSize, batchRows, chBatchesOut); err != nil {
|
||||
// logrus.Warnf("Error flushing rows: %v", err)
|
||||
return rowsRead, err
|
||||
}
|
||||
@@ -110,7 +110,7 @@ func (ex *GenericExtractor) ProcessPartition(
|
||||
}
|
||||
}
|
||||
|
||||
if err := flush(ctx, &partition, batchSize, batchRows, chBatchesOut); err != nil {
|
||||
if err := flush(ctx, batchSize, batchRows, chBatchesOut); err != nil {
|
||||
return rowsRead, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user