YannByron commented on code in PR #6264:
URL: https://github.com/apache/hudi/pull/6264#discussion_r940311939


##########
hudi-spark-datasource/hudi-spark3-common/src/main/scala/org/apache/spark/sql/HoodieSpark3CatalystPlanUtils.scala:
##########
@@ -52,8 +64,51 @@ abstract class HoodieSpark3CatalystPlanUtils extends 
HoodieCatalystPlansUtils {
     }
   }
 
-  override def toTableIdentifier(relation: UnresolvedRelation): 
TableIdentifier = {
-    relation.multipartIdentifier.asTableIdentifier
+  override def resolve(relation: UnresolvedRelation): Option[CatalogTable] = {
+    val nameParts = relation.multipartIdentifier
+    nameParts match {
+      case CatalogAndIdentifier(catalog, ident) =>
+        CatalogV2Util.loadTable(catalog, ident) match {
+          case Some(table) =>
+            table match {
+              case v1Table: V1Table =>
+                Some(v1Table.v1Table)
+              case withFallback: V2TableWithV1Fallback =>
+                Some(withFallback.v1Table)
+              case _ =>
+                logWarning("It's not a hoodie table: " + 
table.getClass.getName)
+                None
+            }
+        }
+      case _ =>
+        import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
+        
Some(spark.sessionState.catalog.getTableMetadata(nameParts.asTableIdentifier))
+    }
+  }
+
+  protected def expandIdentifier(nameParts: Seq[String]): Seq[String] = {

Review Comment:
   forget to call this.



-- 
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]

Reply via email to