apache/flink · error · IllegalArgumentException
An ordering must not be created with a NONE order.
Error message
An ordering must not be created with a NONE order.
What it means
Thrown by Ordering.appendOrdering when the Order parameter is Order.NONE. NONE is a sentinel meaning 'no ordering', which is semantically invalid when constructing an actual ordering requirement. The only valid values are Order.ASCENDING and Order.DESCENDING (and non-null).
Source
Thrown at flink-core/src/main/java/org/apache/flink/api/common/operators/Ordering.java:73
/**
* Extends this ordering by appending an additional order requirement. If the index has been
* previously appended then the unmodified Ordering is returned.
*
* @param index Field index of the appended order requirement.
* @param type Type of the appended order requirement.
* @param order Order of the appended order requirement.
* @return This ordering with an additional appended order requirement.
*/
public Ordering appendOrdering(
Integer index, Class<? extends Comparable<?>> type, Order order) {
if (index < 0) {
throw new IllegalArgumentException("The key index must not be negative.");
}
if (order == null) {
throw new NullPointerException();
}
if (order == Order.NONE) {
throw new IllegalArgumentException(
"An ordering must not be created with a NONE order.");
}
if (!this.indexes.contains(index)) {
this.indexes = this.indexes.addField(index);
this.types.add(type);
this.orders.add(order);
}
return this;
}
// --------------------------------------------------------------------------------------------
public int getNumberOfFields() {
return this.indexes.size();
}
View on GitHub (pinned to 2f3c205e92)
Solutions
- Replace Order.NONE with Order.ASCENDING or Order.DESCENDING before calling appendOrdering.
- Skip the appendOrdering call entirely if no ordering is needed for that field.
- Validate the Order value: if (order == Order.NONE) order = Order.ASCENDING; or skip.
Example fix
// before Order o = config.isDescending() ? Order.DESCENDING : Order.NONE; ordering.appendOrdering(0, type, o); // after Order o = config.isDescending() ? Order.DESCENDING : Order.ASCENDING; ordering.appendOrdering(0, type, o);
Defensive patterns
Strategy: validation
Validate before calling
if (order == null || order == Order.NONE) {
throw new IllegalArgumentException(
"Order must be ASCENDING or DESCENDING, got: " + order);
} Type guard
static boolean isValidOrder(Order o) {
return o == Order.ASCENDING || o == Order.DESCENDING;
} Prevention
- Never pass Order.NONE to appendOrdering; use ASCENDING or DESCENDING.
- Skip the call entirely if no ordering is needed.
- Replace NONE defaults before constructing Ordering.
When it happens
Trigger: Calling appendOrdering(index, type, Order.NONE) or new Ordering(0, type, Order.NONE). Defaulting an Order variable to NONE and passing it through.
Common situations: Using Order.NONE as a default placeholder and forgetting to replace it. Deserialising an order value that maps to NONE.
Related errors
- The key index must not be negative.
- The output size cannot be smaller than zero.
- The output cardinality cannot be smaller than zero.
- The size of produced records must be positive.
- The filter factor cannot be smaller than zero.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/1e43ec658de52818.
Report an issue: GitHub.