YannByron commented on code in PR #4573:
URL: https://github.com/apache/paimon/pull/4573#discussion_r1857858091
##########
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:
Right,I choose the first style.
--
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]