difin commented on code in PR #6258:
URL: https://github.com/apache/hive/pull/6258#discussion_r2715077723


##########
serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java:
##########
@@ -498,6 +499,24 @@ private TypeInfo parseType() {
           }
           return TypeInfoFactory.getDecimalTypeInfo(precision, scale);
 
+          case TIMESTAMP:
+            int prec = 6;
+            if (params != null && params.length == 1) {
+              prec = Integer.parseInt(params[0]);
+            } else if (params != null && params.length > 1) {
+              throw new IllegalArgumentException(
+                  "Timestamp takes only one parameter, but " + params.length + 
" is seen");
+            }
+            return TypeInfoFactory.getTimestampTypeInfo(prec);
+          case TIMESTAMPLOCALTZ:
+            int precTimeZone = 6;
+            if (params != null && params.length == 1) {
+              precTimeZone = Integer.parseInt(params[0]);
+            } else if (params != null && params.length > 1) {
+              throw new IllegalArgumentException(
+                  "Timestamp takes only one parameter, but " + params.length + 
" is seen");
+            }

Review Comment:
   These lines are duplicated in 2 places in this block of code, should they be 
extracted into a helper method?
   
   ```
   if (params != null && params.length > 1) {
     throw new IllegalArgumentException(
         "Timestamp takes only one parameter, but " + params.length + " is 
seen");
   }
   ```



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