{"record":{"id":"4eda95b3afb572d0","repo":"apache/iceberg","slug":"invalid-value-for-sparksqlproperties-view-schema-4eda95","errorCode":null,"errorMessage":"Invalid value for ${SparkSQLProperties.VIEW_SCHEMA_BINDING_MODE}: $mode, expected ${SparkSQLProperties.VIEW_SCHEMA_MODE_BINDING} or ${SparkSQLProperties.VIEW_SCHEMA_MODE_COMPENSATION}","messagePattern":"Invalid value for (.+?): \\$mode, expected (.+?) or (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveViews.scala","lineNumber":145,"sourceCode":"\n    SubqueryAlias(nameParts, Project(aliases, rewritten))\n  }\n\n  // Read on every resolution rather than cached, so that SET takes effect within a session.\n  private def viewSchemaMode: String =\n    parseSchemaBindingMode(\n      conf.getConfString(\n        SparkSQLProperties.VIEW_SCHEMA_BINDING_MODE,\n        SparkSQLProperties.VIEW_SCHEMA_MODE_BINDING))\n\n  private def parseSchemaBindingMode(mode: String): String = {\n    val normalized = mode.trim\n    if (normalized.equalsIgnoreCase(SparkSQLProperties.VIEW_SCHEMA_MODE_BINDING)) {\n      SparkSQLProperties.VIEW_SCHEMA_MODE_BINDING\n    } else if (normalized.equalsIgnoreCase(SparkSQLProperties.VIEW_SCHEMA_MODE_COMPENSATION)) {\n      SparkSQLProperties.VIEW_SCHEMA_MODE_COMPENSATION\n    } else {\n      throw new IllegalArgumentException(\n        s\"Invalid value for ${SparkSQLProperties.VIEW_SCHEMA_BINDING_MODE}: $mode, expected \" +\n          s\"${SparkSQLProperties.VIEW_SCHEMA_MODE_BINDING} or \" +\n          s\"${SparkSQLProperties.VIEW_SCHEMA_MODE_COMPENSATION}\")\n    }\n  }\n\n  private def parseViewText(name: String, viewText: String): LogicalPlan = {\n    val origin = Origin(objectType = Some(\"VIEW\"), objectName = Some(name))\n\n    try {\n      CurrentOrigin.withOrigin(origin) {\n        spark.sessionState.sqlParser.parseQuery(viewText)\n      }\n    } catch {\n      case _: ParseException =>\n        throw QueryCompilationErrors.invalidViewNameError(name)\n    }\n  }","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveViews.scala#L127-L163","documentation":"The spark.view.schema-binding-mode (SparkSQLProperties.VIEW_SCHEMA_BINDING_MODE) property accepts only two values: \"binding\" and \"compensation\" (case-insensitive, trimmed). Any other value triggers this IllegalArgumentException at analysis time when the mode is normalized.","triggerScenarios":"Setting the view schema binding mode to an unrecognized string, e.g. via TBLPROPERTIES/SET spark.view.schema.binding.mode=strict, or programmatically passing a bad mode into view resolution config.","commonSituations":"Typo in the property value; confusion with similar property names from other engines; docs/config templates using an outdated value.","solutions":["Set the property to exactly \"binding\" or \"compensation\" (any casing)","Remove the property to use the default behavior","Check the Iceberg docs for your version for supported schema-binding modes"],"exampleFix":"// before\nSET spark.view.schema.binding.mode = strict\n// after\nSET spark.view.schema.binding.mode = binding","handlingStrategy":"validation","validationCode":"val valid = Set(\"binding\", \"compensation\")\nval mode = spark.conf.get(\"spark.view.schema.binding.mode\", \"\")\nif (mode.nonEmpty && !valid.contains(mode.trim.toLowerCase)) {\n  throw new IllegalArgumentException(s\"$mode is not one of $valid\")\n}","typeGuard":null,"tryCatchPattern":"try {\n  spark.sql(\"SELECT * FROM v\")\n} catch {\n  case e: IllegalArgumentException if e.getMessage.contains(\"VIEW_SCHEMA_BINDING_MODE\") =>\n    spark.conf.set(\"spark.view.schema.binding.mode\", \"binding\")\n}","preventionTips":["Only set the property to the documented values: binding or compensation","Validate config templates containing view properties in CI","Watch Iceberg release notes for new supported modes"],"tags":["spark","iceberg","views","config"],"backgroundTag":"invalid-config-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}