-
Notifications
You must be signed in to change notification settings - Fork 0
fix mistakes #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix mistakes #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -438,13 +438,23 @@ class SparkSqlAstBuilder extends AstBuilder { | |
| checkDuplicateClauses(ctx.TBLPROPERTIES, "TBLPROPERTIES", ctx) | ||
| val provider = ctx.tableProvider.asScala.headOption.map(_.multipartIdentifier.getText) | ||
| val location = visitLocationSpecList(ctx.locationSpec()) | ||
| // rowStorage used to determine CatalogStorageFormat.serde and | ||
| // CatalogStorageFormat.properties in STORED AS clause. | ||
| val serdeInfo = getSerdeInfo(ctx.rowFormat.asScala, ctx.createFileFormat.asScala, ctx) | ||
| // TODO: Do not skip serde check for CREATE TABLE LIKE. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CREATE TABLE LIKE has several inconsistencies with CREATE TABLE, I'll keep them unchanged here and fix them later. |
||
| val serdeInfo = getSerdeInfo( | ||
| ctx.rowFormat.asScala, ctx.createFileFormat.asScala, ctx, skipCheck = true) | ||
| if (provider.isDefined && serdeInfo.isDefined) { | ||
| operationNotAllowed(s"CREATE TABLE LIKE ... USING ... ${serdeInfo.get.describe}", ctx) | ||
| } | ||
|
|
||
| // TODO: remove this restriction as it seems unnecessary. | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you intend to change this later, then please file an issue for it rather than adding a TODO here. This PR should preserve existing behavior. |
||
| serdeInfo match { | ||
| case Some(SerdeInfo(storedAs, formatClasses, serde, _)) => | ||
| if (storedAs.isEmpty && formatClasses.isEmpty && serde.isDefined) { | ||
| throw new ParseException("'ROW FORMAT' must be used with 'STORED AS'", ctx) | ||
| } | ||
| case _ => | ||
| } | ||
|
|
||
| // TODO: also look at `HiveSerDe.getDefaultStorage`. | ||
| val storage = toStorageFormat(location, serdeInfo, ctx) | ||
| val properties = Option(ctx.tableProps).map(visitPropertyKeyValues).getOrElse(Map.empty) | ||
| CreateTableLikeCommand( | ||
|
|
@@ -603,7 +613,8 @@ class SparkSqlAstBuilder extends AstBuilder { | |
| */ | ||
| override def visitInsertOverwriteHiveDir( | ||
| ctx: InsertOverwriteHiveDirContext): InsertDirParams = withOrigin(ctx) { | ||
| val serdeInfo = getSerdeInfo(Seq(ctx.rowFormat), Seq(ctx.createFileFormat), ctx) | ||
| val serdeInfo = getSerdeInfo( | ||
| Option(ctx.rowFormat).toSeq, Option(ctx.createFileFormat).toSeq, ctx) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be null safe. |
||
| val path = string(ctx.path) | ||
| // The path field is required | ||
| if (path.isEmpty) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is CTAS.