{"record":{"id":"ae4232dd64b2f522","repo":"apache/beam","slug":"failed-to-parse","errorCode":null,"errorMessage":"failed to parse","messagePattern":"failed to parse","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/TableSchema.java","lineNumber":410,"sourceCode":"    }\n\n    /**\n     * Parse string with ClickHouse type to {@link ColumnType}.\n     *\n     * @param str string representation of ClickHouse type\n     * @return type of ClickHouse column\n     * @throws IllegalArgumentException if {@code str} is not a valid ClickHouse column type\n     */\n    public static ColumnType parse(String str) {\n      try {\n        return new org.apache.beam.sdk.io.clickhouse.impl.parser.ColumnTypeParser(\n                new StringReader(str))\n            .parse();\n      } catch (org.apache.beam.sdk.io.clickhouse.impl.parser.ParseException\n          | org.apache.beam.sdk.io.clickhouse.impl.parser.TokenMgrError\n          | IllegalArgumentException e) {\n        // Funnel lexical, syntactic and validation failures into one error surface.\n        throw new IllegalArgumentException(\"failed to parse\", e);\n      }\n    }\n\n    /**\n     * Get default value of a column based on expression.\n     *\n     * <p>E.g., \"CREATE TABLE hits(id Int32, count Int32 DEFAULT &lt;str&gt;)\"\n     *\n     * @param columnType type of ClickHouse expression\n     * @param value ClickHouse expression\n     * @return value of ClickHouse expression\n     */\n    public static Object parseDefaultExpression(ColumnType columnType, String value) {\n      switch (columnType.typeName()) {\n        case INT8:\n          return Byte.valueOf(value);\n        case INT16:\n          return Short.valueOf(value);","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/TableSchema.java#L392-L428","documentation":"TableSchema.parse(str) parses a ClickHouse column-definition string (e.g. \"name String, age Int32\") with the generated grammar parser. Any ParseException (syntax), TokenMgrError (lexical), or IllegalArgumentException (validation) raised during parsing is deliberately rethrown as a single IllegalArgumentException(\"failed to parse\", cause) so callers face one error surface.","triggerScenarios":"Calling TableSchema.parse with a malformed DDL fragment: missing commas between columns, unknown type names, unbalanced parentheses, invalid Nullable/ LowCardinality usage, or non-column tokens.","commonSituations":"Copy-pasting a full CREATE TABLE statement (with backticks, ENGINE clauses, etc.) instead of the bare column list, typos in ClickHouse type names, or programmatically generated schema strings with formatting bugs.","solutions":["Inspect the wrapped cause (getCause()) — it names the exact syntax/validation problem and position.","Fix the schema string to be a comma-separated list of valid ClickHouse column definitions only (no CREATE TABLE wrapper).","Verify every type name is a ClickHouse type the parser supports (e.g. String, Int32, DateTime, Nullable(...))."],"exampleFix":"// before\nTableSchema.parse(\"CREATE TABLE t (id Int64) ENGINE = MergeTree()\"); // fails\n// after\nTableSchema.parse(\"id Int64, name String\");","handlingStrategy":"try-catch","validationCode":"// regex sanity check that each column looks like \"name Type\" before parsing\nfor (String col : schemaStr.split(\",\")) {\n  if (!col.trim().matches(\"[`]?[A-Za-z_][A-Za-z0-9_`]*\\\\s+\\\\S+.*\")) throw new IllegalArgumentException(\"bad column: \" + col);\n}","typeGuard":null,"tryCatchPattern":"try {\n  schema = TableSchema.parse(str);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Schema parse failed: {}\", e.getCause() != null ? e.getCause().getMessage() : e.getMessage());\n  throw e;\n}","preventionTips":["Always inspect getCause() — the original ParseException/TokenMgrError pinpoints the syntax error.","Pass only the bare column list, never a full CREATE TABLE statement.","Validate type names against supported ClickHouse types before parsing."],"tags":["clickhouse","parser","schema","ddl"],"backgroundTag":"schema-validation-failed","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"}