apache/druid · warning · IllegalArgumentException

No order[ ] for column[ ]

Error message

No order[%s] for column[%s]

What it means

OrderBy.isExactReverse checks whether another OrderBy has the opposite direction on the same column. Its switch handles ASCENDING and DESCENDING; since the constructor forbids Order.NONE, reaching the default branch indicates an unexpected order value, and this defensive IllegalArgumentException is thrown.

Solutions

  1. Ensure the OrderBy object has ASCENDING or DESCENDING before calling isExactReverse.
  2. If a new Order constant was added, add a case for it in isExactReverse.
  3. Fix deserialization/creation paths that allow Order.NONE despite the constructor check.

Example fix

// before
if (orderBy.isExactReverse(other)) { ... } // orderBy.order == NONE
// after
if (orderBy.getOrder() != Order.NONE && orderBy.isExactReverse(other)) { ... }
Defensive patterns

Strategy: validation

Validate before calling

if (order == Order.NONE) { throw new IllegalArgumentException("Cannot compare NONE order"); }

Type guard

boolean isDirectional(OrderBy o) { return o.getOrder() != Order.NONE; }

Try / catch

try {
  boolean reverse = a.isExactReverse(b);
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("No order")) { reverse = false; }
  else { throw e; }
}

Prevention

When it happens

Trigger: Calling isExactReverse on an OrderBy whose order is Order.NONE (only possible via deserialization paths that bypass the constructor validation, or a newly added Order enum constant).

Common situations: Comparing sort specs built from deserialized query JSON where order was null/NONE; adding a new Order enum value without updating isExactReverse; reflection-built OrderBy objects.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

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

    return order;
  }

  /**
   * Returns true if the given {@link OrderBy} is the exact reverse, meaning they have the same column name
   * in revrersed order.
   */
  public boolean isExactReverse(OrderBy that)
  {
    if (!columnName.equals(that.columnName)) {
      return false;
    }
    switch (order) {
      case ASCENDING:
        return Order.DESCENDING.equals(that.order);
      case DESCENDING:
        return Order.ASCENDING.equals(that.order);
      default:
        throw new IAE("No order[%s] for column[%s]", order, columnName);
    }
  }

  @Override
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    OrderBy that = (OrderBy) o;
    return Objects.equals(columnName, that.columnName) && order == that.order;
  }

  @Override
  public int hashCode()

View on GitHub (pinned to 9b90983fd2)