Skip to content

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

Merged
merged 1 commit into from
Nov 24, 2020
Merged

fix mistakes #9

merged 1 commit into from
Nov 24, 2020

Conversation

cloud-fan
Copy link

No description provided.

@@ -297,7 +297,7 @@ class ResolveSessionCatalog(
assertNoNullTypeInSchema(c.asSelect.schema)
}
val (storageFormat, provider) = getStorageFormatAndProvider(
c.provider, c.options, c.location, c.serde, ctas = false)
c.provider, c.options, c.location, c.serde, ctas = true)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is CTAS.

@github-actions github-actions bot added the SQL label Nov 24, 2020
// 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.
Copy link
Author

Choose a reason for hiding this comment

The 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.

@@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be null safe.

@rdblue
Copy link
Owner

rdblue commented Nov 24, 2020

@cloud-fan, the reason why the commands in SparkSqlParser like CREATE TABLE LIKE had different logic is because of the differences in behavior. Since we plan to move those to v2, I thought it made more sense to get them working and not worry so much about code reuse.

I would be fine reverting your changes for those commands. I assumed that you had tested your changes the last time and had made sure that everything was passing. Did you test your changes this time?

if (provider.isDefined && serdeInfo.isDefined) {
operationNotAllowed(s"CREATE TABLE LIKE ... USING ... ${serdeInfo.get.describe}", ctx)
}

// TODO: remove this restriction as it seems unnecessary.
Copy link
Owner

Choose a reason for hiding this comment

The 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.

@rdblue rdblue merged commit 25ec746 into rdblue:unify-create-table Nov 24, 2020
@cloud-fan
Copy link
Author

The current PR diverges from my previous local branch and is unfortunately not fully tested (I did run several DDL tests locally before submitting this PR).

Regarding CREATE TABLE LIKE, I've created a JIRA to track it: https://issues.apache.org/jira/browse/SPARK-33546 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants