You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2017/10/09 19:22:18 UTC
[1/3] hive git commit: HIVE-17740 : HiveConf - Use SLF4J
Parameterization (Beluga Behr via Ashutosh Chauhan)
Repository: hive
Updated Branches:
refs/heads/master 139d8d0b1 -> 2fdd5aff4
HIVE-17740 : HiveConf - Use SLF4J Parameterization (Beluga Behr via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/bc8149c2
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/bc8149c2
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/bc8149c2
Branch: refs/heads/master
Commit: bc8149c293038b83275d3a78f5c860c4614c81b1
Parents: 139d8d0
Author: BELUGA BEHR <da...@gmail.com>
Authored: Mon Oct 9 12:19:34 2017 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Mon Oct 9 12:19:34 2017 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hive/conf/HiveConf.java | 30 +++++++++-----------
1 file changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/bc8149c2/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index d2afc2c..e3aa71f3 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -76,7 +76,7 @@ public class HiveConf extends Configuration {
protected String hiveJar;
protected Properties origProp;
protected String auxJars;
- private static final Logger l4j = LoggerFactory.getLogger(HiveConf.class);
+ private static final Logger LOG = LoggerFactory.getLogger(HiveConf.class);
private static boolean loadMetastoreConfig = false;
private static boolean loadHiveServer2Config = false;
private static URL hiveDefaultURL = null;
@@ -170,9 +170,7 @@ public class HiveConf extends Configuration {
URL sourceUrl = HiveConf.class.getProtectionDomain().getCodeSource().getLocation();
jarUri = sourceUrl.getProtocol().equalsIgnoreCase("jar") ? new URI(sourceUrl.getPath()) : sourceUrl.toURI();
} catch (Throwable e) {
- if (l4j.isInfoEnabled()) {
- l4j.info("Cannot get jar URI", e);
- }
+ LOG.info("Cannot get jar URI", e);
System.err.println("Cannot get jar URI: " + e.getMessage());
}
// From the jar file, the parent is /lib folder
@@ -183,8 +181,8 @@ public class HiveConf extends Configuration {
}
}
}
- if (doLog && l4j.isInfoEnabled()) {
- l4j.info("Found configuration file " + result);
+ if (doLog) {
+ LOG.info("Found configuration file {}", result);
}
return result;
}
@@ -193,9 +191,7 @@ public class HiveConf extends Configuration {
try {
return (f.exists() && f.isFile()) ? f.toURI().toURL() : null;
} catch (Throwable e) {
- if (l4j.isInfoEnabled()) {
- l4j.info("Error looking for config " + f, e);
- }
+ LOG.info("Error looking for config {}", f, e);
System.err.println("Error looking for config " + f + ": " + e.getMessage());
return null;
}
@@ -4143,13 +4139,13 @@ public class HiveConf extends Configuration {
public String getLogIdVar(String defaultValue) {
String retval = getVar(ConfVars.HIVE_LOG_TRACE_ID);
- if (retval.equals("")) {
- l4j.info("Using the default value passed in for log id: " + defaultValue);
+ if (StringUtils.EMPTY.equals(retval)) {
+ LOG.info("Using the default value passed in for log id: {}", defaultValue);
retval = defaultValue;
}
if (retval.length() > LOG_PREFIX_LENGTH) {
- l4j.warn("The original log id prefix is " + retval + " has been truncated to "
- + retval.substring(0, LOG_PREFIX_LENGTH - 1));
+ LOG.warn("The original log id prefix is {} has been truncated to {}", retval,
+ retval.substring(0, LOG_PREFIX_LENGTH - 1));
retval = retval.substring(0, LOG_PREFIX_LENGTH - 1);
}
return retval;
@@ -4283,7 +4279,7 @@ public class HiveConf extends Configuration {
if ((this.get("hive.metastore.ds.retry.attempts") != null) ||
this.get("hive.metastore.ds.retry.interval") != null) {
- l4j.warn("DEPRECATED: hive.metastore.ds.retry.* no longer has any effect. " +
+ LOG.warn("DEPRECATED: hive.metastore.ds.retry.* no longer has any effect. " +
"Use hive.hmshandler.retry.* instead");
}
@@ -4316,9 +4312,9 @@ public class HiveConf extends Configuration {
}
}
if (var == null) {
- l4j.warn("HiveConf of name " + key + " does not exist");
+ LOG.warn("HiveConf of name {} does not exist", key);
} else if (!var.isType(entry.getValue())) {
- l4j.warn("HiveConf " + var.varname + " expects " + var.typeString() + " type value");
+ LOG.warn("HiveConf {} expects {} type value", var.varname, var.typeString());
}
}
for (String key : trimmed) {
@@ -4826,7 +4822,7 @@ public class HiveConf extends Configuration {
}
public static String getNonMrEngines() {
- String result = "";
+ String result = StringUtils.EMPTY;
for (String s : ConfVars.HIVE_EXECUTION_ENGINE.getValidStringValues()) {
if ("mr".equals(s)) {
continue;
[3/3] hive git commit: HIVE-17742 : AccumuloIndexedOutputFormat Use
SLF4J (Beluga Behr via Ashutosh Chauhan)
Posted by ha...@apache.org.
HIVE-17742 : AccumuloIndexedOutputFormat Use SLF4J (Beluga Behr via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2fdd5aff
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2fdd5aff
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2fdd5aff
Branch: refs/heads/master
Commit: 2fdd5aff4360aca21baa3aa7e997c489981064ab
Parents: 1031b26
Author: BELUGA BEHR <da...@gmail.com>
Authored: Mon Oct 9 12:21:47 2017 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Mon Oct 9 12:21:47 2017 -0700
----------------------------------------------------------------------
.../mr/AccumuloIndexedOutputFormat.java | 50 ++++++++------------
1 file changed, 21 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/2fdd5aff/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/mr/AccumuloIndexedOutputFormat.java
----------------------------------------------------------------------
diff --git a/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/mr/AccumuloIndexedOutputFormat.java b/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/mr/AccumuloIndexedOutputFormat.java
index a055233..b9ad02d 100644
--- a/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/mr/AccumuloIndexedOutputFormat.java
+++ b/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/mr/AccumuloIndexedOutputFormat.java
@@ -38,8 +38,8 @@ import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.RecordWriter;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.Progressable;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
@@ -55,7 +55,7 @@ import java.util.Set;
* Extension of AccumuloOutputFormat to support indexing.
*/
public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
- private static final Logger LOG = Logger.getLogger(AccumuloIndexedOutputFormat.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AccumuloIndexedOutputFormat.class);
private static final Class<?> CLASS = AccumuloOutputFormat.class;
private static final byte[] EMPTY_BYTES = new byte[0];
@@ -107,10 +107,6 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
protected AccumuloRecordWriter(JobConf job)
throws AccumuloException, AccumuloSecurityException, IOException {
- Level l = AccumuloIndexedOutputFormat.getLogLevel(job);
- if (l != null) {
- LOG.setLevel(AccumuloIndexedOutputFormat.getLogLevel(job));
- }
this.isStringEncoded = AccumuloIndexedOutputFormat.getStringEncoding(job).booleanValue();
this.simulate = AccumuloIndexedOutputFormat.getSimulationMode(job).booleanValue();
this.createTables = AccumuloIndexedOutputFormat.canCreateTables(job).booleanValue();
@@ -124,7 +120,7 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
String iname = AccumuloIndexedOutputFormat.getIndexTableName(job);
if (iname != null) {
- LOG.info("Index Table = " + iname);
+ LOG.info("Index Table = {}", iname);
this.indexTableName = new Text(iname);
this.indexDef = createIndexDefinition(job, tname, iname);
}
@@ -140,7 +136,7 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
AccumuloIndexDefinition createIndexDefinition(JobConf job, String tname, String iname) {
AccumuloIndexDefinition def = new AccumuloIndexDefinition(tname, iname);
String cols = AccumuloIndexedOutputFormat.getIndexColumns(job);
- LOG.info("Index Cols = " + cols);
+ LOG.info("Index Cols = {}", cols);
def.setColumnTuples(cols);
return def;
}
@@ -161,7 +157,7 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
try {
this.addTable(table);
} catch (Exception var5) {
- LOG.error(var5);
+ LOG.error("Could not add table", var5);
throw new IOException(var5);
}
}
@@ -169,7 +165,7 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
try {
this.addTable(indexTableName);
} catch (Exception var6) {
- LOG.error(var6);
+ LOG.error("Could not add index table", var6);
throw new IOException(var6);
}
}
@@ -201,26 +197,26 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
public void addTable(Text tableName) throws AccumuloException, AccumuloSecurityException {
if(this.simulate) {
- LOG.info("Simulating adding table: " + tableName);
+ LOG.info("Simulating adding table: {}", tableName);
} else {
- LOG.debug("Adding table: " + tableName);
+ LOG.debug("Adding table: {}", tableName);
BatchWriter bw = null;
String table = tableName.toString();
if(this.createTables && !this.conn.tableOperations().exists(table)) {
try {
this.conn.tableOperations().create(table);
} catch (AccumuloSecurityException var8) {
- LOG.error("Accumulo security violation creating " + table, var8);
+ LOG.error("Accumulo security violation creating {}", table, var8);
throw var8;
} catch (TableExistsException var9) {
- LOG.warn("Table Exists " + table, var9);
+ LOG.warn("Table Exists {}", table, var9);
}
}
try {
bw = this.mtbw.getBatchWriter(table);
} catch (TableNotFoundException var5) {
- LOG.error("Accumulo table " + table + " doesn't exist and cannot be created.", var5);
+ LOG.error("Accumulo table {} doesn't exist and cannot be created.", table, var5);
throw new AccumuloException(var5);
}
@@ -233,19 +229,15 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
private int printMutation(Text table, Mutation m) {
if(LOG.isTraceEnabled()) {
- LOG.trace(String.format("Table %s row key: %s",
- new Object[]{table, this.hexDump(m.getRow())}));
+ LOG.trace("Table {} row key: {}", table, this.hexDump(m.getRow()));
Iterator itr = m.getUpdates().iterator();
while(itr.hasNext()) {
ColumnUpdate cu = (ColumnUpdate)itr.next();
- LOG.trace(String.format("Table %s column: %s:%s",
- new Object[]{table, this.hexDump(cu.getColumnFamily()),
- this.hexDump(cu.getColumnQualifier())}));
- LOG.trace(String.format("Table %s security: %s",
- new Object[]{table, (new ColumnVisibility(cu.getColumnVisibility())).toString()}));
- LOG.trace(String.format("Table %s value: %s",
- new Object[]{table, this.hexDump(cu.getValue())}));
+ LOG.trace("Table {} column: {}:{}",
+ table, this.hexDump(cu.getColumnFamily()), this.hexDump(cu.getColumnQualifier()));
+ LOG.trace("Table {} security: {}", table, new ColumnVisibility(cu.getColumnVisibility()).toString());
+ LOG.trace("Table {} value: {}", table, this.hexDump(cu.getValue()));
}
}
@@ -269,7 +261,7 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
// so key=value, cf=columnFamily_columnQualifer, cq=rowKey, cv=columnVisibility value=[]
String colType = indexDef.getColType(cf, cq);
if (colType != null) {
- LOG.trace(String.format("Building index for column %s:%s", new Object[]{cf, cq}));
+ LOG.trace("Building index for column {}:{}", cf, cq);
Mutation m = new Mutation(AccumuloIndexLexicoder.encodeValue(cu.getValue(), colType,
isStringEncoded));
String colFam = cf + "_" + cq;
@@ -300,7 +292,7 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
}
public void close(Reporter reporter) throws IOException {
- LOG.debug("mutations written: " + this.mutCount + ", values written: " + this.valCount);
+ LOG.debug("mutations written: {}, values written: {}", this.mutCount, this.valCount);
if(!this.simulate) {
try {
this.mtbw.close();
@@ -320,11 +312,11 @@ public class AccumuloIndexedOutputFormat extends AccumuloOutputFormat {
}
}
- LOG.error("Not authorized to write to tables : " + tables);
+ LOG.error("Not authorized to write to tables {}", tables);
}
if(var7.getConstraintViolationSummaries().size() > 0) {
- LOG.error("Constraint violations : " + var7.getConstraintViolationSummaries().size());
+ LOG.error("Constraint violations : {}", var7.getConstraintViolationSummaries().size());
}
throw new IOException(var7);
}
[2/3] hive git commit: HIVE-17732 : Minor Improvements -
org.apache.hive.hcatalog.data.JsonSerDe.java (Beluga Behr via Ashutosh
Chauhan)
Posted by ha...@apache.org.
HIVE-17732 : Minor Improvements - org.apache.hive.hcatalog.data.JsonSerDe.java (Beluga Behr via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1031b264
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1031b264
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1031b264
Branch: refs/heads/master
Commit: 1031b264969f822f6f70d3134ad0e28e855d37d9
Parents: bc8149c
Author: BELUGA BEHR <da...@gmail.com>
Authored: Mon Oct 9 12:20:47 2017 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Mon Oct 9 12:20:47 2017 -0700
----------------------------------------------------------------------
.../org/apache/hive/hcatalog/data/JsonSerDe.java | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/1031b264/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java
----------------------------------------------------------------------
diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java
index 831e857..17f9909 100644
--- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java
+++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java
@@ -106,10 +106,7 @@ public class JsonSerDe extends AbstractSerDe {
List<TypeInfo> columnTypes;
StructTypeInfo rowTypeInfo;
-
- LOG.debug("Initializing JsonSerDe");
- LOG.debug("props to serde: {}", tbl.entrySet());
-
+ LOG.debug("Initializing JsonSerDe: {}", tbl.entrySet());
// Get column names and types
String columnNameProperty = tbl.getProperty(serdeConstants.LIST_COLUMNS);
@@ -117,15 +114,15 @@ public class JsonSerDe extends AbstractSerDe {
final String columnNameDelimiter = tbl.containsKey(serdeConstants.COLUMN_NAME_DELIMITER) ? tbl
.getProperty(serdeConstants.COLUMN_NAME_DELIMITER) : String.valueOf(SerDeUtils.COMMA);
// all table column names
- if (columnNameProperty.length() == 0) {
- columnNames = new ArrayList<String>();
+ if (columnNameProperty.isEmpty()) {
+ columnNames = Collections.emptyList();
} else {
columnNames = Arrays.asList(columnNameProperty.split(columnNameDelimiter));
}
// all column types
- if (columnTypeProperty.length() == 0) {
- columnTypes = new ArrayList<TypeInfo>();
+ if (columnTypeProperty.isEmpty()) {
+ columnTypes = Collections.emptyList();
} else {
columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty);
}
@@ -176,11 +173,9 @@ public class JsonSerDe extends AbstractSerDe {
}
} catch (JsonParseException e) {
LOG.warn("Error [{}] parsing json text [{}].", e, t);
- LOG.debug(null, e);
throw new SerDeException(e);
} catch (IOException e) {
LOG.warn("Error [{}] parsing json text [{}].", e, t);
- LOG.debug(null, e);
throw new SerDeException(e);
}