Skip to content

Commit

Permalink
Minor refactor to catalog table code paths
Browse files Browse the repository at this point in the history
As the title says

Author: Rahul Mahadev <rahul.mahadev@databricks.com>

GitOrigin-RevId: a42e1ad347d3f0665070d6ddb43ef311e058b576
  • Loading branch information
rahulsmahadev authored and tdas committed May 24, 2021
1 parent ebf7625 commit 9d35217
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,12 @@ object DeltaRelation {
val relation = d.withOptions(options.asScala.toMap).toBaseRelation
var output = v2Relation.output

LogicalRelation(relation, output, d.catalogTable, isStreaming = false)
val catalogTable = if (d.catalogTable.isDefined) {
Some(d.v1Table)
} else {
None
}
LogicalRelation(relation, output, catalogTable, isStreaming = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,14 @@ case class DeltaTableV2(
}

override def v1Table: CatalogTable = {
catalogTable.getOrElse {
if (catalogTable.isEmpty) {
throw new IllegalStateException("v1Table call is not expected with path based DeltaTableV2")
}
if (timeTravelSpec.isDefined) {
catalogTable.get.copy(stats = None)
} else {
catalogTable.get
}
}
}

Expand Down

0 comments on commit 9d35217

Please sign in to comment.