{"record":{"id":"08f2af4ced83ab74","repo":"apache/druid","slug":"partition-column-s-not-found-in-rac","errorCode":null,"errorMessage":"Partition column [%s] not found in RAC.","messagePattern":"Partition column \\[(.+?)\\] not found in RAC\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/operator/GlueingPartitioningOperator.java","lineNumber":241,"sourceCode":"\n      // If previousRac is null, just return the next partitioned RAC.\n      currentIndex++;\n      return new LimitedRowsAndColumns(rac, start, end);\n    }\n\n    /**\n     * Determines whether glueing is needed between 2 RACs represented as a ConcatRowsAndColumns, by comparing a row belonging to each RAC.\n     * We do this by comparing the first and last rows of the Concat RAC, as they would belong to the two respective RACs.\n     * If the columns match, we can glue the 2 RACs and use the ConcatRAC.\n     * @param rac A {@link ConcatRowsAndColumns containing 2 RACs}\n     * @return true if gluing is needed, false otherwise.\n     */\n    private boolean isGlueingNeeded(ConcatRowsAndColumns rac)\n    {\n      for (String column : partitionColumns) {\n        final Column theCol = rac.findColumn(column);\n        if (theCol == null) {\n          throw new ISE(\"Partition column [%s] not found in RAC.\", column);\n        }\n        final ColumnAccessor accessor = theCol.toAccessor();\n        int comparison = accessor.compareRows(0, rac.numRows() - 1);\n        if (comparison != 0) {\n          return false;\n        }\n      }\n      return true;\n    }\n\n    private ConcatRowsAndColumns getConcatRacForFirstPartition(RowsAndColumns previousRac, RowsAndColumns firstPartitionOfCurrentRac)\n    {\n      if (previousRac == null) {\n        return new ConcatRowsAndColumns(new ArrayList<>(Collections.singletonList(firstPartitionOfCurrentRac)));\n      }\n      return new ConcatRowsAndColumns(new ArrayList<>(Arrays.asList(previousRac, firstPartitionOfCurrentRac)));\n    }\n  }","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/operator/GlueingPartitioningOperator.java#L223-L259","documentation":"GlueingPartitioningOperator.isGlueingNeeded checks whether rows are already sorted by the partition columns by comparing the first and last row values in the RowsAndColumns holder. If any configured partition column is absent from the RAC it cannot validate the ordering and throws this ISE.","triggerScenarios":"Running a window operator query whose partition columns list includes a column that does not exist in the incoming RowsAndColumns (e.g. a typo'd column name or a column dropped by an upstream operator/transform).","commonSituations":"Referencing a column that was filtered out or renamed by an earlier projection, misspelled PARTITION BY columns in window function SQL, or segments whose signatures don't include the partition key.","solutions":["Verify every partition column exists in the query's row signature and segment columns before the window operator","Fix the partition column name (check spelling/case) in the query or operator factory","Ensure upstream operators (projections/transforms) do not drop columns needed for partitioning"],"exampleFix":"// before\nOVER (PARTITION BY partCol ORDER BY ts) // partCol missing from segment\n// after\nOVER (PARTITION BY partitionKey ORDER BY ts) // column present in datasource","handlingStrategy":"validation","validationCode":"for (String col : partitionColumns) {\n  if (!rowSignature.getColumnNames().contains(col)) {\n    throw new IllegalArgumentException(\"Partition column missing from segment signature: \" + col);\n  }\n}","typeGuard":"boolean hasAllPartitionColumns(RowSignature sig, List<String> cols) {\n  return cols.stream().allMatch(c -> sig.indexOf(c) >= 0);\n}","tryCatchPattern":"try {\n  windowQuery.run();\n} catch (ISE e) {\n  if (e.getMessage().startsWith(\"Partition column\")) {\n    throw new QueryPlanningException(\"Bad PARTITION BY column: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Verify PARTITION BY columns exist in the datasource/row signature at planning time","Ensure upstream projections and transforms preserve partition columns","Use the segment's column list to validate operator factory configuration in tests"],"tags":["window-operator","partitioning","missing-column"],"backgroundTag":"resource-not-found","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"}