tanishq-chugh commented on code in PR #6443:
URL: https://github.com/apache/hive/pull/6443#discussion_r3106447794


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java:
##########
@@ -205,23 +206,28 @@ private static String getColTypeOf(Table tbl, String 
partKey) {
   protected static List<String> getColumnTypes(Table tbl, List<String> 
colNames) {
     List<String> colTypes = new ArrayList<>();
     List<FieldSchema> cols = tbl.getCols();
-    List<String> copyColNames = new ArrayList<>(colNames);
-
-    for (String colName : copyColNames) {
-      for (FieldSchema col : cols) {
-        if (colName.equalsIgnoreCase(col.getName())) {
-          String type = col.getType();
-          TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(type);
-          if (typeInfo.getCategory() != ObjectInspector.Category.PRIMITIVE) {
-            logTypeWarning(colName, type);
-            colNames.remove(colName);
-          } else {
-            colTypes.add(type);
-          }
+    Map<String, String> colTypeMap = new HashMap<>();
+
+    for (FieldSchema col : cols) {
+      colTypeMap.put(col.getName().toLowerCase(), col.getType());
+    }
+
+    List<String> nonPrimColNames = new ArrayList<>();
+    for (String colName : colNames) {
+      String type = colTypeMap.get(colName.toLowerCase());
+      if (type != null) {
+        TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(type);
+        if (typeInfo.getCategory() != ObjectInspector.Category.PRIMITIVE) {
+          logTypeWarning(colName, type);
+        } else {
+          nonPrimColNames.add(colName);

Review Comment:
   @Aggarwal-Raghav My bad, i validated the columnTypes/names being returned 
for primitive types and used the wrong variable name. Updated in commit - 
[4a6804d](https://github.com/apache/hive/pull/6443/commits/4a6804d75a2d0bf084dd87b1315f657be7ce3d2a)
 . 
   Thanks for pointing this out !



-- 
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]

Reply via email to