influxdata/influxdb · error

Key column, , of current batch has no data

Error message

Key column, {name}, of current batch has no data

What it means

During deduplication, each incoming batch's sort-key column is extracted for comparison; if the key column array in the current batch is empty (zero rows), the algorithm cannot compare against the last batch and panics naming the column.

Solutions

  1. Drop zero-row batches from the input before deduplicate.
  2. Verify the sort key expressions match actual populated columns in every batch.
  3. Check upstream projections that may have emptied the key column and fix the projection list.
  4. In fork maintenance, convert this panic into a descriptive DataFusionError.

Example fix

// before
let result = deduplicate(&all_batches, &sort_key)?;
// after
assert!(all_batches.iter().all(|b| b.num_rows() > 0), "empty batch in dedup input");
let result = deduplicate(&all_batches, &sort_key)?;
Defensive patterns

Strategy: validation

Validate before calling

for b in &batches {
    for name in key_column_names {
        let idx = b.schema().index_of(name).unwrap();
        assert!(b.column(idx).len() > 0, "key column {name} empty in batch");
    }
}

Try / catch

// panic-based: pre-check each batch's key columns are non-empty
assert!(batches.iter().all(|b| key_cols_non_empty(b)));
deduplicate(&batches, &sort_key)?;

Prevention

When it happens

Trigger: Calling deduplicate where any batch in the input has zero rows for a declared sort-key column, even though other columns may have data.

Common situations: Projection or dictionary-wrapping upstream producing empty key arrays; malformed batches constructed in tests; schema/batch mismatch after a column was dropped from data but not from the sort key spec.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/825e048fb67bde5a. Report an issue: GitHub.

Appendix: source

Thrown at core/iox_query/src/provider/deduplicate/algo.rs:144

                        options: skey.options,
                    }
                })
                .collect::<Vec<_>>();

            // Build sorted columns for current batch
            // Schema of both batches are the same
            let batch_key_columns = self
                .sort_keys
                .iter()
                .map(|skey| {
                    // figure out the index of the key columns
                    let name = get_col_name(skey.expr.as_ref());
                    let index = schema.index_of(name).unwrap();

                    // Key column of current batch of this index
                    let array = batch.column(index);
                    if array.is_empty() {
                        panic!("Key column, {name}, of current batch has no data");
                    }
                    DedupSortColumn {
                        array,
                        options: skey.options,
                    }
                })
                .collect::<Vec<_>>();

            // Zip the 2 key sets of columns for comparison
            let zipped = last_batch_key_columns.iter().zip(batch_key_columns.iter());

            // Compare sort keys of the first row of the given batch the the last_batch
            // Note that the batches are sorted and all rows of last_batch have the same sort keys so
            // only need to compare last row of the last_batch with the first row of the current batch
            let mut same = true;
            for (l, r) in zipped {
                let last_idx = l.array.len() - 1;
                let c = arrow::array::make_comparator(l.array, r.array, l.options)?;

View on GitHub (pinned to 06200ef96b)