{"record":{"id":"124a70f077d88ae2","repo":"apache/iceberg","slug":"unable-to-parse-table-identifier-s","errorCode":null,"errorMessage":"Unable to parse table identifier: %s","messagePattern":"Unable to parse table identifier: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java","lineNumber":180,"sourceCode":"    List<SparkPartition> partitions = getPartitionsByFilter(spark, table, expression);\n    return spark\n        .createDataFrame(partitions, SparkPartition.class)\n        .toDF(\"partition\", \"uri\", \"format\");\n  }\n\n  /**\n   * Returns all partitions in the table.\n   *\n   * @param spark a Spark session\n   * @param table a table name and (optional) database\n   * @return all table's partitions\n   */\n  public static List<SparkPartition> getPartitions(SparkSession spark, String table) {\n    try {\n      TableIdentifier tableIdent = spark.sessionState().sqlParser().parseTableIdentifier(table);\n      return getPartitions(spark, tableIdent, null);\n    } catch (ParseException e) {\n      throw SparkExceptionUtil.toUncheckedException(\n          e, \"Unable to parse table identifier: %s\", table);\n    }\n  }\n\n  /**\n   * Returns all partitions in the table.\n   *\n   * @param spark a Spark session\n   * @param tableIdent a table identifier\n   * @param partitionFilter partition filter, or null if no filter\n   * @return all table's partitions\n   */\n  public static List<SparkPartition> getPartitions(\n      SparkSession spark, TableIdentifier tableIdent, Map<String, String> partitionFilter) {\n    try {\n      SessionCatalog catalog = spark.sessionState().catalog();\n      CatalogTable catalogTable = catalog.getTableMetadata(tableIdent);\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java#L162-L198","documentation":"`SparkTableUtil.getPartitions(spark, table)` parses the string table identifier with Spark's SQL parser. If the string is not a syntactically valid table identifier (e.g. `db.table` or quoted names), the parser throws a ParseException which is wrapped into this unchecked exception with the offending string interpolated.","triggerScenarios":"Calling `SparkTableUtil.getPartitions(spark, table)` (raised in getPartitions, called by partitions) with a malformed identifier string such as an unquoted name containing special characters, a full URI, or an empty string.","commonSituations":"Passing a path or file location instead of a table name; special characters (dots, dashes) without backtick quoting; confusing multi-part identifiers with the 3-arg overload that takes db/table separately.","solutions":["Pass a valid identifier, quoting special parts with backticks: `` `my-db`.`my.table` ``","Use the `getPartitions(spark, db, table, ...)` overload that avoids string parsing","Validate/split the identifier string before calling","Check that no whitespace/URI was accidentally passed"],"exampleFix":"// before\nSparkTableUtil.getPartitions(spark, \"my-db.my.table\")\n// after\nSparkTableUtil.getPartitions(spark, \"`my-db`.`my.table`\")\n// or\nSparkTableUtil.getPartitions(spark, \"my-db\", \"my.table\", null, Map.empty, partitionFilter)","handlingStrategy":"validation","validationCode":"if (!table.matches(\"`?[\\\\w]+`?([.]`?[\\\\w]+`?)?\")) {\n  throw new IllegalArgumentException(\"Expected [db.]table identifier, got: \" + table);\n}","typeGuard":null,"tryCatchPattern":"try { SparkTableUtil.getPartitions(spark, table) } catch { case e: RuntimeException if e.getMessage.startsWith(\"Unable to parse table identifier\") => /* fix identifier or use overload */ }","preventionTips":["Backtick-quote database and table names containing special characters","Prefer the (spark, db, table, ...) overload to skip string parsing","Never pass file paths or URIs as the table argument","Strip whitespace before calling"],"tags":["spark","identifier","parse-error","partitions"],"backgroundTag":"invalid-identifier-format","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}