Repository: hive
Updated Branches:
  refs/heads/master 3a3ffaa90 -> eb7a8f909


HIVE-17290 Should use equals() rather than == to compare strings (Oleg Danilov 
via Alan Gates) (This closes #226)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/eb7a8f90
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/eb7a8f90
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/eb7a8f90

Branch: refs/heads/master
Commit: eb7a8f909b6ace29bc64995a1f14b36ad28259ef
Parents: 3a3ffaa
Author: Alan Gates <ga...@hortonworks.com>
Authored: Sat Aug 12 14:03:07 2017 -0700
Committer: Alan Gates <ga...@hortonworks.com>
Committed: Sat Aug 12 14:03:07 2017 -0700

----------------------------------------------------------------------
 .../hive/accumulo/serde/DefaultAccumuloRowIdFactory.java     | 2 +-
 .../hive/hcatalog/cli/SemanticAnalysis/HCatAuthUtil.java     | 3 +--
 .../apache/hadoop/hive/ql/exec/HashTableDummyOperator.java   | 5 ++---
 .../apache/hadoop/hive/ql/exec/errors/ErrorAndSolution.java  | 5 +++--
 .../org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java | 2 +-
 .../hive/ql/metadata/HiveMaterializedViewsRegistry.java      | 6 +++---
 .../optimizer/calcite/translator/SqlFunctionConverter.java   | 4 ++--
 ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java | 2 +-
 .../plugin/sqlstd/SQLStdHiveAccessController.java            | 3 ++-
 .../src/org/apache/hadoop/hive/tools/GenVectorCode.java      | 8 ++++----
 10 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/DefaultAccumuloRowIdFactory.java
----------------------------------------------------------------------
diff --git 
a/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/DefaultAccumuloRowIdFactory.java
 
b/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/DefaultAccumuloRowIdFactory.java
index 6d96d9b..b51ff9b 100644
--- 
a/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/DefaultAccumuloRowIdFactory.java
+++ 
b/accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/DefaultAccumuloRowIdFactory.java
@@ -77,7 +77,7 @@ public class DefaultAccumuloRowIdFactory implements 
AccumuloRowIdFactory {
 //    return LazyFactory.createLazyObject(inspector,
 //            ColumnEncoding.BINARY == rowIdMapping.getEncoding());
     return LazyFactory.createLazyObject(inspector,
-        inspector.getTypeName() != TypeInfoFactory.stringTypeInfo.getTypeName()
+            
!TypeInfoFactory.stringTypeInfo.getTypeName().equals(inspector.getTypeName())
             && ColumnEncoding.BINARY == rowIdMapping.getEncoding());
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatAuthUtil.java
----------------------------------------------------------------------
diff --git 
a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatAuthUtil.java
 
b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatAuthUtil.java
index ff10b05..edd92e8 100644
--- 
a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatAuthUtil.java
+++ 
b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatAuthUtil.java
@@ -40,8 +40,7 @@ final class HCatAuthUtil {
     // The recommended configuration is to use storage based authorization in 
metastore server.
     // However, if user define a custom V1 authorization, it will be honored.
     if (SessionState.get().getAuthorizer() == null ||
-        HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER)
-        == DefaultHiveAuthorizationProvider.class.getName()) {
+        
DefaultHiveAuthorizationProvider.class.getName().equals(HiveConf.getVar(conf, 
HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER))) {
       LOG.info("Metastore authorizer is skipped for V2 authorizer or"
         + " DefaultHiveAuthorizationProvider");
       return false;

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java
index 2075d9b..537e39b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/HashTableDummyOperator.java
@@ -79,10 +79,9 @@ public class HashTableDummyOperator extends 
Operator<HashTableDummyDesc> impleme
 
   @Override
   public boolean equals(Object obj) {
-    return super.equals(obj) || (obj instanceof HashTableDummyOperator)
-        && (((HashTableDummyOperator)obj).operatorId == operatorId);
+    return super.equals(obj) || (obj instanceof HashTableDummyOperator) && 
((HashTableDummyOperator)obj).operatorId.equals(operatorId);
   }
-  
+
   @Override
   public int hashCode() {
     return operatorId.hashCode();

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/exec/errors/ErrorAndSolution.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/errors/ErrorAndSolution.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/errors/ErrorAndSolution.java
index bc07035..bc07b2b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/errors/ErrorAndSolution.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/errors/ErrorAndSolution.java
@@ -18,6 +18,8 @@
 
 package org.apache.hadoop.hive.ql.exec.errors;
 
+import java.util.Objects;
+
 /**
  * Immutable class for storing a possible error and a resolution suggestion.
  */
@@ -45,8 +47,7 @@ public class ErrorAndSolution {
       return false;
     }
     ErrorAndSolution e = (ErrorAndSolution)o;
-
-    return e.error == this.error && e.solution == this.solution;
+    return Objects.equals(e.error, error) && Objects.equals(e.solution, 
solution);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java 
b/ql/src/java/org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java
index 9a7e9d9..5256c46 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/CombineHiveInputFormat.java
@@ -610,7 +610,7 @@ public class CombineHiveInputFormat<K extends 
WritableComparable, V extends Writ
         // 2. the alias it serves is not sampled
         // 3. it serves different alias than another path for the same split
         if (l.size() != 1 || !nameToSamples.containsKey(l.get(0)) ||
-            (alias != null && l.get(0) != alias)) {
+            (alias != null && !alias.equals(l.get(0)))) {
           alias = null;
           break;
         }

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java
index 56c0163..5dff242 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -74,7 +75,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableList;
 
-/** 
+/**
  * Registry for materialized views. The goal of this cache is to avoid parsing 
and creating
  * logical plans for the materialized views at query runtime. When a query 
arrives, we will
  * just need to consult this cache and extract the logical plans for the views 
(which had
@@ -358,8 +359,7 @@ public final class HiveMaterializedViewsRegistry {
         return false;
       }
       ViewKey viewKey = (ViewKey) obj;
-      return creationDate == viewKey.creationDate &&
-          (viewName == viewKey.viewName || (viewName != null && 
viewName.equals(viewKey.viewName)));
+      return creationDate == viewKey.creationDate && Objects.equals(viewName, 
viewKey.viewName);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java
index c6b34d4..a9198a1 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/SqlFunctionConverter.java
@@ -127,9 +127,9 @@ public class SqlFunctionConverter {
     }
     // Make sure we handle unary + and - correctly.
     if (argsLength == 1) {
-      if (name == "+") {
+      if ("+".equals(name)) {
         name = FunctionRegistry.UNARY_PLUS_FUNC_NAME;
-      } else if (name == "-") {
+      } else if ("-".equals(name)) {
         name = FunctionRegistry.UNARY_MINUS_FUNC_NAME;
       }
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java
index 2b575b5..1671773 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java
@@ -913,7 +913,7 @@ public class TezCompiler extends TaskCompiler {
       GroupByDesc gbDesc = gbOp.getConf();
       ArrayList<AggregationDesc> aggregationDescs = gbDesc.getAggregators();
       for (AggregationDesc agg : aggregationDescs) {
-        if (agg.getGenericUDAFName() != "bloom_filter") {
+        if (!"bloom_filter".equals(agg.getGenericUDAFName())) {
           continue;
         }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLStdHiveAccessController.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLStdHiveAccessController.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLStdHiveAccessController.java
index d5c3a1a..5d62c91 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLStdHiveAccessController.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLStdHiveAccessController.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 
 import org.slf4j.Logger;
@@ -104,7 +105,7 @@ public class SQLStdHiveAccessController implements 
HiveAccessController {
     // the interface. this helps in being able to switch the user within a 
session.
     // so we need to check if the user has changed
     String newUserName = authenticator.getUserName();
-    if(currentUserName == newUserName){
+    if (Objects.equals(currentUserName, newUserName)) {
       //no need to (re-)initialize the currentUserName, currentRoles fields
       return;
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/eb7a8f90/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
----------------------------------------------------------------------
diff --git 
a/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java 
b/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
index b87ec55..19b121c 100644
--- a/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
+++ b/vector-code-gen/src/org/apache/hadoop/hive/tools/GenVectorCode.java
@@ -1428,10 +1428,10 @@ public class GenVectorCode extends Task {
     String truncStringTypeName = tdesc[1];
     String truncStringHiveType;
     String truncStringHiveGetBytes;
-    if (truncStringTypeName == "Char") {
+    if ("Char".equals(truncStringTypeName)) {
       truncStringHiveType = "HiveChar";
       truncStringHiveGetBytes = "getStrippedValue().getBytes()";
-    } else if (truncStringTypeName == "VarChar") {
+    } else if ("VarChar".equals(truncStringTypeName)) {
       truncStringHiveType = "HiveVarchar";
       truncStringHiveGetBytes = "getValue().getBytes()";
     } else {
@@ -2048,10 +2048,10 @@ public class GenVectorCode extends Task {
     String truncStringTypeName = tdesc[1];
     String truncStringHiveType;
     String truncStringHiveGetBytes;
-    if (truncStringTypeName == "Char") {
+    if ("Char".equals(truncStringTypeName)) {
       truncStringHiveType = "HiveChar";
       truncStringHiveGetBytes = "getStrippedValue().getBytes()";
-    } else if (truncStringTypeName == "VarChar") {
+    } else if ("VarChar".equals(truncStringTypeName)) {
       truncStringHiveType = "HiveVarchar";
       truncStringHiveGetBytes = "getValue().getBytes()";
     } else {

Reply via email to