-
Notifications
You must be signed in to change notification settings - Fork 2.9k
0.12.1 Cherry-Picks: Part 3 #3428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3805b5e
22fb0ad
5850573
bd06b71
0ade1c0
b9c7be7
a50ab92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ | |
|
|
||
| package org.apache.iceberg.mr; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.Properties; | ||
|
|
@@ -39,6 +38,7 @@ | |
| import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; | ||
| import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Maps; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Streams; | ||
|
|
||
| /** | ||
|
|
@@ -150,7 +150,7 @@ public static Table createTable(Configuration conf, Properties props) { | |
| String catalogName = props.getProperty(InputFormatConfig.CATALOG_NAME); | ||
|
|
||
| // Create a table property map without the controlling properties | ||
| Map<String, String> map = new HashMap<>(props.size()); | ||
| Map<String, String> map = Maps.newHashMapWithExpectedSize(props.size()); | ||
| for (Object key : props.keySet()) { | ||
| if (!PROPERTIES_TO_REMOVE.contains(key)) { | ||
| map.put(key.toString(), props.get(key).toString()); | ||
|
|
@@ -202,7 +202,15 @@ public static boolean dropTable(Configuration conf, Properties props) { | |
| */ | ||
| public static boolean hiveCatalog(Configuration conf, Properties props) { | ||
| String catalogName = props.getProperty(InputFormatConfig.CATALOG_NAME); | ||
| return CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE.equalsIgnoreCase(getCatalogType(conf, catalogName)); | ||
| String catalogType = getCatalogType(conf, catalogName); | ||
| if (catalogType != null) { | ||
| return CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE.equalsIgnoreCase(catalogType); | ||
| } | ||
| catalogType = getCatalogType(conf, ICEBERG_DEFAULT_CATALOG_NAME); | ||
| if (catalogType != null) { | ||
| return CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE.equalsIgnoreCase(catalogType); | ||
| } | ||
| return getCatalogProperties(conf, catalogName, catalogType).get(CatalogProperties.CATALOG_IMPL) == null; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole block didn't cherry-pick cleanly, because we didn't grab this PR: Core: Throw an exception if both catalog type and catalog-impl are set #3162 This is the PR from which these changes came from: Hive: Fix Catalogs.hiveCatalog method for default catalogs #3338. I don't think we should grab #3162 as it could break existing user's presently valid configs, but very much open to discussion on that.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. Let's not port #3162. |
||
| } | ||
|
|
||
| @VisibleForTesting | ||
|
|
@@ -279,9 +287,7 @@ private static String getCatalogType(Configuration conf, String catalogName) { | |
| } | ||
| } else { | ||
| String catalogType = conf.get(InputFormatConfig.CATALOG); | ||
| if (catalogType == null) { | ||
| return CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE; | ||
| } else if (catalogType.equals(LOCATION)) { | ||
| if (catalogType != null && catalogType.equals(LOCATION)) { | ||
| return NO_CATALOG_TYPE; | ||
| } else { | ||
| return catalogType; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original PR #3273, this was in
spark/v3.0/build.gradle. But we're not including the structural refactor in the point release.Additionally, this was
testImplementation. Given that the above dependencies were also changed totestImplementation, I chose to be consistent and usetestCompile.