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


##########
hudi-spark-datasource/hudi-spark3-common/src/main/scala/org/apache/spark/sql/HoodieSpark3CatalystPlanUtils.scala:
##########
@@ -52,8 +57,56 @@ abstract class HoodieSpark3CatalystPlanUtils extends 
HoodieCatalystPlansUtils {
     }
   }
 
-  override def toTableIdentifier(relation: UnresolvedRelation): 
TableIdentifier = {
-    relation.multipartIdentifier.asTableIdentifier
+  override def resolve(spark: SparkSession, relation: UnresolvedRelation): 
Option[CatalogTable] = {
+    val catalogManager = spark.sessionState.catalogManager
+    val nameParts = relation.multipartIdentifier
+    val expandedNameParts = expandIdentifier(spark, nameParts)
+    HoodieCatalogAndIdentifier.parse(catalogManager, expandedNameParts) match {
+      case Some((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(s"It's not a hoodie table: $table")

Review Comment:
   We want to get a CatalogTable object from `UnresolvedRelation` here.
   For all the sub-classes of `Table` trait, only `V1Table` and 
`V2TableWithV1Fallback` can convert to a `CatalogTable` object.
   And `HoodieInternalV2Table` self is a sub-class of `V2TableWithV1Fallback` 
and have a method `v1TableWrapper` to get a `V1Table` object. So here i catch 
the two pattern.
   According to your comment, what if I change to "can not get a CatalogTable 
from $table" or just remove this warning?



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to