{"record":{"id":"ba7a932f4c6fc56b","repo":"apache/beam","slug":"configuration-must-provide-a-query-string","errorCode":null,"errorMessage":"Configuration must provide a query string.","messagePattern":"Configuration must provide a query string\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/expansion-service/src/main/java/org/apache/beam/sdk/extensions/sql/expansion/SqlTransformSchemaTransformProvider.java","lineNumber":170,"sourceCode":"  }\n\n  static class SqlSchemaTransform extends SchemaTransform {\n    final Row config;\n\n    public SqlSchemaTransform(Row config) {\n      this.config = config;\n    }\n\n    @Override\n    public PCollectionRowTuple expand(PCollectionRowTuple input) {\n\n      // Start with the query. In theory the exception can't be thrown, but all this nullness\n      // stuff\n      // isn't actually smart enough to know that. Could just cop and suppress that warning, but\n      // doing it the hard way for some reason.\n      String queryString = config.getString(\"query\");\n      if (queryString == null) {\n        throw new IllegalArgumentException(\"Configuration must provide a query string.\");\n      }\n      SqlTransform transform = SqlTransform.query(queryString);\n\n      // Allow setting the query planner class via the dialect name.\n      EnumerationType.Value dialect =\n          config.getLogicalTypeValue(\"dialect\", EnumerationType.Value.class);\n      if (dialect != null) {\n        Class<? extends QueryPlanner> queryPlannerClass =\n            QUERY_PLANNERS.get(QUERY_ENUMERATION.toString(dialect));\n        if (queryPlannerClass != null) {\n          transform = transform.withQueryPlannerClass(queryPlannerClass);\n        }\n      }\n\n      // Add any DDL strings\n      String ddl = config.getString(\"ddl\");\n      if (ddl != null) {\n        transform = transform.withDdlString(ddl);","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/expansion-service/src/main/java/org/apache/beam/sdk/extensions/sql/expansion/SqlTransformSchemaTransformProvider.java#L152-L188","documentation":"The Beam SQL SchemaTransform provider reads the 'query' key from its configuration map; if it is absent or null, expansion cannot build a SqlTransform, so it throws IllegalArgumentException with this message. It is an upfront config validation guard in SqlTransformSchemaTransformProvider.expand.","triggerScenarios":"Calling SqlTransformSchemaTransformProvider.expand (via output()/testFailedExpression) with a configuration map that omits the 'query' key or sets it to null.","commonSituations":"Pipeline configs built programmatically or from YAML that forget the SQL statement; serialization round-trips dropping the config field; mistyping the key (e.g. 'sql' instead of 'query').","solutions":["Add a non-null 'query' entry to the transform configuration.","Validate config keys before submitting the pipeline (check for 'query' presence).","If building config from YAML, confirm the field name matches 'query' exactly."],"exampleFix":"// before\nMap<String, Object> config = Map.of(\"dialect\", \"calcite\");\n// after\nMap<String, Object> config = Map.of(\n    \"query\", \"SELECT * FROM pcollection\",\n    \"dialect\", \"calcite\");","handlingStrategy":"validation","validationCode":"if (config == null || !config.containsKey(\"query\") || config.get(\"query\") == null || ((String) config.get(\"query\")).isEmpty()) {\n  throw new IllegalArgumentException(\"Transform config must include a non-empty 'query' string\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include 'query' in the config map for SqlTransform-based SchemaTransforms.","Validate required config keys at pipeline-construction time.","Centralize config construction in a helper so keys can't be mistyped."],"tags":["java","beam-sql","config-validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}