apache/beam · error · UnsupportedOperationException

Column type is not supported yet!

Error message

Column type %s is not supported yet!

What it means

autoCastField's string-casting switch only supports STRING, INTEGER, LONG, FLOAT and DOUBLE schema types; any other column type encountered while casting a raw value throws UnsupportedOperationException stating the type is unsupported.

Solutions

  1. Upgrade Beam to a version where autoCastField supports the needed type
  2. Pre-convert unsupported columns to STRING in the schema and cast after parsing
  3. Transform values (e.g. parse dates) in a custom DoFn instead of relying on CSV auto-cast

Example fix

// before
Schema.Field.of("ts", Schema.FieldType.DATETIME) // unsupported in CSV auto-cast
// after
Schema.Field.of("ts_str", Schema.FieldType.STRING) // parse with ParDo afterwards
Defensive patterns

Strategy: validation

Validate before calling

schema.getFields().forEach(f -> { switch (f.getType().getTypeName()) { case STRING: case INTEGER: case LONG: case FLOAT: case DOUBLE: break; default: throw new UnsupportedOperationException("CSV auto-cast unsupported: " + f.getType()); } });

Type guard

boolean csvCastable(Schema.FieldType t) { return java.util.Set.of(TypeName.STRING, TypeName.INTEGER, TypeName.INT64, TypeName.FLOAT, TypeName.DOUBLE).contains(t.getTypeName()); }

Try / catch

try { rows = BeamTableUtils.csvLines2BeamRows(...); } catch (UnsupportedOperationException e) { /* use STRING fields + custom cast DoFn */ }

Prevention

When it happens

Trigger: Loading CSV data into a schema containing types like BOOLEAN, DATETIME, DECIMAL, or BYTES for which the cast branch has no case — the default branch fires.

Common situations: Schemas with date/timestamp or boolean columns read from plain CSV text; newer Beam versions add types not yet handled by this util (or vice versa, older Beam missing newer types).

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/schema/BeamTableUtils.java:171

      String raw = rawObj.toString();
      if (raw.trim().isEmpty()) {
        return null;
      }
      switch (type.getTypeName()) {
        case BYTE:
          return Byte.valueOf(raw);
        case INT16:
          return Short.valueOf(raw);
        case INT32:
          return Integer.valueOf(raw);
        case INT64:
          return Long.valueOf(raw);
        case FLOAT:
          return Float.valueOf(raw);
        case DOUBLE:
          return Double.valueOf(raw);
        default:
          throw new UnsupportedOperationException(
              String.format("Column type %s is not supported yet!", type));
      }
    } else if (type.getTypeName().isPrimitiveType()) {
      // handle bytes represented by ByteString
      if (TypeName.BYTES.equals(type.getTypeName()) && rawObj instanceof ByteString) {
        return ((ByteString) rawObj).getBytes();
        // handle Float <-> Double mixed use
      } else if (TypeName.FLOAT.equals(type.getTypeName()) && rawObj instanceof Double) {
        return ((Double) rawObj).floatValue();
      } else if (TypeName.DOUBLE.equals(type.getTypeName()) && rawObj instanceof Float) {
        return ((Float) rawObj).doubleValue();
      }
    }
    return rawObj;
  }
}

View on GitHub (pinned to 12126d8942)