You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/09/02 08:26:14 UTC

[GitHub] [iceberg] linyanghao opened a new pull request, #5693: Spark: Check for hive support when using SparkSessionCatalog

linyanghao opened a new pull request, #5693:
URL: https://github.com/apache/iceberg/pull/5693

   This resolves #5692


-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] linyanghao commented on pull request #5693: Spark: Check for hive support when using SparkSessionCatalog

Posted by GitBox <gi...@apache.org>.
linyanghao commented on PR #5693:
URL: https://github.com/apache/iceberg/pull/5693#issuecomment-1285254705

   > changes make sense to me, but I'm unsure about their implications. @RussellSpitzer could you review this one as well please?
   
   @RussellSpitzer doesn't seem to be active recently. Should we ask other people for the review? @nastra 


-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] linyanghao commented on a diff in pull request #5693: Spark: Check for hive support when using SparkSessionCatalog

Posted by GitBox <gi...@apache.org>.
linyanghao commented on code in PR #5693:
URL: https://github.com/apache/iceberg/pull/5693#discussion_r966673279


##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:
##########
@@ -289,6 +292,19 @@ public final void initialize(String name, CaseInsensitiveStringMap options) {
     this.createOrcAsIceberg = options.getBoolean("orc-enabled", createOrcAsIceberg);
   }
 
+  private void checkHiveSupport() {
+    RuntimeConfig runtimeConfig = SparkSession.active().conf();
+    String sparkCatalogImpl = runtimeConfig.get(StaticSQLConf.CATALOG_IMPLEMENTATION().key());
+    if (sparkCatalogImpl != null) {
+      Preconditions.checkArgument(
+          sparkCatalogImpl.equals("hive"),
+          "Please enable hive support for Spark. "

Review Comment:
   > should the error msg mention how to enable it? `Please enable hive support for Spark by setting 'spark.sql.catalogImplementation=hive'` or something along those lines
   
   How about `Please enable hive support for Spark by calling enableHiveSupport() or setting 'spark.sql.catalogImplementation=hive'`



-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #5693: Spark: Check for hive support when using SparkSessionCatalog

Posted by GitBox <gi...@apache.org>.
nastra commented on code in PR #5693:
URL: https://github.com/apache/iceberg/pull/5693#discussion_r966059518


##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:
##########
@@ -289,6 +292,19 @@ public final void initialize(String name, CaseInsensitiveStringMap options) {
     this.createOrcAsIceberg = options.getBoolean("orc-enabled", createOrcAsIceberg);
   }
 
+  private void checkHiveSupport() {
+    RuntimeConfig runtimeConfig = SparkSession.active().conf();
+    String sparkCatalogImpl = runtimeConfig.get(StaticSQLConf.CATALOG_IMPLEMENTATION().key());
+    if (sparkCatalogImpl != null) {
+      Preconditions.checkArgument(
+          sparkCatalogImpl.equals("hive"),
+          "Please enable hive support for Spark. "

Review Comment:
   should the error msg mention how to enable it? `Please enable hive support for Spark by setting 'spark.sql.catalogImplementation=hive'` or something along those lines



-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #5693: Spark: Check for hive support when using SparkSessionCatalog

Posted by GitBox <gi...@apache.org>.
nastra commented on code in PR #5693:
URL: https://github.com/apache/iceberg/pull/5693#discussion_r966067332


##########
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/TestSparkSessionCatalogWithoutHiveSupport.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.iceberg.spark;
+
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.internal.StaticSQLConf;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestSparkSessionCatalogWithoutHiveSupport {
+  @Test
+  public void testCheckHiveSupport() {
+    try (SparkSession sparkWithoutHiveSupport =
+        SparkSession.builder()
+            .master("local[2]")
+            .config(
+                "spark.sql.catalog.spark_catalog", "org.apache.iceberg.spark.SparkSessionCatalog")
+            .config("spark.sql.catalog.spark_catalog.type", "hive")
+            .getOrCreate()) {
+      IllegalArgumentException exception =

Review Comment:
   ```suggestion
         Assertions.assertThatThrownBy(() -> sparkWithoutHiveSupport.sessionState().catalogManager().v2SessionCatalog())
         .isInstanceOf(IllegalArgumentException.class)
         .hasMessage(errorMessage);
   ```



##########
spark/v3.3/spark/src/test/java/org/apache/iceberg/spark/TestSparkSessionCatalogWithoutHiveSupport.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.iceberg.spark;
+
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.internal.StaticSQLConf;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestSparkSessionCatalogWithoutHiveSupport {
+  @Test
+  public void testCheckHiveSupport() {
+    try (SparkSession sparkWithoutHiveSupport =
+        SparkSession.builder()
+            .master("local[2]")
+            .config(
+                "spark.sql.catalog.spark_catalog", "org.apache.iceberg.spark.SparkSessionCatalog")
+            .config("spark.sql.catalog.spark_catalog.type", "hive")
+            .getOrCreate()) {
+      IllegalArgumentException exception =

Review Comment:
   ```suggestion
         Assertions.assertThatThrownBy(() -> sparkWithoutHiveSupport.sessionState().catalogManager().v2SessionCatalog())
         .isInstanceOf(IllegalArgumentException.class)
         .hasMessage(errorMessage);
   ```



-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #5693: Spark: Check for hive support when using SparkSessionCatalog

Posted by GitBox <gi...@apache.org>.
nastra commented on code in PR #5693:
URL: https://github.com/apache/iceberg/pull/5693#discussion_r966682861


##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:
##########
@@ -289,6 +292,19 @@ public final void initialize(String name, CaseInsensitiveStringMap options) {
     this.createOrcAsIceberg = options.getBoolean("orc-enabled", createOrcAsIceberg);
   }
 
+  private void checkHiveSupport() {
+    RuntimeConfig runtimeConfig = SparkSession.active().conf();
+    String sparkCatalogImpl = runtimeConfig.get(StaticSQLConf.CATALOG_IMPLEMENTATION().key());
+    if (sparkCatalogImpl != null) {
+      Preconditions.checkArgument(
+          sparkCatalogImpl.equals("hive"),
+          "Please enable hive support for Spark. "

Review Comment:
   sgtm



-- 
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-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org