-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-28948][SQL] Support passing all Table metadata in TableProvider #25651
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
Changes from all commits
1a03c8b
6731b52
1124b47
68cecf0
1235d78
cfbe0a7
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 |
|---|---|---|
|
|
@@ -30,15 +30,16 @@ import org.apache.spark.sql.types.StructType | |
| /** | ||
| * An implementation of catalog v2 `Table` to expose v1 table metadata. | ||
| */ | ||
| private[sql] case class V1Table(v1Table: CatalogTable) extends Table { | ||
| private[sql] case class V1Table(catalogTable: CatalogTable) extends Table { | ||
| assert(catalogTable.provider.isDefined) | ||
|
|
||
| implicit class IdentifierHelper(identifier: TableIdentifier) { | ||
| def quoted: String = { | ||
| identifier.database match { | ||
| case Some(db) => | ||
| Seq(db, identifier.table).map(quote).mkString(".") | ||
| case _ => | ||
| quote(identifier.table) | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -51,38 +52,36 @@ private[sql] case class V1Table(v1Table: CatalogTable) extends Table { | |
| } | ||
| } | ||
|
|
||
| def catalogTable: CatalogTable = v1Table | ||
|
|
||
| lazy val options: Map[String, String] = { | ||
| v1Table.storage.locationUri match { | ||
| catalogTable.storage.locationUri match { | ||
| case Some(uri) => | ||
| v1Table.storage.properties + ("path" -> uri.toString) | ||
| catalogTable.storage.properties + ("path" -> uri.toString) | ||
| case _ => | ||
| v1Table.storage.properties | ||
| catalogTable.storage.properties | ||
| } | ||
| } | ||
|
|
||
| override lazy val properties: util.Map[String, String] = v1Table.properties.asJava | ||
| override lazy val properties: util.Map[String, String] = catalogTable.properties.asJava | ||
|
Contributor
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. I leave the options/properties unchanged here, but we need to figure it out later. Currently there are 2 directions:
We can have more discussion about it later.
Contributor
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. V2 has only table properties, so I think the question is whether we want to mix options into those table properties directly, or whether we want to prefix them so they can be recovered. I'm in favor of being able to recover them so we can constract the catalog table as it would be in the v1 path. |
||
|
|
||
| override lazy val schema: StructType = v1Table.schema | ||
| override lazy val schema: StructType = catalogTable.schema | ||
|
|
||
| override lazy val partitioning: Array[Transform] = { | ||
| val partitions = new mutable.ArrayBuffer[Transform]() | ||
|
|
||
| v1Table.partitionColumnNames.foreach { col => | ||
| catalogTable.partitionColumnNames.foreach { col => | ||
| partitions += LogicalExpressions.identity(col) | ||
| } | ||
|
|
||
| v1Table.bucketSpec.foreach { spec => | ||
| catalogTable.bucketSpec.foreach { spec => | ||
| partitions += LogicalExpressions.bucket(spec.numBuckets, spec.bucketColumnNames: _*) | ||
| } | ||
|
|
||
| partitions.toArray | ||
| } | ||
|
|
||
| override def name: String = v1Table.identifier.quoted | ||
| override def name: String = catalogTable.identifier.quoted | ||
|
|
||
| override def capabilities: util.Set[TableCapability] = new util.HashSet[TableCapability]() | ||
|
|
||
| override def toString: String = s"UnresolvedTable($name)" | ||
| override def toString: String = s"V1Table($name)" | ||
|
Contributor
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. +1 Good catch, this would have been confusing. |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.