cloud-fan commented on a change in pull request #30705:
URL: https://github.com/apache/spark/pull/30705#discussion_r540165756
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala
##########
@@ -472,14 +472,21 @@ class SparkSqlAstBuilder extends AstBuilder {
checkDuplicateClauses(ctx.TBLPROPERTIES, "TBLPROPERTIES", ctx)
val provider =
ctx.tableProvider.asScala.headOption.map(_.multipartIdentifier.getText)
val location = visitLocationSpecList(ctx.locationSpec())
- // TODO: Do not skip serde check for CREATE TABLE LIKE.
val serdeInfo = getSerdeInfo(
- ctx.rowFormat.asScala.toSeq, ctx.createFileFormat.asScala.toSeq, ctx,
skipCheck = true)
+ ctx.rowFormat.asScala.toSeq, ctx.createFileFormat.asScala.toSeq, ctx)
if (provider.isDefined && serdeInfo.isDefined) {
operationNotAllowed(s"CREATE TABLE LIKE ... USING ...
${serdeInfo.get.describe}", ctx)
}
- // TODO: remove this restriction as it seems unnecessary.
+ // "CREATE TABLE dst LIKE src ROW FORMAT SERDE 'xxx.xxx.SerdeClass'"
+ // The behavior of above SQL in Hive will just ignore the ROW FORMAT
definition,
+ // and use SerdeInfo from src table instead.
Review comment:
We don't need to mention hive. How about
```
For "CREATE TABLE dst LIKE src ROW FORMAT SERDE xxx" which doesn't specify
the file format,
it's a bit weird to use the default file format, but it's also weird to get
file format from the source
table while the serde class is user-specified. Here we require both serde
and format to be
specified, to avoid confusion.
```
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]