pvary commented on code in PR #4942:
URL: https://github.com/apache/iceberg/pull/4942#discussion_r888834181
##########
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/SparkTestBaseWithCatalog.java:
##########
@@ -80,13 +80,24 @@ public SparkTestBaseWithCatalog(String catalogName, String
implementation, Map<S
spark.conf().set("spark.sql.catalog." + catalogName, implementation);
config.forEach((key, value) -> spark.conf().set("spark.sql.catalog." +
catalogName + "." + key, value));
- if (config.get("type").equalsIgnoreCase("hadoop")) {
+ boolean isHadoopCatalog = config.get("type").equalsIgnoreCase("hadoop");
+ if (isHadoopCatalog) {
spark.conf().set("spark.sql.catalog." + catalogName + ".warehouse",
"file:" + warehouse);
}
this.tableName = (catalogName.equals("spark_catalog") ? "" : catalogName +
".") + "default.table";
- sql("CREATE NAMESPACE IF NOT EXISTS default");
+ // When Hive API is invoked to create Namespace/Database using CREATE IF
NOT EXISTS, the standalone HMS logs an
+ // AlreadyExistsException exception in the test logs thereby generating
unwanted error logs. Thus checking if a
+ // namespace exists before creating one to keep the test logs noise-free.
+ // HMS is not involved in case HadoopCatalog, thus skipping the check for
HadoopCatalog.
+ if (isHadoopCatalog) {
+ sql("CREATE NAMESPACE IF NOT EXISTS default");
+ } else {
+ if
(!validationNamespaceCatalog.namespaceExists(Namespace.of("default"))) {
Review Comment:
Would this work for HadoopCatalog as well? So we can just keep the code more
simple?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]