deniskuzZ commented on code in PR #5977: URL: https://github.com/apache/hive/pull/5977#discussion_r2212631650
########## ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/PartitionUtils.java: ########## @@ -62,24 +62,33 @@ private PartitionUtils() { * simpler. Should be okay since the reserved names are fairly long and uncommon. */ public static void validatePartitions(HiveConf conf, Map<String, String> partitionSpec) throws SemanticException { - Set<String> reservedPartitionValues = new HashSet<>(); // Partition can't have this name - reservedPartitionValues.add(HiveConf.getVar(conf, ConfVars.DEFAULT_PARTITION_NAME)); - reservedPartitionValues.add(HiveConf.getVar(conf, ConfVars.DEFAULT_ZOOKEEPER_PARTITION_NAME)); + Set<String> reservedPartitionValues = + new HashSet<String>() {{ + add(HiveConf.getVar(conf, ConfVars.DEFAULT_PARTITION_NAME)); + add(HiveConf.getVar(conf, ConfVars.DEFAULT_ZOOKEEPER_PARTITION_NAME)); + }}; + // Partition value can't end in this suffix - reservedPartitionValues.add(HiveConf.getVar(conf, ConfVars.METASTORE_INT_ORIGINAL)); - reservedPartitionValues.add(HiveConf.getVar(conf, ConfVars.METASTORE_INT_ARCHIVED)); - reservedPartitionValues.add(HiveConf.getVar(conf, ConfVars.METASTORE_INT_EXTRACTED)); - - for (Entry<String, String> e : partitionSpec.entrySet()) { - for (String s : reservedPartitionValues) { - String value = e.getValue(); - if (value != null && value.contains(s)) { - throw new SemanticException(ErrorMsg.RESERVED_PART_VAL.getMsg( - "(User value: " + e.getValue() + " Reserved substring: " + s + ")")); - } + Set<String> reservedPartitionSuffixes = + new HashSet<String>() {{ + add(HiveConf.getVar(conf, ConfVars.METASTORE_INT_ORIGINAL)); + add(HiveConf.getVar(conf, ConfVars.METASTORE_INT_ARCHIVED)); + add(HiveConf.getVar(conf, ConfVars.METASTORE_INT_EXTRACTED)); + }}; + + partitionSpec.forEach((key, value) -> { + if (value != null && reservedPartitionValues.contains(value)) { Review Comment: @vikramahuja1001, please check the above comment. Current logic should be broken, but looks like test don't cover all cases. -- 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