{"record":{"id":"9537f4241bcbe09e","repo":"apache/beam","slug":"failed-to-parse-hadoop-config-string-as-json","errorCode":null,"errorMessage":"Failed to parse hadoop_config string as JSON","messagePattern":"Failed to parse hadoop_config string as JSON","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/delta/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/delta/DeltaTable.java","lineNumber":135,"sourceCode":"\n  private static void parseHadoopConfig(JsonNode val, Map<String, String> targetMap) {\n    if (val.isObject()) {\n      Map<String, String> map =\n          TableUtils.getObjectMapper()\n              .convertValue(val, new TypeReference<Map<String, String>>() {});\n      if (map != null) {\n        targetMap.putAll(map);\n      }\n    } else if (val.isTextual()) {\n      try {\n        Map<String, String> map =\n            TableUtils.getObjectMapper()\n                .readValue(val.asText(), new TypeReference<Map<String, String>>() {});\n        if (map != null) {\n          targetMap.putAll(map);\n        }\n      } catch (Exception e) {\n        throw new IllegalArgumentException(\"Failed to parse hadoop_config string as JSON\", e);\n      }\n    }\n  }\n\n  @Override\n  public PCollection<Row> buildIOReader(PBegin begin) {\n    return begin\n        .apply(Managed.read(Managed.DELTA_LAKE).withConfig(getBaseConfig()))\n        .getSinglePCollection();\n  }\n\n  @Override\n  public PCollection<Row> buildIOReader(\n      PBegin begin, BeamSqlTableFilter filters, List<String> fieldNames) {\n    // TODO: Support predicate pushdown and column pruning when supported by DeltaIO\n    // / Managed Delta\n    // Lake source.\n    String error = \"%s does not support predicate/project push-down, yet non-empty %s is passed.\";","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/delta/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/delta/DeltaTable.java#L117-L153","documentation":"DeltaTable.parseHadoopConfig expects the 'hadoop_config' property value to be a JSON object string mapping config keys to string values. If Jackson's ObjectMapper fails to deserialize the text into Map<String, String>, the exception is wrapped and rethrown as IllegalArgumentException with this message. It means your hadoop_config value is not valid JSON of the expected shape.","triggerScenarios":"Passing a 'hadoop_config' property whose value is malformed JSON, JSON with non-string values (e.g. numbers/booleans), or a non-JSON plain string like 'fs.defaultFS=hdfs://...'.","commonSituations":"Hand-writing the hadoop_config inline in DDL with quoting/escaping mistakes; using properties-file syntax instead of JSON; nested objects or numeric values that don't fit Map<String, String>.","solutions":["Ensure hadoop_config is a valid JSON object with only string values, e.g. '{\"fs.defaultFS\":\"hdfs://nn:8020\"}'.","Validate the JSON with a parser/linter before embedding it in the table properties.","Escape quotes correctly when embedding JSON inside DDL strings."],"exampleFix":"// before\nTBLPROPERTIES { 'hadoop_config': 'fs.defaultFS=hdfs://nn:8020' }\n// after\nTBLPROPERTIES { 'hadoop_config': '{\"fs.defaultFS\":\"hdfs://nn:8020\"}' }","handlingStrategy":"validation","validationCode":"// validate hadoop_config before passing it\nnew ObjectMapper().readValue(hadoopConfigJson, new TypeReference<Map<String, String>>() {}); // throws if invalid","typeGuard":"boolean isValidHadoopConfig(String s) {\n  try {\n    Map<String, String> m = new ObjectMapper().readValue(s, new TypeReference<Map<String, String>>() {});\n    return m != null;\n  } catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  table = new DeltaTable(tableId, schema, properties);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"hadoop_config\")) {\n    // validate and fix the JSON, then retry\n  }\n}","preventionTips":["Always embed hadoop_config as a JSON object of string values only.","Lint the JSON before interpolating it into DDL strings.","Avoid properties-file syntax (k=v) where JSON is expected."],"tags":["java","beam-sql","delta-lake","json","hadoop"],"backgroundTag":"json-parse-error","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}