{"record":{"id":"67ea6ae4d0d1ff76","repo":"apache/druid","slug":"sql-text-for-query-s-exceeds-d-bytes-and-wi","errorCode":null,"errorMessage":"SQL text for query [%s] exceeds [%,d] bytes and will be truncated in the sql job facet","messagePattern":"SQL text for query \\[(.+?)\\] exceeds \\[%,d\\] bytes and will be truncated in the sql job facet","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"extensions-contrib/openlineage-emitter/src/main/java/org/apache/druid/extensions/openlineage/OpenLineageRequestLogger.java","lineNumber":411,"sourceCode":"\n  private ObjectNode buildJob(String queryId, @Nullable String sql)\n  {\n    ObjectNode job = jsonMapper.createObjectNode();\n    job.put(\"namespace\", namespace);\n    job.put(\"name\", queryId);\n\n    ObjectNode facets = jsonMapper.createObjectNode();\n\n    ObjectNode jobTypeFacet = createFacet(JOB_TYPE_FACET_SCHEMA_URL);\n    jobTypeFacet.put(\"processingType\", \"BATCH\");\n    jobTypeFacet.put(\"integration\", \"DRUID\");\n    jobTypeFacet.put(\"jobType\", \"QUERY\");\n    facets.set(\"jobType\", jobTypeFacet);\n\n    if (sql != null) {\n      ObjectNode sqlFacet = createFacet(SQL_FACET_SCHEMA_URL);\n      if (sql.length() > SQL_FACET_MAX_LENGTH) {\n        log.warn(\n            \"SQL text for query [%s] exceeds [%,d] bytes and will be truncated in the sql job facet\",\n            queryId,\n            SQL_FACET_MAX_LENGTH\n        );\n        sqlFacet.put(\"query\", sql.substring(0, SQL_FACET_MAX_LENGTH));\n      } else {\n        sqlFacet.put(\"query\", sql);\n      }\n      facets.set(\"sql\", sqlFacet);\n    }\n\n    job.set(\"facets\", facets);\n    return job;\n  }\n\n  private ObjectNode createFacet(@Nullable String schemaUrl)\n  {\n    ObjectNode facet = jsonMapper.createObjectNode();","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/openlineage-emitter/src/main/java/org/apache/druid/extensions/openlineage/OpenLineageRequestLogger.java#L393-L429","documentation":"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.","triggerScenarios":"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.","commonSituations":"BI tools or ORMs generating giant SQL statements; queries with thousands of values in an IN clause; users pasting large INSERT ... VALUES blocks.","solutions":["Reduce query text size (parameterize literals instead of inlining them)","Accept the truncation — lineage still records a query prefix; verify downstream consumers tolerate truncated sql","If the max length is too small for your workflows, adjust SQL_FACET_MAX_LENGTH in the extension configuration and rebuild","Downstream: match facet text against queryId, not the truncated SQL string"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (sql != null && sql.length() > SQL_FACET_MAX_LENGTH) {\n  sql = sql.substring(0, SQL_FACET_MAX_LENGTH); // pre-truncate before sending\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Parameterize SQL instead of inlining large literals","Match lineage facets by queryId, not SQL text","Size SQL_FACET_MAX_LENGTH to your workload"],"tags":["openlineage","truncation","sql","lineage"],"backgroundTag":"payload-too-large","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}