ayushtkn commented on code in PR #6658:
URL: https://github.com/apache/hive/pull/6658#discussion_r3776658043


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/add/AlterViewAddPartitionAnalyzer.java:
##########
@@ -79,10 +89,10 @@ protected void postProcess(TableName tableName, Table 
table, AlterTableAddPartit
         } else {
           where.append(" AND ");
         }
+        FieldSchema partCol = table.getColumnByName(entry.getKey());

Review Comment:
   Shoudln't this be?
   ```
   FieldSchema partCol = table.getPartColByName(entry.getKey());
   ```
   
   can u check how it is working currently, the logic inside `getPartColByName` 
handles `nonNativePartition` as well, see if it is working



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/CreateViewAnalyzer.java:
##########
@@ -189,6 +190,12 @@ private List<FieldSchema> getPartitionColumns(List<String> 
partitionColumnNames)
     while (columnNameIterator.hasNext()) {
       String columnName = columnNameIterator.next();
       FieldSchema fieldSchema = schemaIterator.next();
+      try {
+        TypeInfoFactory.getPrimitiveTypeInfo(fieldSchema.getType());
+      } catch (Exception e) {
+        throw new 
SemanticException(ErrorMsg.PARTITION_COLUMN_NON_PRIMITIVE.getMsg() + " Found "
+            + columnName + " of type: " + fieldSchema.getType());
+      }

Review Comment:
   can we instead of catching `Exception` and throwing do
   ```
   TypeInfo typeInfo = 
TypeInfoUtils.getTypeInfoFromTypeString(fieldSchema.getType());
         if (typeInfo.getCategory() != ObjectInspector.Category.PRIMITIVE) {
           throw new 
SemanticException(ErrorMsg.PARTITION_COLUMN_NON_PRIMITIVE.getMsg() + " Found "
               + columnName + " of type: " + fieldSchema.getType());
         }
   ```



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