From 4ffaf59f48816caa85f7dcdf0a5660591e0829cf Mon Sep 17 00:00:00 2001 From: Andrew Or Date: Wed, 11 May 2016 17:58:23 -0700 Subject: [PATCH] Fix NPE --- .../org/apache/spark/sql/execution/SparkSqlParser.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala index aba8cf380f401..d32bd9125278f 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala @@ -951,12 +951,13 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder { 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 (rf, null) => // only row format, no conflict - case (null, ff) => // only file format, no conflict case (_, ffTable: TableFileFormatContext) => if (visitTableFileFormat(ffTable).serde.isDefined) { throw operationNotAllowed(s"ROW FORMAT is not compatible with $cff", parentCtx)