thomasrebele commented on code in PR #6443:
URL: https://github.com/apache/hive/pull/6443#discussion_r3117290252


##########
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<>();

Review Comment:
   Thanks for the PR! When I created 
[HIVE-29551](https://issues.apache.org/jira/browse/HIVE-29551), I had in mind 
do it without a HashMap if possible. There are two types of usages, depending 
on where the column names came from:
   * ColumnStatsSemanticAnalyzer#getColumnName
   * Utilities.getColumnNamesFromFieldSchema
   The latter iterates over a list of FieldSchema, so the type info can be 
obtained from these items as well.
   
   The HashMap is only needed when the ASTNode has 3 children.



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