yihua commented on code in PR #8714:
URL: https://github.com/apache/hudi/pull/8714#discussion_r1199299441


##########
pom.xml:
##########
@@ -2238,6 +2239,44 @@
       </activation>
     </profile>
 
+    <profile>
+      <id>spark3.0</id>
+      <properties>
+        <spark3.version>${spark30.version}</spark3.version>
+        <spark.version>${spark3.version}</spark.version>
+        <sparkbundle.version>3.0</sparkbundle.version>
+        <scala.version>${scala12.version}</scala.version>
+        <scala.binary.version>2.12</scala.binary.version>
+        <hudi.spark.module>hudi-spark3.0.x</hudi.spark.module>
+        
<hudi.spark.common.modules.1>hudi-spark3-common</hudi.spark.common.modules.1>
+        <kafka.version>${kafka.spark3.version}</kafka.version>

Review Comment:
   Seems it's not added.  But I assume it's not really necessary here.



##########
hudi-spark-datasource/hudi-spark3.0.x/src/main/scala/org/apache/spark/sql/adapter/Spark3_0Adapter.scala:
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.adapter
+
+import org.apache.avro.Schema
+import org.apache.hudi.Spark30HoodieFileScanRDD
+import org.apache.spark.sql.avro.{HoodieAvroDeserializer, 
HoodieAvroSerializer, HoodieSpark3_0AvroDeserializer, 
HoodieSpark3_0AvroSerializer}
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{AttributeReference, 
Expression}
+import org.apache.spark.sql.catalyst.parser.ParserInterface
+import org.apache.spark.sql.catalyst.plans.logical._
+import org.apache.spark.sql.execution.datasources.parquet.{ParquetFileFormat, 
Spark30HoodieParquetFileFormat}
+import org.apache.spark.sql.execution.datasources.{FilePartition, FileScanRDD, 
PartitionedFile}
+import org.apache.spark.sql.hudi.SparkAdapter
+import org.apache.spark.sql.parser.{HoodieExtendedParserInterface, 
HoodieSpark3_0ExtendedSqlParser}
+import org.apache.spark.sql.types.{DataType, Metadata, MetadataBuilder, 
StructType}
+import org.apache.spark.sql.vectorized.ColumnarUtils
+import org.apache.spark.sql._
+import org.apache.spark.sql.catalyst.analysis.EliminateSubqueryAliases
+import org.apache.spark.sql.catalyst.catalog.CatalogTable
+import org.apache.spark.sql.catalyst.planning.PhysicalOperation
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Relation
+import org.apache.spark.storage.StorageLevel
+import org.apache.spark.storage.StorageLevel._
+
+/**
+ * Implementation of [[SparkAdapter]] for Spark 3.0.x
+ */
+class Spark3_0Adapter extends BaseSpark3Adapter {
+
+  override def resolveHoodieTable(plan: LogicalPlan): Option[CatalogTable] = {
+    super.resolveHoodieTable(plan).orElse {
+      EliminateSubqueryAliases(plan) match {
+        // First, we need to weed out unresolved plans
+        case plan if !plan.resolved => None
+        // NOTE: When resolving Hudi table we allow [[Filter]]s and 
[[Project]]s be applied
+        //       on top of it
+        case PhysicalOperation(_, _, DataSourceV2Relation(table: CatalogTable, 
_, _, _, _)) if isHoodieTable(table) =>
+          Some(table)
+        case _ => None

Review Comment:
   Got it.



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