spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-15279][SQL] Catch conflicting SerDe whe...
Date Thu, 12 May 2016 21:33:16 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13068#discussion_r63101396
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala
---
    @@ -941,6 +944,43 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder {
       }
     
       /**
    +   * Throw a [[ParseException]] if the user specified incompatible SerDes through ROW
FORMAT
    +   * and STORED AS.
    +   */
    +  private def validateRowFormatFileFormat(
    +      rowFormatCtx: RowFormatContext,
    +      createFileFormatCtx: CreateFileFormatContext,
    +      parentCtx: ParserRuleContext): Unit = {
    +    if (rowFormatCtx == null || createFileFormatCtx == null) {
    +      return
    +    }
    +    val cff = (0 until createFileFormatCtx.getChildCount)
    +      .map { i => createFileFormatCtx.getChild(i).getText }
    +      .mkString(" ")
    +    (rowFormatCtx, createFileFormatCtx.fileFormat) match {
    +      case (_, ffTable: TableFileFormatContext) =>
    +        if (visitTableFileFormat(ffTable).serde.isDefined) {
    +          throw operationNotAllowed(s"ROW FORMAT is not compatible with $cff", parentCtx)
    +        }
    +      case (rfSerde: RowFormatSerdeContext, ffGeneric: GenericFileFormatContext) =>
    +        ffGeneric.identifier.getText.toLowerCase match {
    +          case ("sequencefile" | "textfile" | "rcfile") => // OK
    +          case _ => throw operationNotAllowed(
    +            s"ROW FORMAT SERDE is not compatible with $cff", parentCtx)
    +        }
    +      case (rfDelimited: RowFormatDelimitedContext, ffGeneric: GenericFileFormatContext)
=>
    +        ffGeneric.identifier.getText.toLowerCase match {
    +          case "textfile" => // OK
    +          case _ => throw operationNotAllowed(
    +            s"ROW FORMAT SERDE is not compatible with $cff", parentCtx)
    --- End diff --
    
    isn't that what we talked about?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message