Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/connect/src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use spark::relation::RelType;
pub use spark::write_operation::SaveMode;

use arrow::array::PrimitiveArray;
use arrow::array::{Array, StringArray};
use arrow::datatypes::{DataType, Float64Type};
use arrow::json::ArrayWriter;
use arrow::record_batch::RecordBatch;
Expand Down Expand Up @@ -1038,6 +1039,15 @@ impl DataFrame {

let rows = self.spark_session.client().to_arrow(plan).await?;

// ShowString returns a single-column RecordBatch with the formatted table as a string.
// Extract and print the string directly instead of wrapping it in another table.
if let Some(arr) = rows.column(0).as_any().downcast_ref::<StringArray>() {
if arr.len() > 0 {
println!("{}", arr.value(0));
return Ok(());
}
}

Ok(pretty::print_batches(&[rows])?)
}

Expand Down