apache/beam · error · IllegalArgumentException

The 'sequence' generator for integers only supports integer…

Error message

The 'sequence' generator for integers only supports integer types, but field '%s' is of type '%s'.

What it means

The 'sequence' field kind cycles through integer values, so it is only valid on Calcite INT_TYPES columns (TINYINT, SMALLINT, INTEGER, BIGINT). Applying kind='sequence' to any other type (VARCHAR, DOUBLE, TIMESTAMP, ...) throws an IllegalArgumentException during generator creation.

Solutions

  1. Change the field's SQL type to TINYINT/SMALLINT/INTEGER/BIGINT.
  2. Use kind='random' (default) for non-integer fields instead of 'sequence'.
  3. Remove the fields.<name>.kind='sequence' property for that field.

Example fix

// before
'{"fields":{"name":{"kind":"sequence"}}}'  -- name VARCHAR
// after
'{"fields":{"name":{"kind":"random"}}}'
Defensive patterns

Strategy: validation

Validate before calling

if ("sequence".equals(kind) && !SqlTypeName.INT_TYPES.contains(sqlTypeName)) {
  throw new IllegalArgumentException("sequence requires integer type: " + fieldName);
}

Type guard

boolean supportsSequence(Schema.Field f) {
  return SqlTypeName.INT_TYPES.contains(CalciteUtils.toSqlTypeName(f.getType()));
}

Try / catch

try { buildRowFn(props); } catch (IllegalArgumentException e) { /* switch kind to random or fix column type */ }

Prevention

When it happens

Trigger: Setting TBLPROPERTIES '{"fields.<name>.kind":"sequence"}' on a datagen table field whose SQL type is not an integer type.

Common situations: Copy-pasting a sequence config from an integer column onto a string or float column; renaming a column's type in DDL but keeping the old generator config.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datagen/DataGeneratorRowFn.java:118

  }

  private FieldGenerator createValueGeneratorForField(Schema.Field field) {
    String fieldName = field.getName();
    String kind = properties.path("fields." + fieldName + ".kind").asText("random");

    final SqlTypeName sqlTypeName = CalciteUtils.toSqlTypeName(field.getType());
    if (sqlTypeName == null) {
      throw new UnsupportedOperationException(
          "Data generator requires a defined SQL type. Beam type '"
              + field.getType().getTypeName()
              + "' on field '"
              + field.getName()
              + "' is not supported.");
    }

    if ("sequence".equalsIgnoreCase(kind)) {
      if (!SqlTypeName.INT_TYPES.contains(sqlTypeName)) {
        throw new IllegalArgumentException(
            String.format(
                "The 'sequence' generator for integers only supports integer types, but field '%s' is of type '%s'.",
                field.getName(), sqlTypeName));
      }

      JsonNode startNode = properties.path("fields." + fieldName + ".start");
      JsonNode endNode = properties.path("fields." + fieldName + ".end");

      if (startNode.isMissingNode() && endNode.isMissingNode()) {
        return (index) -> index;
      }

      if (startNode.isMissingNode() || endNode.isMissingNode()) {
        throw new IllegalArgumentException(
            "For a cycling sequence generator, both 'start' and 'end' must be specified.");
      }

      long start = startNode.asLong(0L);

View on GitHub (pinned to 12126d8942)