Skip to content
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

Build: Bump org.eclipse.jgit from 5.13.1.202206130422-r to 6.4.0.202211300538-r #14

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Default user to OS
  • Loading branch information
Haizhou Zhao committed Jan 12, 2023
commit 40c2a1c4eb48d3716247ea94d09c786e93f19a94
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ Database convertToDatabase(Namespace namespace, Map<String, String> meta) {
});

if (database.getOwnerName() == null) {
database.setOwnerName(HiveHadoopUtil.getUserName());
database.setOwnerName(HiveHadoopUtil.currentUser());
database.setOwnerType(PrincipalType.USER);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@
package org.apache.iceberg.hive;

import java.io.IOException;
import java.io.UncheckedIOException;
import org.apache.hadoop.security.UserGroupInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HiveHadoopUtil {

private static final Logger LOG = LoggerFactory.getLogger(HiveHadoopUtil.class);

private HiveHadoopUtil() {}

public static String getUserName() {
public static String currentUser() {
try {
return UserGroupInformation.getCurrentUser().getUserName();
} catch (IOException e) {
throw new UncheckedIOException("Fail to obtain Hadoop UGI user", e);
LOG.warn("Fail to obtain Hadoop UGI user", e);
return System.getProperty("user.name");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ private Table newHmsTable(TableMetadata metadata) {
new Table(
tableName,
database,
metadata.property(HiveCatalog.HMS_TABLE_OWNER, HiveHadoopUtil.getUserName()),
metadata.property(HiveCatalog.HMS_TABLE_OWNER, HiveHadoopUtil.currentUser()),
(int) currentTimeMillis / 1000,
(int) currentTimeMillis / 1000,
Integer.MAX_VALUE,
Expand Down