dengzhhu653 commented on code in PR #6577:
URL: https://github.com/apache/hive/pull/6577#discussion_r3540295984
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/directsql/MetaStoreDirectSql.java:
##########
@@ -534,6 +537,151 @@ public void addPartitions(List<MPartition> parts,
List<List<MPartitionPrivilege>
directSqlInsertPart.addPartitions(parts, partPrivilegesList,
partColPrivilegesList);
}
+ /**
+ * Gets a suitable column descriptor for an existing table, based on the
latest partitions
+ *
+ * @param cols column list of a partition
+ * @param tblId table id
+ * @return an existing column descriptor which columns matches with @cols.
Null if there is no match.
+ * @throws MetaException
+ */
+ public MColumnDescriptor getColumnDescriptor(List<FieldSchema> cols, long
tblId)
+ throws MetaException {
+
+ if (cols == null || cols.isEmpty()) {
+ return null;
+ }
+
+ // Please note! In case you modify any of those methods, run
TestHMSColumnDescriptorReuse with all the supported databases
+ List<Long> cdCandidates = findTheLatestColumnDescriptors(tblId);
+
+ cdCandidates = filterCandidatesByColumnCount(cdCandidates, cols.size());
Review Comment:
return early if `cdCandidates` is null
--
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]