apache/beam · error · java.lang.UnsupportedOperationException
Data type: not supported yet!
Error message
Data type: ${sqlTypeName} not supported yet! What it means
BeamSortRel's row comparator supports only a fixed set of Calcite SQL types for comparison (e.g. numeric types, TIMESTAMP). When the ORDER BY (or comparison) involves a field whose sqlTypeName is not in the supported switch, the default branch throws this UnsupportedOperationException.
Solutions
- Order by a scalar column instead (e.g. extract a primitive field: ORDER BY struct_field.inner_field).
- Cast the column to a supported comparable type in the SQL query (e.g. CAST(bool_col AS TINYINT)).
- Pre-compute a comparable sort key (e.g. stringify bytes or hash of the complex value) in a prior transform and order by that.
- Add a case for the needed SqlTypeName in BeamSortRel's comparator if modifying the library is an option.
Example fix
-- before SELECT * FROM t ORDER BY nested_struct -- after SELECT * FROM t ORDER BY nested_struct.some_timestamp
Defensive patterns
Strategy: type-guard
Validate before calling
Set<SqlTypeName> sortable = EnumSet.of(DECIMAL, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, TIMESTAMP, DATE, TIME, VARCHAR, CHAR); if (!sortable.contains(fieldType.getSqlTypeName())) { throw new IllegalArgumentException("Cannot ORDER BY field of type " + fieldType.getSqlTypeName()); } Type guard
boolean isSortableType = sortableTypes.contains(orderByField.getType().getSqlTypeName());
Try / catch
try { sorted = pc.apply(SqlTransform.query("SELECT * FROM t ORDER BY " + col)); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith("Data type:")) { /* cast column or pick a scalar sort key */ } else { throw e; } } Prevention
- Order by primitive scalar columns only
- Cast complex columns to comparable types before ordering
- Extract a sort key from STRUCT/ARRAY fields in a prior transform
- Check the row Schema field types before generating ORDER BY SQL
When it happens
Trigger: ORDER BY (or BeamSortRel.compare) over a column whose Calcite type is not handled by the switch — commonly ARRAY/MAP/STRUCT/ROW, BINARY/VARBINARY, BOOLEAN or OTHER types in the sort key.
Common situations: Sorting by a complex-typed column (struct, array, map) parsed from JSON/Avro/Parquet sources, or ordering by a boolean/bytes column in BeamSql.
Related errors
- Does not support table_valued function
- `ORDER BY` is only supported for
- RexNode not supported
- Specifying alignment (offset) is not supported for session…
- the function in Measures is not recognized.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/e1510763744a6b28.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamSortRel.java:400
} else if (!isValue1Null && isValue2Null) {
fieldRet = 1 * (nullsFirst.get(i) ? -1 : 1);
} else {
switch (sqlTypeName) {
case TINYINT:
case SMALLINT:
case INTEGER:
case BIGINT:
case FLOAT:
case DOUBLE:
case VARCHAR:
case DATE:
case TIMESTAMP:
Comparable v1 = row1.getBaseValue(fieldIndex, Comparable.class);
Comparable v2 = row2.getBaseValue(fieldIndex, Comparable.class);
fieldRet = v1.compareTo(v2);
break;
default:
throw new UnsupportedOperationException(
"Data type: " + sqlTypeName + " not supported yet!");
}
}
fieldRet *= (orientation.get(i) ? 1 : -1);
if (fieldRet != 0) {
return fieldRet;
}
}
return 0;
}
}
private static class ReversedBeamSqlRowComparator implements Comparator<Row>, Serializable {
private final BeamSqlRowComparator comparator;
public ReversedBeamSqlRowComparator(View on GitHub (pinned to 12126d8942)