apache/druid · error · UnsupportedOperationException (UOE)

Scan query result format

Error message

Scan query result format [%s] is not supported.

What it means

ScanQuery.ResultFormat.fromString maps the resultFormat string of a scan query to an enum. Only compactedList, valueVector, list (and their constants) are accepted; anything else throws UOE. This validates the query-level scan result format before results are serialized.

Solutions

  1. Use one of: compactedList, list, valueVector
  2. Check the server's supported formats for the version in use
  3. Fix the resultFormat field in the query JSON

Example fix

// before
{"queryType":"scan","resultFormat":"csv", ...}
// after
{"queryType":"scan","resultFormat":"compactedList", ...}
Defensive patterns

Strategy: validation

Validate before calling

final Set<String> VALID_FORMATS = Set.of("compactedList","list","valueVector");
if (!VALID_FORMATS.contains(query.getResultFormat())) {
  throw new IllegalArgumentException("unsupported scan resultFormat: " + query.getResultFormat());
}

Try / catch

try {
  submitScanQuery(q);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("result format") && e.getMessage().contains("not supported")) {
    submitScanQuery(q.withResultFormat("compactedList"));
  } else throw e;
}

Prevention

When it happens

Trigger: A scan query JSON contains "resultFormat": "<unsupported>" (typo or format unsupported by this Druid version) passed through ResultFormat.fromString.

Common situations: Client sending "array" or "csv" (not supported for scan) ; typo like "compactedlist"; newer client formats against an older server.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java:96

        case RESULT_FORMAT_VALUE_VECTOR:
          return "valueVector";
        default:
          return "";
      }
    }

    @JsonCreator
    public static ResultFormat fromString(String name)
    {
      switch (name) {
        case "compactedList":
          return RESULT_FORMAT_COMPACTED_LIST;
        case "valueVector":
          return RESULT_FORMAT_VALUE_VECTOR;
        case "list":
          return RESULT_FORMAT_LIST;
        default:
          throw new UOE("Scan query result format [%s] is not supported.", name);
      }
    }
  }

  /**
   * This context flag corresponds to whether the query is running on the "outermost" process (i.e. the process
   * the query is sent to).
   */
  public static final String CTX_KEY_OUTERMOST = "scanOutermost";
  public static final int DEFAULT_BATCH_SIZE = 4096 * 5;

  private final VirtualColumns virtualColumns;
  private final ResultFormat resultFormat;
  private final int batchSize;
  private final long scanRowsOffset;
  private final long scanRowsLimit;
  private final DimFilter dimFilter;
  private final List<String> columns;

View on GitHub (pinned to 9b90983fd2)