deniskuzZ commented on code in PR #5591:
URL: https://github.com/apache/hive/pull/5591#discussion_r2082319531


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java:
##########
@@ -1598,39 +1599,62 @@ public static Partition getPartition(IMetaStoreClient 
msc, Table tbl, Map<String
    * @return Partition name, for example partitiondate=2008-01-01
    */
   public static String getPartitionName(Path tablePath, Path partitionPath, 
Set<String> partCols,
-                                        Map<String, String> 
partitionColToTypeMap) {
+                                        Map<String, String> 
partitionColToTypeMap, String customPattern) throws MetastoreException {
     String result = null;
     Path currPath = partitionPath;
     LOG.debug("tablePath:" + tablePath + ", partCols: " + partCols);
+    if (customPattern != null) {
+      DynamicPartitioningCustomPattern compiledCustomPattern = new 
DynamicPartitioningCustomPattern.Builder()
+              .setCustomPattern(customPattern)
+              .build();
+      Pattern customPathPattern = 
compiledCustomPattern.getPartitionCapturePattern();
+      List<String> patternPartCols = 
compiledCustomPattern.getPartitionColumns(); //partition columns in order that 
they appear in the pattern
+      String relPath = 
partitionPath.toString().substring(tablePath.toString().length() + 1); //start 
after tablepath and the / afterwards
+      Matcher pathMatcher = customPathPattern.matcher(relPath);
+      boolean didMatch = pathMatcher.matches();

Review Comment:
   please remove local var and inline



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to