okumin commented on code in PR #4936:
URL: https://github.com/apache/hive/pull/4936#discussion_r1425406965


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDF.java:
##########
@@ -351,8 +352,12 @@ protected void obtainIntConverter(ObjectInspector[] 
arguments, int i,
     case INT:
     case VOID:
       break;
+    case DECIMAL:
+      if (inOi.scale() == 0) {
+        break;
+      }

Review Comment:
   I think `precision` should also be small enough to ensure type safety. If we 
accept any DECIMAL, we should semantically accept LONG just in my opinion.



##########
ql/src/test/queries/clientpositive/udf_add_months.q:
##########
@@ -40,3 +40,15 @@ add_months(cast('2016-01-29 10:30:00' as timestamp), 1),
 add_months(cast('2016-02-29 10:30:00' as timestamp), -1),
 add_months(cast('2016-02-29 10:30:12' as timestamp), 2, 'YYYY-MM-dd HH:mm:ss'),
 add_months(cast(null as timestamp), 1);
+
+select
+add_months('2014-01-14 10:30:00', 1.0),

Review Comment:
   I'm just curious when we want to give a floating point to `ADD_MONTHS`.



##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDF.java:
##########
@@ -607,6 +612,8 @@ protected Integer getConstantIntValue(ObjectInspector[] 
arguments, int i)
       v = ((ShortWritable) constValue).get();
     } else if (constValue instanceof ByteWritable) {
       v = ((ByteWritable) constValue).get();
+    } else if (constValue instanceof HiveDecimalWritable) {
+      v = ((HiveDecimalWritable) constValue).intValue();
     } else {
       throw new UDFArgumentTypeException(i, getFuncName() + " only takes 
INT/SHORT/BYTE types as "

Review Comment:
   It would be more consistent if we updated this message



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