{"record":{"id":"48c0ec47dea6bacb","repo":"apache/druid","slug":"the-select-query-has-been-removed-use-scan-in","errorCode":null,"errorMessage":"The 'select' query has been removed, use 'scan' instead. See https://druid.apache.org/docs/latest/querying/select-query.html for more details.","messagePattern":"The 'select' query has been removed, use 'scan' instead\\. See https://druid\\.apache\\.org/docs/latest/querying/select-query\\.html for more details\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"processing/src/main/java/org/apache/druid/query/select/SelectQuery.java","lineNumber":50,"sourceCode":"import org.joda.time.Duration;\nimport org.joda.time.Interval;\n\nimport javax.annotation.Nullable;\n\nimport java.util.List;\nimport java.util.Map;\n\n@Deprecated\npublic class SelectQuery implements Query<Object>\n{\n  static final String REMOVED_ERROR_MESSAGE =\n      \"The 'select' query has been removed, use 'scan' instead. See \"\n      + \"https://druid.apache.org/docs/latest/querying/select-query.html for more details.\";\n\n  @JsonCreator\n  public SelectQuery()\n  {\n    throw new RuntimeException(REMOVED_ERROR_MESSAGE);\n  }\n\n  @Override\n  public DataSource getDataSource()\n  {\n    throw new RuntimeException(REMOVED_ERROR_MESSAGE);\n  }\n\n  @Override\n  public boolean hasFilters()\n  {\n    throw new RuntimeException(REMOVED_ERROR_MESSAGE);\n  }\n\n  @Override\n  public DimFilter getFilter()\n  {\n    throw new RuntimeException(REMOVED_ERROR_MESSAGE);","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/select/SelectQuery.java#L32-L68","documentation":"SelectQuery was removed from Druid; its constructor and all methods unconditionally throw RuntimeException pointing to the scan query as the replacement. The class is retained only so deserialization fails loudly with an actionable message. Any code or query JSON still creating a 'select' query hits this error.","triggerScenarios":"Submitting a JSON query with queryType 'select' (Jackson @JsonCreator constructor throws); referencing SelectQuery in Java code; old clients or dashboards still emitting select queries.","commonSituations":"Upgrading legacy pipelines written before the select->scan removal; stored queries or monitoring scripts using select; tutorials with outdated query JSON.","solutions":["Replace queryType 'select' with 'queryType':'scan' in query JSON","Migrate query-building code to use ScanQuery instead of SelectQuery","Rewrite stored/dynamic queries and dashboards to the scan API"],"exampleFix":"// before\n{\"queryType\":\"select\", \"dataSource\":\"ds\"}\n// after\n{\"queryType\":\"scan\", \"dataSource\":\"ds\", \"columns\":[], \"batchSize\":20480}","handlingStrategy":"type-guard","validationCode":"if (\"select\".equals(queryJson.get(\"queryType\"))) { throw new IllegalArgumentException(\"select query removed; use scan\"); }","typeGuard":"boolean isRemovedSelectQuery(Map<String,Object> q) { return \"select\".equals(q.get(\"queryType\")); }","tryCatchPattern":"try { runQuery(json); } catch (RuntimeException e) { if (e.getMessage().contains(\"'select' query has been removed\")) { migrateToScanQuery(json); } else throw e; }","preventionTips":["Search codebases and stored queries for queryType 'select' before upgrades","Convert select queries to scan queries proactively","Pin client SDK/doc versions to match server Druid version"],"tags":["removed-api","select-query","scan-query","deprecated-api-usage"],"backgroundTag":"deprecated-api-usage","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"}