apache/druid · error · IllegalArgumentException

Order required for column

Error message

Order required for column [%s]

What it means

OrderBy specifies a sort column and direction for a Sort/OrderBy component of a query. The constructor validates that the order is non-null and not Order.NONE — a column with 'no ordering' is meaningless in an explicit sort spec, so this IllegalArgumentException is thrown.

Solutions

  1. Use Order.ASCENDING or Order.DESCENDING instead of Order.NONE.
  2. If the column shouldn't be sorted, remove it from the sort spec entirely rather than using NONE.
  3. Fix client serialization that maps missing order fields to NONE.

Example fix

// before
new OrderBy("col", Order.NONE);
// after
new OrderBy("col", Order.ASCENDING);
Defensive patterns

Strategy: validation

Validate before calling

if (order == null || order == Order.NONE) {
  throw new IllegalArgumentException("Order required for column " + columnName);
}

Prevention

When it happens

Trigger: Constructing new OrderBy(column, Order.NONE) programmatically, or deserializing JSON with "order":"none" (or an order field resolving to NONE) in a query's sort spec.

Common situations: Code building OrderBy from user input where the direction defaults to NONE; JSON payloads that omit or misuse the order enum; developers thinking NONE means 'default order' rather than an invalid sort direction.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/090ff61ab086d255. Report an issue: GitHub.

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/query/OrderBy.java:56

  public static OrderBy descending(String columnName)
  {
    return new OrderBy(columnName, Order.DESCENDING);
  }

  private final String columnName;
  private final Order order;

  @JsonCreator
  public OrderBy(
      @JsonProperty("columnName") final String columnName,
      @JsonProperty("order") final Order order
  )
  {
    this.columnName = Preconditions.checkNotNull(columnName, "columnName");
    this.order = Preconditions.checkNotNull(order, "order");

    if (order == Order.NONE) {
      throw new IAE("Order required for column [%s]", columnName);
    }
  }

  @JsonProperty
  public String getColumnName()
  {
    return columnName;
  }

  @JsonProperty
  public Order getOrder()
  {
    return order;
  }

  /**
   * Returns true if the given {@link OrderBy} is the exact reverse, meaning they have the same column name
   * in revrersed order.

View on GitHub (pinned to 9b90983fd2)