influxdata/influxdb · error · CodecError
no record batches to convert
Error message
no record batches to convert
What it means
CodecError::NoRecordBatches, raised during RecordBatch-to-Parquet serialisation when the result stream yielded zero batches. The library refuses to write a Parquet file because there is nothing to encode, and a subsequent upload would be meaningless. Doc comment: 'The result stream contained no batches.'
Solutions
- Check why the DataFusion plan produced no batches (inspect the logical/physical plan and predicates)
- Handle the empty-input case in the caller before invoking serialisation, e.g. skip writing or write an explicit empty sentinel
- Fix stream wiring so the correct batch stream is passed to the Parquet writer
- If empty results are legitimate, avoid the parquet upload path for them
Example fix
// before
let batches: Vec<RecordBatch> = stream.try_collect().await?;
write_parquet(batches.into_iter())?;
// after
let batches: Vec<RecordBatch> = stream.try_collect().await?;
if batches.is_empty() {
return Ok(None); // skip writing an empty file
}
write_parquet(batches.into_iter())?; Defensive patterns
Strategy: try-catch
Validate before calling
let batches: Vec<RecordBatch> = stream.try_collect().await?;
if batches.is_empty() {
return Ok(None); // nothing to serialise
} Try / catch
match res {
Err(CodecError::NoRecordBatches) => info!("query produced no batches; skipping parquet write"),
other => other?,
} Prevention
- Always materialise or count the stream before invoking serialisation
- Log empty query results so silent no-data plans are noticed
- Assert the correct stream is wired to the writer in pipeline tests
When it happens
Trigger: Executing a query plan whose stream completes without ever yielding a RecordBatch and then passing that stream to the Parquet serialisation/upload path.
Common situations: Queries with filters matching no data combined with upstream logic that skips empty batches entirely; a plan that short-circuits (EmptyRelation) so the stream is empty from the start; wiring bugs where the wrong stream is fed to the writer.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- no rows to serialise
- Error creating _field record batch
- failed to write parquet file
- parquet error
- The Record batch is empty
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/b9b05a12a2439403.
Report an issue: GitHub.
Appendix: source
Thrown at core/parquet_file/src/serialize.rs:56
use crate::{
metadata::{IoxMetadata, METADATA_KEY},
storage::ParquetUploadInput,
writer::TrackedMemoryArrowWriter,
};
/// Parquet row group write size
pub const ROW_GROUP_WRITE_SIZE: usize = 1024 * 1024;
/// ensure read and write work well together
const _: () = assert!(ROW_GROUP_WRITE_SIZE.is_multiple_of(BATCH_SIZE));
/// [`RecordBatch`] to Parquet serialisation errors.
///
/// [`RecordBatch`]: arrow::record_batch::RecordBatch
#[derive(Debug, Error)]
pub enum CodecError {
/// The result stream contained no batches.
#[error("no record batches to convert")]
NoRecordBatches,
/// The result stream contained at least one [`RecordBatch`] and all
/// instances yielded by the stream contained 0 rows.
///
/// This would result in an empty file being uploaded to object store.
///
/// [`RecordBatch`]: arrow::record_batch::RecordBatch
#[error("no rows to serialise")]
NoRows,
/// A DataFusion error during the plan execution.
///
/// Of note: a ResourcesExhaused error likely means the buffer
/// used for parquet data became too large.
#[error(transparent)]
DataFusion(Box<DataFusionError>),
View on GitHub (pinned to 06200ef96b)