shameersss1 commented on code in PR #3811:
URL: https://github.com/apache/hive/pull/3811#discussion_r1051334654


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java:
##########
@@ -1248,30 +1253,43 @@ protected boolean shouldStop() {
     }
 
     private static enum FilterType {
-      Integral,
-      String,
-      Date,
-
-      Invalid;
-
-      static FilterType fromType(String colTypeStr) {
-        if (colTypeStr.equals(ColumnType.STRING_TYPE_NAME)) {
-          return FilterType.String;
-        } else if (colTypeStr.equals(ColumnType.DATE_TYPE_NAME)) {
-          return FilterType.Date;
-        } else if (ColumnType.IntegralTypes.contains(colTypeStr)) {
-          return FilterType.Integral;
+      Integral("tinyint,smallint,int,bigint", "java.lang.Long"),
+      String("string", "java.lang.String"),
+      Date("date", "java.sql.Date"),
+      Timestamp("timestamp", "java.sql.Timestamp"),
+
+      Invalid("Invalid", "null");
+
+      private final List<String> type;
+      private final String value;
+
+      FilterType(String type, String value) {
+        this.type = Arrays.asList(type.split(","));
+        this.value = value;
+      }
+
+      public List<String> getType() {
+        return type;
+      }
+
+      public Object getValue() {
+        return value;
+      }
+
+      public static FilterType fromType(String type) {
+        for (FilterType filterType : FilterType.values()) {
+          if (filterType.type.stream().anyMatch(val -> 
val.equalsIgnoreCase(type))) {
+            return filterType;
+          }
         }
         return FilterType.Invalid;
       }
 
-      public static FilterType fromClass(Object value) {
-        if (value instanceof String) {
-          return FilterType.String;
-        } else if (value instanceof Long) {
-          return FilterType.Integral;
-        } else if (value instanceof java.sql.Date) {
-          return FilterType.Date;
+      public static FilterType fromClass(Object value){
+        for (FilterType filterType : FilterType.values()) {
+          if 
(filterType.value.equalsIgnoreCase(value.getClass().getCanonicalName())) {

Review Comment:
   ack



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