gh-yzou commented on code in PR #3188:
URL: https://github.com/apache/polaris/pull/3188#discussion_r2582987888


##########
plugins/spark/spark-scala.properties:
##########
@@ -17,6 +17,9 @@
 # under the License.
 #
 
-sparkVersions=3.5
+sparkVersions=3.5,4.0
 
 scalaVersions=2.12,2.13

Review Comment:
   can we have this be scalaVersions.3.5 to be consistent ?



##########
plugins/spark/v4.0/integration/build.gradle.kts:
##########
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+plugins {
+  alias(libs.plugins.quarkus)
+  id("org.kordamp.gradle.jandex")
+  id("polaris-runtime")
+}
+
+// get version information
+val sparkMajorVersion = "4.0"
+val scalaVersion = getAndUseScalaVersionForProject()
+val icebergVersion = pluginlibs.versions.iceberg.get()
+val spark40Version = pluginlibs.versions.spark40.get()
+val scalaLibraryVersion =
+  if (scalaVersion == "2.12") {
+    pluginlibs.versions.scala212.get()
+  } else {
+    pluginlibs.versions.scala213.get()

Review Comment:
   scala213 is no going to be a valid version for 4.0 anymore right? i don't 
think we nee dthis anymore



##########
plugins/spark/v3.5/README.md:
##########
@@ -0,0 +1,127 @@
+<!--
+  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.
+-->
+
+# Polaris Spark 3.5 Plugin
+
+The Polaris Spark plugin provides a SparkCatalog class, which communicates 
with the Polaris
+REST endpoints, and provides implementations for Apache Spark's
+[TableCatalog](https://github.com/apache/spark/blob/v3.5.6/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TableCatalog.java),
+[ViewCatalog](https://github.com/apache/spark/blob/v3.5.6/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/ViewCatalog.java)
 classes.
+[SupportsNamespaces](https://github.com/apache/spark/blob/v3.5.6/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsNamespaces.java),
+
+Right now, the plugin only provides support for Spark 3.5, Scala version 2.12 
and 2.13,
+and depends on iceberg-spark-runtime 1.9.1.

Review Comment:
   it seems we updated the iceberg version, but didn't update the doc here, the 
compatible version now is 1.10.0 for all spark client



##########
plugins/spark/v4.0/spark/src/main/java/org/apache/polaris/spark/PolarisSparkCatalog.java:
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.polaris.spark;
+
+import java.util.Map;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.exceptions.AlreadyExistsException;
+import org.apache.iceberg.spark.Spark3Util;
+// Use the spec class defined at client side under the rest package.
+// The spec classes used at client side and server side are different in
+// terms of import, where the client side uses the shaded jackson library
+// from iceberg-spark-runtime.
+import org.apache.polaris.spark.rest.GenericTable;
+import org.apache.polaris.spark.utils.PolarisCatalogUtils;
+import org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException;
+import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
+import org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException;
+import org.apache.spark.sql.connector.catalog.Identifier;
+import org.apache.spark.sql.connector.catalog.Table;
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.catalog.TableChange;
+import org.apache.spark.sql.connector.expressions.Transform;
+import org.apache.spark.sql.types.StructType;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A spark TableCatalog Implementation interacts with Polaris specific APIs 
only. The APIs it
+ * interacts with is generic table APIs, and all table operations performed in 
this class are
+ * expected to be for non-iceberg tables.
+ */
+public class PolarisSparkCatalog implements TableCatalog {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(PolarisSparkCatalog.class);
+
+  private PolarisCatalog polarisCatalog = null;
+  private String catalogName = null;
+
+  public PolarisSparkCatalog(PolarisCatalog polarisCatalog) {
+    this.polarisCatalog = polarisCatalog;
+  }
+
+  @Override
+  public void initialize(String name, CaseInsensitiveStringMap options) {
+    this.catalogName = name;
+  }
+
+  @Override
+  public String name() {
+    return catalogName;
+  }
+
+  @Override
+  public Table loadTable(Identifier identifier) throws NoSuchTableException {
+    try {
+      GenericTable genericTable =

Review Comment:
   Rahil recently merged the support for hudi in, can we also cooperate this 
part?



##########
plugins/spark/v4.0/spark/src/main/java/org/apache/polaris/spark/PolarisCatalog.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.polaris.spark;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;

Review Comment:
   PolarisCatalog.java, PolarisRESTCatalog, and all classes under rest are 
actually related to Polaris its-self instead spark, and shouldn't change along 
with the spark version, which is similar to the rest component in iceberg-core. 
How about let's do a small refactor first to move those part out as a client 
rest component, and then let spark depends on 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