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


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java:
##########
@@ -1636,27 +1638,77 @@ public static String getPartitionName(Path tablePath, 
Path partitionPath, Set<St
     return result;
   }
 
-  public static String getNormalisedPartitionValue(String partitionValue, 
String type) {
-
-    if (!NumberUtils.isParsable(partitionValue)) {
+  public enum PartitionDataType {
+    TINYINT,
+    SMALLINT,
+    INT,
+    BIGINT,
+    FLOAT,
+    DOUBLE,
+    DECIMAL,
+    STRING,
+    UNKNOWN;
+
+    public static PartitionDataType fromTypeString(String type) {
+      if (type == null || type.isEmpty()){
+        return UNKNOWN;
+      }
+      String base = type.toLowerCase();
+      if (base.startsWith("decimal")){
+        return DECIMAL;
+      }
+      return switch (base) {
+        case "tinyint" -> TINYINT;

Review Comment:
   can you simple use `base.toUpperCase`



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java:
##########
@@ -1636,27 +1638,77 @@ public static String getPartitionName(Path tablePath, 
Path partitionPath, Set<St
     return result;
   }
 
-  public static String getNormalisedPartitionValue(String partitionValue, 
String type) {
-
-    if (!NumberUtils.isParsable(partitionValue)) {
+  public enum PartitionDataType {
+    TINYINT,
+    SMALLINT,
+    INT,
+    BIGINT,
+    FLOAT,
+    DOUBLE,
+    DECIMAL,
+    STRING,
+    UNKNOWN;
+
+    public static PartitionDataType fromTypeString(String type) {
+      if (type == null || type.isEmpty()){
+        return UNKNOWN;
+      }
+      String base = type.toLowerCase();
+      if (base.startsWith("decimal")){
+        return DECIMAL;
+      }
+      return switch (base) {
+        case "tinyint" -> TINYINT;

Review Comment:
   can you simply use `base.toUpperCase`



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