LantaoJin commented on a change in pull request #28833: URL: https://github.com/apache/spark/pull/28833#discussion_r449937054
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogV2Util.scala ########## @@ -346,4 +346,23 @@ private[sql] object CatalogV2Util { } } } + + def failNullType(dt: DataType): Unit = { + def containsNullType(dt: DataType): Boolean = dt match { + case ArrayType(et, _) => containsNullType(et) + case MapType(kt, vt, _) => containsNullType(kt) || containsNullType(vt) + case StructType(fields) => fields.exists(f => containsNullType(f.dataType)) + case _ => dt.isInstanceOf[NullType] + } + if (containsNullType(dt)) { + throw new AnalysisException( + "Cannot create tables with VOID type.") Review comment: Yes. We throw exception in command like creating table. > One question, if we don't allow void/unknown type, is there good reason to accept in parser? VOID is a legacy Hive table type which may be read by Spark. So in #28935, I map `case ("void", Nil) => HiveVoidType` in Parser, but @cloud-fan suggested me to re-use NullType. So the syntax seems we accepted void/unknown in parser. Actually, first, we accept the legacy Hive type VOID in parser and two, we fobid creating table with void/null. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org