You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/11/05 13:36:13 UTC

[GitHub] [spark] StefanXiepj commented on a change in pull request #13068: [SPARK-15279][SQL] Catch conflicting SerDe when creating table

StefanXiepj commented on a change in pull request #13068:
URL: https://github.com/apache/spark/pull/13068#discussion_r518054657



##########
File path: 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)

Review comment:
       Why don't we support this? What's the problem? Can you give me an example? thx




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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