apache/beam · error · IllegalArgumentException

Unsupported integer bit width: ${type.getBitWidth()}

Error message

Unsupported integer bit width: ${type.getBitWidth()}

What it means

Thrown by ArrowConversion when converting an Arrow Int type to a Beam Schema FieldType and the Arrow integer's bit width is not 16, 32, or 64. The visitor handles 8-bit and unsigned variants by rejecting them because Beam has no direct mapping for those widths in this path.

Source

Thrown at sdks/java/extensions/arrow/src/main/java/org/apache/beam/sdk/extensions/arrow/ArrowConversion.java:188

                        toBeamField(childrenFields.get(1)).getType());
                  }

                  @Override
                  public FieldType visit(ArrowType.Int type) {
                    if (!type.getIsSigned()) {
                      throw new IllegalArgumentException("Unsigned integers are not supported.");
                    }
                    switch (type.getBitWidth()) {
                      case 8:
                        return FieldType.BYTE;
                      case 16:
                        return FieldType.INT16;
                      case 32:
                        return FieldType.INT32;
                      case 64:
                        return FieldType.INT64;
                      default:
                        throw new IllegalArgumentException(
                            "Unsupported integer bit width: " + type.getBitWidth());
                    }
                  }

                  @Override
                  public FieldType visit(ArrowType.FloatingPoint type) {
                    switch (type.getPrecision()) {
                      case SINGLE:
                        return FieldType.FLOAT;
                      case DOUBLE:
                        return FieldType.DOUBLE;
                      default:
                        throw new IllegalArgumentException(
                            "Unsupported floating-point precision: " + type.getPrecision().name());
                    }
                  }

                  @Override

View on GitHub (pinned to 12126d8942)

Solutions

  1. Check the Arrow schema of your data and widen 8-bit integer columns to 16/32/64-bit before conversion (e.g. via Arrow's field/type transform).
  2. If you control the producer, change the source schema to emit int16/int32/int64 columns.
  3. Patch ArrowConversion to map 8-bit ints to FieldType.INT16 or INT32 if widening in Beam is acceptable, and file/track an upstream Beam issue.

Example fix

// before
Field a = Field.nullable("a", new ArrowType.Int(8, true));
// after
Field a = Field.nullable("a", new ArrowType.Int(16, true)); // or 32/64
Defensive patterns

Strategy: validation

Validate before calling

for (Field f : schema.getFields()) {
  if (f.getType() instanceof ArrowType.Int
      && !Set.of(16, 32, 64).contains(((ArrowType.Int) f.getType()).getBitWidth())) {
    throw new IllegalArgumentException(
        "Column " + f.getName() + " has unsupported int bit width "
        + ((ArrowType.Int) f.getType()).getBitWidth() + "; widen to 16/32/64 first");
  }
}

Type guard

boolean isConvertibleInt(ArrowType t) {
  return t instanceof ArrowType.Int
      && Set.of(16, 32, 64).contains(((ArrowType.Int) t).getBitWidth());
}

Try / catch

try {
  Schema beamSchema = ArrowConversion.toBeamSchema(arrowSchema);
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Unsupported integer bit width")) {
    arrowSchema = widenNarrowInts(arrowSchema); // then retry conversion
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the Arrow-to-Beam schema conversion (toBeamSchema / Row writer) on an Arrow field whose type is ArrowType.Int with getBitWidth() of 8, or any width outside {16,32,64} (e.g. bit width 8 from a tinyint column).

Common situations: Reading Arrow data produced by systems emitting 8-bit integers (e.g. Parquet tinyint, C-side int8), or a dependency upgrade in Arrow introducing new integer widths that this converter does not whitelist.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/ce86da79ca367458. Report an issue: GitHub.