apache/druid · error · UnsupportedOperationException

ORC flattener does not support JQ

Error message

ORC flattener does not support JQ

What it means

OrcStructFlattenerMaker.makeJsonQueryExtractor() is unimplemented: the ORC input format does not support JQ (JSON query) expressions in flatten specs. Calling it raises UnsupportedOperationException by design.

Source

Thrown at extensions-core/orc-extensions/src/main/java/org/apache/druid/data/input/orc/OrcStructFlattenerMaker.java:100

  {
    return toPlainJavaType(converter.convertRootField(obj, key));
  }

  @Override
  public Function<OrcStruct, Object> makeJsonPathExtractor(String expr)
  {
    final JsonPath jsonPath = JsonPath.compile(expr);
    return record -> {
      Object val = jsonPath.read(record, jsonPathConfiguration);
      return finalizeConversion(val);
    };
  }

  @Nullable
  @Override
  public Function<OrcStruct, Object> makeJsonQueryExtractor(String expr)
  {
    throw new UnsupportedOperationException("ORC flattener does not support JQ");
  }

  @Override
  public Function<OrcStruct, Object> makeJsonTreeExtractor(List<String> nodes)
  {
    if (nodes.size() == 1) {
      return (OrcStruct record) -> getRootField(record, nodes.get(0));
    }

    throw new UnsupportedOperationException("ORC flattener does not support nested root queries");
  }

  @Override
  public JsonProvider getJsonProvider()
  {
    return orcJsonProvider;
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Replace jq flatten expressions with 'path' or 'root' type expressions in the ORC flattenSpec
  2. Use the JSON parser/JQ support only for data formats that implement makeJsonQueryExtractor (e.g. JSON input)
  3. Pre-convert or extract needed fields before ORC ingestion if complex extraction is required

Example fix

// before
{"type":"jq","expr":".a[0].b"}
// after
{"type":"path","expr":"$.a"}
Defensive patterns

Strategy: validation

Validate before calling

final List<FlattenSpecFieldSpec> jqFields = flattenSpec.getFields().stream().filter(f -> "jq".equals(f.getType())).collect(Collectors.toList());
if (!jqFields.isEmpty()) { throw new IllegalArgumentException("jq flatten expressions are not supported for ORC input"); }

Type guard

boolean supportsJq(StableFlattenSpecMaker maker) { try { maker.makeJsonQueryExtractor("."); return true; } catch (UnsupportedOperationException e) { return false; } }

Try / catch

try { extractor = flattenerMaker.makeJsonQueryExtractor(expr); } catch (UnsupportedOperationException e) { extractor = usePathExtractorInstead(); }

Prevention

When it happens

Trigger: Configuring an ORC inputFormat with a flattenSpec that uses a jq-type flatten expression.

Common situations: Copying a JSON flattenSpec (using jq expressions) over to ORC data; someone attempts advanced JQ path extraction while ingesting ORC files.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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