Zouxxyy commented on code in PR #4573:
URL: https://github.com/apache/paimon/pull/4573#discussion_r1857786234


##########
paimon-spark/paimon-spark3-common/src/main/scala/org/apache/spark/sql/paimon/shims/Spark3Shim.scala:
##########
@@ -16,57 +16,53 @@
  * limitations under the License.
  */
 
-package org.apache.spark.sql.paimon
+package org.apache.spark.sql.paimon.shims
+
+import org.apache.paimon.spark.data.{Spark3ArrayData, Spark3InternalRow, 
SparkArrayData, SparkInternalRow}
+import org.apache.paimon.types.{DataType, RowType}
 
 import org.apache.spark.sql.{Column, SparkSession}
-import org.apache.spark.sql.catalyst.{InternalRow => SparkInternalRow}
 import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression}
-import org.apache.spark.sql.catalyst.parser.{ParserInterface => 
SparkParserInterface}
-import org.apache.spark.sql.catalyst.plans.logical.{Aggregate => 
SparkAggregate}
-import org.apache.spark.sql.catalyst.util.{ArrayData => SparkArrayData}
-import org.apache.spark.sql.connector.catalog.{Identifier, Table, TableCatalog 
=> SparkTableCatalog}
+import org.apache.spark.sql.catalyst.parser.ParserInterface
+import 
org.apache.spark.sql.catalyst.parser.extensions.PaimonSparkSqlExtensionsParser
+import org.apache.spark.sql.catalyst.plans.logical.Aggregate
+import org.apache.spark.sql.connector.catalog.{Identifier, Table, TableCatalog}
 import org.apache.spark.sql.connector.expressions.Transform
 import org.apache.spark.sql.types.StructType
 
 import java.util.{Map => JMap}
 
-/** Shims for Spark 3.x in [[org.apache.spark.sql]]. */
-object shims {
-
-  /** In [[org.apache.spark.sql.catalyst]]. */
+class Spark3Shim extends SparkShim {
 
-  abstract class ParserInterface extends SparkParserInterface {
-    val delegate: SparkParserInterface
+  override def createSparkParser(delegate: ParserInterface): ParserInterface = 
{
+    new PaimonSparkSqlExtensionsParser(delegate)
   }
 
-  abstract class ArrayData extends SparkArrayData {}
-
-  abstract class InternalRow extends SparkInternalRow {}
+  override def createSparkInternalRow(rowType: RowType): SparkInternalRow = {
+    new Spark3InternalRow(rowType)

Review Comment:
   Maybe we can use a unified style, such as unifying 
`PaimonSpark3SqlExtensionsParser` `Spark3InternalRow`,
    or `PaimonSparkSqlExtensionsParser` `SparkInternalRow`.



##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/data/SparkInternalRow.scala:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.paimon.spark.data
+
+import org.apache.paimon.types.RowType
+
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.paimon.shims.SparkShimLoader
+
+abstract class SparkInternalRow extends InternalRow {

Review Comment:
   Why we need this, the current inheritance structure is three layers.
   `Spark3InternalRow` extends `AbstractSparkInternalRow` entends 
`SparkInternalRow`



-- 
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: issues-unsubscr...@paimon.apache.org

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

Reply via email to