apache/druid · info

SQL text for query [ ] exceeds [%,d] bytes and will be…

Error message

SQL text for query [%s] exceeds [%,d] bytes and will be truncated in the sql job facet

What it means

The OpenLineage sql job facet has a maximum length (SQL_FACET_MAX_LENGTH). When a query's SQL text exceeds that limit, the facet embeds only the truncated SQL and this warning records that truncation occurred. The event is still emitted; only the facet text is cut.

Solutions

  1. Reduce query text size (parameterize literals instead of inlining them)
  2. Accept the truncation — lineage still records a query prefix; verify downstream consumers tolerate truncated sql
  3. If the max length is too small for your workflows, adjust SQL_FACET_MAX_LENGTH in the extension configuration and rebuild
  4. Downstream: match facet text against queryId, not the truncated SQL string
Defensive patterns

Strategy: validation

Validate before calling

if (sql != null && sql.length() > SQL_FACET_MAX_LENGTH) {
  sql = sql.substring(0, SQL_FACET_MAX_LENGTH); // pre-truncate before sending
}

Prevention

When it happens

Trigger: Running a SQL query whose text length exceeds SQL_FACET_MAX_LENGTH (very large literals, huge IN lists, generated SQL, comments, or machine-generated queries) while the OpenLineage request logger builds the job facet.

Common situations: BI tools or ORMs generating giant SQL statements; queries with thousands of values in an IN clause; users pasting large INSERT ... VALUES blocks.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at extensions-contrib/openlineage-emitter/src/main/java/org/apache/druid/extensions/openlineage/OpenLineageRequestLogger.java:411

  private ObjectNode buildJob(String queryId, @Nullable String sql)
  {
    ObjectNode job = jsonMapper.createObjectNode();
    job.put("namespace", namespace);
    job.put("name", queryId);

    ObjectNode facets = jsonMapper.createObjectNode();

    ObjectNode jobTypeFacet = createFacet(JOB_TYPE_FACET_SCHEMA_URL);
    jobTypeFacet.put("processingType", "BATCH");
    jobTypeFacet.put("integration", "DRUID");
    jobTypeFacet.put("jobType", "QUERY");
    facets.set("jobType", jobTypeFacet);

    if (sql != null) {
      ObjectNode sqlFacet = createFacet(SQL_FACET_SCHEMA_URL);
      if (sql.length() > SQL_FACET_MAX_LENGTH) {
        log.warn(
            "SQL text for query [%s] exceeds [%,d] bytes and will be truncated in the sql job facet",
            queryId,
            SQL_FACET_MAX_LENGTH
        );
        sqlFacet.put("query", sql.substring(0, SQL_FACET_MAX_LENGTH));
      } else {
        sqlFacet.put("query", sql);
      }
      facets.set("sql", sqlFacet);
    }

    job.set("facets", facets);
    return job;
  }

  private ObjectNode createFacet(@Nullable String schemaUrl)
  {
    ObjectNode facet = jsonMapper.createObjectNode();

View on GitHub (pinned to 9b90983fd2)