apache/beam · error · UnsupportedOperationException

The category ' ' is not supported.

Error message

The category '{category}' is not supported.

What it means

SchemaUtils.toBeamField currently supports only the PRIMITIVE category of HCatFieldSchema. Complex categories (ARRAY, MAP, STRUCT, UNION) fall into the default branch and throw UnsupportedOperationException, since complex-type support is explicitly a TODO in this library.

Solutions

  1. Create a Hive view flattening or excluding complex columns and read that view
  2. Extract nested fields into separate scalar columns via HiveQL (LATERAL VIEW / explode)
  3. Contribute complex-type support by extending the switch in SchemaUtils with ARRAY/MAP/STRUCT handling
  4. Use a different Beam IO (e.g. read the underlying files with ParquetIO) if complex types are essential

Example fix

// before
CREATE TABLE t (tags array<string>);
// after
CREATE VIEW t_scalar AS SELECT ... other cols ... FROM t;
HCatalogIO.read().withTable("t_scalar")
Defensive patterns

Strategy: validation

Validate before calling

boolean simple = hcatSchema.getFields().stream().allMatch(f -> { try { return HCatSchemaUtils.getHCatFieldSchema(f).getCategory()==Category.PRIMITIVE; } catch (HCatException e){ return false; } });

Type guard

null

Try / catch

try { ... } catch (UnsupportedOperationException e) { throw new IllegalArgumentException("Complex types not supported by HCatalogIO; use a flattened view", e); }

Prevention

When it happens

Trigger: Calling HCatalogIO.read() on a table whose schema contains any complex-typed column (array<...>, map<...>, struct<...>, uniontype<...>).

Common situations: Hive tables with nested/array columns common in log or JSON-ingest tables; attempting full-table reads instead of selecting scalar columns.

Related errors


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

Appendix: source

Thrown at sdks/java/io/hcatalog/src/main/java/org/apache/beam/sdk/io/hcatalog/SchemaUtils.java:89

    switch (hCatFieldSchema.getCategory()) {
      case PRIMITIVE:
        {
          if (!HCAT_TO_BEAM_TYPES_MAP.containsKey(hCatFieldSchema.getType())) {
            throw new UnsupportedOperationException(
                "The Primitive HCat type '"
                    + field.getType()
                    + "' of field '"
                    + name
                    + "' cannot be converted to Beam FieldType");
          }

          FieldType fieldType = HCAT_TO_BEAM_TYPES_MAP.get(hCatFieldSchema.getType());
          return Schema.Field.of(name, fieldType).withNullable(true);
        }
        // TODO: Add Support for Complex Types i.e. ARRAY, MAP, STRUCT
      default:
        throw new UnsupportedOperationException(
            "The category '" + hCatFieldSchema.getCategory() + "' is not supported.");
    }
  }
}

View on GitHub (pinned to 12126d8942)