apache/beam · error · UnsupportedOperationException

Field mode ' ' is not supported (field ' ')

Error message

Field mode '{columnMode}' is not supported (field '{name}')

What it means

toBeamField maps a Data Catalog ColumnSchema to a Beam field and found a mode value other than the recognized NULLABLE/REQUIRED/REPEATED (e.g. unknown or null on a column where mode matters for nullability/list conversion). The column's mode string is the faulty input and cannot be represented in a Beam schema field.

Solutions

  1. Set the column mode to one of NULLABLE, REQUIRED, or REPEATED in the Data Catalog schema
  2. Ensure the mode field is not empty/unset when the column is created
  3. Pre-convert the schema to only use supported modes before registering the entry

Example fix

// before
column.setMode('OPTIONAL')
// after
column.setMode('NULLABLE')
Defensive patterns

Strategy: validation

Validate before calling

for (ColumnSchema c : schema.getColumnsList()) {
  String m = c.getMode();
  if (!"NULLABLE".equals(m) && !"REQUIRED".equals(m) && !"REPEATED".equals(m)) {
    throw new IllegalArgumentException("Bad mode '" + m + "' for field " + c.getColumn());
  }
}

Type guard

static boolean hasSupportedMode(ColumnSchema c) {
  return java.util.Arrays.asList("NULLABLE","REQUIRED","REPEATED").contains(c.getMode());
}

Try / catch

try {
  Schema s = SchemaUtils.fromDataCatalog(dcSchema);
} catch (UnsupportedOperationException ex) {
  LOG.error("Unsupported column mode in DC schema", ex);
}

Prevention

When it happens

Trigger: A column in the Data Catalog schema has getMode() returning an unexpected string (e.g. legacy, custom, or unset-but-nonstandard mode) when converting to a Beam Schema.

Common situations: Schemas written by other tools into Data Catalog with non-standard mode values, or proto fields left unset producing a mode string outside the three known ones.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/SchemaUtils.java:79

    return columnsMap.stream().map(SchemaUtils::toBeamField).collect(toSchema());
  }

  private static Field toBeamField(ColumnSchema column) {
    String name = column.getColumn();

    // basic field type
    FieldType fieldType = getBeamFieldType(column);
    Field field = Field.of(name, fieldType);

    // set the nullable flag, or convert to a list if repeated
    if (Strings.isNullOrEmpty(column.getMode()) || "NULLABLE".equals(column.getMode())) {
      field = field.withNullable(true);
    } else if ("REQUIRED".equals(column.getMode())) {
      field = field.withNullable(false);
    } else if ("REPEATED".equals(column.getMode())) {
      field = Field.of(name, FieldType.array(fieldType));
    } else {
      throw new UnsupportedOperationException(
          "Field mode '" + column.getMode() + "' is not supported (field '" + name + "')");
    }

    return field;
  }

  private static FieldType getBeamFieldType(ColumnSchema column) {
    String dcFieldType = column.getType();

    if (FIELD_TYPES.containsKey(dcFieldType)) {
      return FIELD_TYPES.get(dcFieldType);
    }

    if ("STRUCT".equals(dcFieldType)) {
      Schema structSchema = fromColumnsList(column.getSubcolumnsList());
      return FieldType.row(structSchema);
    }

View on GitHub (pinned to 12126d8942)