Aggarwal-Raghav commented on code in PR #6443:
URL: https://github.com/apache/hive/pull/6443#discussion_r3105571000
##########
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:
the variable name should be `PrimColNames` instead of `nonPrimColNames`. As
the primitve type will enter the else flow.
--
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]