apache/beam · error · UnsupportedOperationException

The type is not supported: ${typeName}

Error message

The type is not supported: ${typeName}

What it means

NFA.toCEPLiteral converts an event row field into a CEPLiteral for condition evaluation. It supports DATE/TIME/TIMESTAMP, BOOLEAN, and STRING cases (plus numeric cases above the shown region); any other primitive type in the row schema falls into the default branch and throws UnsupportedOperationException naming the type.

Source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/nfa/NFA.java:197

          return CEPLiteral.of(row.getInt16(fieldIndex));
        case INT32:
          return CEPLiteral.of(row.getInt32(fieldIndex));
        case INT64:
          return CEPLiteral.of(row.getInt64(fieldIndex));
        case DECIMAL:
          return CEPLiteral.of(row.getDecimal(fieldIndex));
        case FLOAT:
          return CEPLiteral.of(row.getFloat(fieldIndex));
        case DOUBLE:
          return CEPLiteral.of(row.getDouble(fieldIndex));
        case DATETIME:
          return CEPLiteral.of(row.getDateTime(fieldIndex));
        case BOOLEAN:
          return CEPLiteral.of(row.getBoolean(fieldIndex));
        case STRING:
          return CEPLiteral.of(row.getString(fieldIndex));
        default:
          throw new UnsupportedOperationException(
              "The type is not supported: " + type.getTypeName().toString());
      }
    }

    private Event findEvent(EventPointer eventPointer) {
      return prevEvents.getOrDefault(eventPointer, null);
    }

    private EventPointer findEventPointer(EventPointer pointer) {
      for (EventPointer i : prevEvents.keySet()) {
        if (i.equals(pointer)) {
          return i.copy();
        }
      }
      return null;
    }

    public EventPointer getPrevPointer(EventPointer curPointer) {

View on GitHub (pinned to 12126d8942)

Solutions

  1. Change the referenced field's schema type to a supported primitive (e.g. use STRING instead of BYTES/ARRAY).
  2. Pre-process the PCollection to flatten/convert complex fields into supported primitives before MATCH_RECOGNIZE.
  3. Extend NFA.toCEPLiteral with a case for the needed type (e.g. BYTE_ARRAY).
  4. Validate the input schema fields used in DEFINE/MEASURES against the supported type set at pipeline-construction time.

Example fix

// before (schema)
.addField("tags", FieldType.array(FieldType.STRING))
// after
.addField("tags", FieldType.STRING) // e.g. joined/encoded, and update DEFINE accordingly
Defensive patterns

Strategy: validation

Validate before calling

// Before MATCH_RECOGNIZE, assert condition fields use supported types
Set<String> ok = Set.of("INT32","INT64","FLOAT","DOUBLE","BOOLEAN","STRING","DATE","TIME","TIMESTAMP");
for (String f : conditionFields) check(ok.contains(schema.getField(f).getType().getTypeName().toString()), f);

Type guard

boolean isCepSupportedType(FieldType t) { return switch (t.getTypeName()) { case INT32, INT64, FLOAT, DOUBLE, BOOLEAN, STRING, DATETIME -> true; default -> false; }; }

Try / catch

try { return nfa.eval(...); } catch (UnsupportedOperationException e) { throw new SchemaValidationException("Condition field type unsupported: " + e.getMessage(), e); }

Prevention

When it happens

Trigger: A DEFINE/MEASURES condition references a field whose Beam row type is not one of the supported CEP literal types (e.g. BYTES, ARRAY, MAP, ROW, or an unsupported logical type).

Common situations: MATCH_RECOGNIZE over PCollections containing array/map/struct columns referenced in conditions; schema evolution adding a complex field later used in DEFINE.

Related errors


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