HyukjinKwon commented on code in PR #38871:
URL: https://github.com/apache/spark/pull/38871#discussion_r1058895404
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogV2Util.scala:
##########
@@ -330,22 +330,29 @@ private[sql] object CatalogV2Util {
ident: Identifier,
timeTravelSpec: Option[TimeTravelSpec] = None): Option[Table] =
try {
- if (timeTravelSpec.nonEmpty) {
- timeTravelSpec.get match {
- case v: AsOfVersion =>
- Option(catalog.asTableCatalog.loadTable(ident, v.version))
- case ts: AsOfTimestamp =>
- Option(catalog.asTableCatalog.loadTable(ident, ts.timestamp))
- }
- } else {
- Option(catalog.asTableCatalog.loadTable(ident))
- }
+ Option(getTable(catalog, ident, timeTravelSpec))
} catch {
case _: NoSuchTableException => None
case _: NoSuchDatabaseException => None
case _: NoSuchNamespaceException => None
}
+ def getTable(
+ catalog: CatalogPlugin,
+ ident: Identifier,
+ timeTravelSpec: Option[TimeTravelSpec] = None): Table = {
+ if (timeTravelSpec.nonEmpty) {
+ timeTravelSpec.get match {
+ case v: AsOfVersion =>
+ catalog.asTableCatalog.loadTable(ident, v.version)
+ case ts: AsOfTimestamp =>
+ catalog.asTableCatalog.loadTable(ident, ts.timestamp)
+ }
+ } else {
+ catalog.asTableCatalog.loadTable(ident)
+ }
+ }
Review Comment:
Let's probably don't piggyback unrelated refactoring
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]