Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/13517#discussion_r68699390 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala --- @@ -435,6 +434,37 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder { } /** + * Parse a key-value map from a [[OptionParameterListContext]], assuming all values are + * specified. This allows string, boolean, decimal and integer literals which are converted + * to strings. + */ + override def visitOptionParameterList(ctx: OptionParameterListContext): Map[String, String] = { + // TODO: Currently it does not treat null. Hive does not allow null for metadata and + // throws an exception. + val properties = ctx.optionParameter.asScala.map { property => + val key = visitTablePropertyKey(property.key) + val value = if (property.value.STRING != null) { + string(property.value.STRING) + } else if (property.value.booleanValue != null) { + property.value.getText.toLowerCase + } else { + property.value.getText + } + key -> value + } + + // Check for duplicate property names. + checkDuplicateKeys(properties, ctx) + val props = properties.toMap + val badKeys = props.filter { case (_, v) => v == null }.keys --- End diff -- NIT (not your code): `val badKeys = props.collect { case (key, null) => key }`
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org