Skip to content

Conversation

@cloud-fan
Copy link

No description provided.

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

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?

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