Skip to content

Conversation

@rdblue
Copy link
Contributor

@rdblue rdblue commented Jul 26, 2018

What changes were proposed in this pull request?

This adds support for DELETE FROM in SQL using the new DeleteFrom logical plan and v2 DeleteSupport mix-in.

To identify the v2 table to delete data from, this uses the TableCatalog API introduced in #21306.

TableIdentifier has been updated with a new superclass, CatalogTableIdentifier. Code paths that don't support identifiers with a catalog continue to use TableIdentifier, allowing a smooth transition even though some code assumes there is no support for multiple catalogs.

UnresovledRelation now supports CatalogTableIdentifier, but resolution will only happen when the catalog is not defined or through a new rule with support for v2 TableCatalog. Existing uses of UnresolvedRelation access the catalog using tableIdentifier, which asserts that the catalog is not defined before returning to ensure catalog identifiers don't leak to code without catalog support.

WIP: This is based on #21306, #21305, and #21877 and includes the changes from those PRs.

How was this patch tested?

WIP, will add tests.

rdblue added 13 commits July 26, 2018 11:34
* Rename CatalogSupport to TableSupport
* Rename DataSourceCatalog to TableCatalog
* Remove name and database from Table
This is needed for catalyst plans to use catalogs.
This adds a new logical plan, AppendData, that was proposed in
SPARK-23521. This also adds an analyzer rule to validate data written
with AppendData against the target table. DataFrameWriter is also
updated so that v2 writes use the new AppendData logical plan.
This uses the catalog API introduced in SPARK-24252 to implement CTAS
and RTAS plans.
@SparkQA
Copy link

SparkQA commented Jul 26, 2018

Test build #93635 has finished for PR 21888 at commit 19b83bd.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class UnresolvedRelation(table: CatalogTableIdentifier) extends LeafNode with NamedRelation
  • sealed trait IdentifierWithOptionalDatabaseAndCatalog
  • case class CatalogTableIdentifier(table: String, database: Option[String], catalog: Option[String])
  • case class TableIdentifier(name: String, db: Option[String])
  • implicit class CatalogHelper(catalog: CatalogProvider)
  • case class ResolveCatalogV2Relations(sparkSession: SparkSession) extends Rule[LogicalPlan]
  • case class DeleteFromV2Exec(rel: TableV2Relation, expr: Expression)

@SparkQA
Copy link

SparkQA commented Jul 26, 2018

Test build #93641 has finished for PR 21888 at commit 62f09df.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class UnresolvedRelation(table: CatalogTableIdentifier) extends LeafNode with NamedRelation
  • sealed trait IdentifierWithOptionalDatabaseAndCatalog
  • case class CatalogTableIdentifier(table: String, database: Option[String], catalog: Option[String])
  • case class TableIdentifier(name: String, db: Option[String])
  • implicit class CatalogHelper(catalog: CatalogProvider)
  • case class ResolveCatalogV2Relations(sparkSession: SparkSession) extends Rule[LogicalPlan]
  • case class DeleteFromV2Exec(rel: TableV2Relation, expr: Expression)

@rdblue rdblue force-pushed the SPARK-24253-add-delete-from branch from 62f09df to f8b178d Compare July 27, 2018 01:41
@SparkQA
Copy link

SparkQA commented Jul 27, 2018

Test build #93650 has finished for PR 21888 at commit f8b178d.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class UnresolvedRelation(table: CatalogTableIdentifier) extends LeafNode with NamedRelation
  • sealed trait IdentifierWithOptionalDatabaseAndCatalog
  • case class CatalogTableIdentifier(table: String, database: Option[String], catalog: Option[String])
  • class TableIdentifier(name: String, db: Option[String])
  • implicit class CatalogHelper(catalog: CatalogProvider)
  • case class ResolveCatalogV2Relations(sparkSession: SparkSession) extends Rule[LogicalPlan]
  • case class DeleteFromV2Exec(rel: TableV2Relation, expr: Expression)

@SparkQA
Copy link

SparkQA commented Nov 19, 2018

Test build #98986 has finished for PR 21888 at commit f8b178d.

  • This patch fails to build.
  • This patch does not merge cleanly.
  • This patch adds the following public classes (experimental):
  • case class UnresolvedRelation(table: CatalogTableIdentifier) extends LeafNode with NamedRelation
  • sealed trait IdentifierWithOptionalDatabaseAndCatalog
  • case class CatalogTableIdentifier(table: String, database: Option[String], catalog: Option[String])
  • class TableIdentifier(name: String, db: Option[String])
  • implicit class CatalogHelper(catalog: CatalogProvider)
  • case class ResolveCatalogV2Relations(sparkSession: SparkSession) extends Rule[LogicalPlan]
  • case class DeleteFromV2Exec(rel: TableV2Relation, expr: Expression)

@SparkQA
Copy link

SparkQA commented Nov 14, 2019

Test build #113755 has finished for PR 21888 at commit f8b178d.

  • This patch fails to build.
  • This patch does not merge cleanly.
  • This patch adds the following public classes (experimental):
  • case class UnresolvedRelation(table: CatalogTableIdentifier) extends LeafNode with NamedRelation
  • sealed trait IdentifierWithOptionalDatabaseAndCatalog
  • case class CatalogTableIdentifier(table: String, database: Option[String], catalog: Option[String])
  • class TableIdentifier(name: String, db: Option[String])
  • implicit class CatalogHelper(catalog: CatalogProvider)
  • case class ResolveCatalogV2Relations(sparkSession: SparkSession) extends Rule[LogicalPlan]
  • case class DeleteFromV2Exec(rel: TableV2Relation, expr: Expression)

@cloud-fan
Copy link
Contributor

This is done by #25115, closing this PR

@cloud-fan cloud-fan closed this Feb 3, 2020
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.

4 participants