You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "youngxinler (via GitHub)" <gi...@apache.org> on 2023/02/20 11:42:36 UTC

[GitHub] [iceberg] youngxinler commented on a diff in pull request #6886: Spark: allows catalog.warehouse for Spark Hive Catalogs #6863

youngxinler commented on code in PR #6886:
URL: https://github.com/apache/iceberg/pull/6886#discussion_r1111837244


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:
##########
@@ -127,6 +128,16 @@ protected Catalog buildIcebergCatalog(String name, CaseInsensitiveStringMap opti
     optionsMap.putAll(options.asCaseSensitiveMap());
     optionsMap.put(CatalogProperties.APP_ID, SparkSession.active().sparkContext().applicationId());
     optionsMap.put(CatalogProperties.USER, SparkSession.active().sparkContext().sparkUser());
+    if (conf.get(CatalogProperties.WAREHOUSE_LOCATION) != null) {
+      optionsMap.put(
+          CatalogProperties.WAREHOUSE_LOCATION, conf.get(CatalogProperties.WAREHOUSE_LOCATION));
+    } else if (optionsMap.get(StaticSQLConf.WAREHOUSE_PATH().key()) != null) {
+      // if spark.sql.catalog.$catalogName.warehouse no setting, will try use
+      // spark.sql.warehouse.dir as catalog warehouse.
+      optionsMap.put(
+          CatalogProperties.WAREHOUSE_LOCATION,
+          optionsMap.get(StaticSQLConf.WAREHOUSE_PATH().key()));
+    }

Review Comment:
   Supports `spark.sql.warehouse.dir` and assumes that `spark.sql.catalog.$catalogName.warehouse` is preferred.
   
   I think it is more general to pass the warehouse path through `CatalogProperties.WAREHOUSE_LOCATION`? 
   Because both `HadoopCatalog` and `HiveCatalog` are adapted to `CatalogProperties.WAREHOUSE_LOCATION`.
   
   > StaticSQLConf.WAREHOUSE_PATH().key() = spark.sql.warehouse.dir
   



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