Skip to content

Commit bea52a3

Browse files
committed
refactor: simplify record batch collection by using FormatterConfig for display options
1 parent 2ef013f commit bea52a3

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

src/dataframe.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,7 @@ impl PyDataFrame {
165165
let config = get_formatter_config(py)?;
166166
let (batches, has_more) = wait_for_future(
167167
py,
168-
collect_record_batches_to_display(
169-
self.df.as_ref().clone(),
170-
config.repr_rows,
171-
config.repr_rows,
172-
),
168+
collect_record_batches_to_display(self.df.as_ref().clone(), config),
173169
)?;
174170
if batches.is_empty() {
175171
// This should not be reached, but do it for safety since we index into the vector below
@@ -191,11 +187,7 @@ impl PyDataFrame {
191187
let config = get_formatter_config(py)?;
192188
let (batches, has_more) = wait_for_future(
193189
py,
194-
collect_record_batches_to_display(
195-
self.df.as_ref().clone(),
196-
config.min_rows,
197-
usize::MAX,
198-
),
190+
collect_record_batches_to_display(self.df.as_ref().clone(), config),
199191
)?;
200192
if batches.is_empty() {
201193
// This should not be reached, but do it for safety since we index into the vector below
@@ -850,11 +842,11 @@ fn record_batch_into_schema(
850842
/// rows, set min_rows == max_rows.
851843
async fn collect_record_batches_to_display(
852844
df: DataFrame,
853-
min_rows: usize,
854-
max_rows: usize,
845+
config: FormatterConfig,
855846
) -> Result<(Vec<RecordBatch>, bool), DataFusionError> {
856-
let config = FormatterConfig::default();
857847
let max_bytes = config.max_bytes;
848+
let min_rows = config.min_rows;
849+
let max_rows = config.repr_rows;
858850

859851
let partitioned_stream = df.execute_stream_partitioned().await?;
860852
let mut stream = futures::stream::iter(partitioned_stream).flatten();

0 commit comments

Comments
 (0)