diff --git a/Framework/Core/src/FragmentToBatch.cxx b/Framework/Core/src/FragmentToBatch.cxx index 1a6c3bca3cc60..ada31be814fc8 100644 --- a/Framework/Core/src/FragmentToBatch.cxx +++ b/Framework/Core/src/FragmentToBatch.cxx @@ -44,7 +44,14 @@ void FragmentToBatch::fill(std::shared_ptr schema, std::shared_pt options->dataset_schema = schema; auto scanner = format->ScanBatchesAsync(options, mFragment); auto batch = (*scanner)(); - mRecordBatch = *batch.result(); + auto result = batch.result(); + if (!result.ok()) { + throw std::runtime_error("FragmentToBatch::fill: scan failed: " + result.status().ToString()); + } + mRecordBatch = *result; + if (!mRecordBatch) { + throw std::runtime_error("FragmentToBatch::fill: scan returned null RecordBatch"); + } // Notice that up to here the buffer was not yet filled. }