apache/iceberg · warning

The average length of the rows appears to be zero.

Error message

The average length of the rows appears to be zero.

What it means

During OrcFileAppender construction, the estimated average row byte size computed by EstimateOrcAvgWidthVisitor summed to zero. The appender only logs a warning (writing continues), but memory estimation for the writer will be inaccurate, potentially affecting row-group sizing decisions.

Solutions

  1. Inspect the ORC schema being written; ensure it contains estimable primitive columns
  2. Upgrade Iceberg — the width estimator may have been extended for more types
  3. Ignore the warning if data is written correctly; it only affects size estimates
Defensive patterns

Strategy: validation

Validate before calling

if (schema.columns().stream().allMatch(c -> c.type().isNestedType())) { LOG.warn("ORC avg-width estimate may be zero for this schema"); }

Prevention

When it happens

Trigger: Creating an ORC writer for a schema where all columns' estimated widths are 0 — e.g. a schema with only columns the width visitor does not estimate (certain nested/complex types), or an effectively empty/odd orcSchema.

Common situations: Writing tables whose schema contains only types unsupported by the width estimator; writing empty schemas; misconfigured ORC schema conversion producing an all-unknown schema.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/2c978650a1bb8175. Report an issue: GitHub.

Appendix: source

Thrown at orc/src/main/java/org/apache/iceberg/orc/OrcFileAppender.java:78

      Schema schema,
      OutputFile file,
      BiFunction<Schema, TypeDescription, OrcRowWriter<?>> createWriterFunc,
      Configuration conf,
      Map<String, byte[]> metadata,
      int batchSize,
      MetricsConfig metricsConfig) {
    this.file = file;
    this.batchSize = batchSize;
    this.metricsConfig = metricsConfig;

    TypeDescription orcSchema = ORCSchemaUtil.convert(schema);

    this.avgRowByteSize =
        OrcSchemaVisitor.visitSchema(orcSchema, new EstimateOrcAvgWidthVisitor()).stream()
            .reduce(Integer::sum)
            .orElse(0);
    if (avgRowByteSize == 0) {
      LOG.warn("The average length of the rows appears to be zero.");
    }

    this.batch = orcSchema.createRowBatch(this.batchSize);

    OrcFile.WriterOptions options = OrcFile.writerOptions(conf).useUTCTimestamp(true);
    if (file instanceof HadoopOutputFile) {
      options.fileSystem(((HadoopOutputFile) file).getFileSystem());
    }
    options.setSchema(orcSchema);
    this.writer = ORC.newFileWriter(file, options, metadata);
    this.valueWriter = newOrcRowWriter(schema, orcSchema, createWriterFunc);
  }

  @Override
  public void add(D datum) {
    try {
      valueWriter.write(datum, batch);
      if (batch.size == this.batchSize) {

View on GitHub (pinned to 86d9c8fc54)