diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java index 82e877219ed0..5190f40d46da 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFAddMonths.java @@ -53,9 +53,9 @@ + "Returns the date that is num_months after start_date.", extended = "start_date is a string or timestamp indicating a valid date. " + "num_months is a number. output_date_format is an optional String which specifies the format for output.\n" - + "The default output format is 'YYYY-MM-dd'.\n" + + "The default output format is 'yyyy-MM-dd'.\n" + "Example:\n > SELECT _FUNC_('2009-08-31', 1) FROM src LIMIT 1;\n" + " '2009-09-30'." - + "\n > SELECT _FUNC_('2017-12-31 14:15:16', 2, 'YYYY-MM-dd HH:mm:ss') LIMIT 1;\n" + + "\n > SELECT _FUNC_('2017-12-31 14:15:16', 2, 'yyyy-MM-dd HH:mm:ss') LIMIT 1;\n" + "'2018-02-28 14:15:16'.\n") @NDV(maxNdv = 250) // 250 seems to be reasonable upper limit for this public class GenericUDFAddMonths extends GenericUDF { diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFAddMonths.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFAddMonths.java index be8b9d14a0f4..e0ad69428c29 100644 --- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFAddMonths.java +++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFAddMonths.java @@ -43,10 +43,10 @@ */ public class TestGenericUDFAddMonths { - private final Text fmtTextWithTime = new Text("YYYY-MM-dd HH:mm:ss"); - private final Text fmtTextWithTimeAndms = new Text("YYYY-MM-dd HH:mm:ss.SSS"); - private final Text fmtTextWithoutTime = new Text("YYYY-MM-dd"); - private final Text fmtTextInvalid = new Text("YYYY-abcdz"); + private final Text fmtTextWithTime = new Text("yyyy-MM-dd HH:mm:ss"); + private final Text fmtTextWithTimeAndms = new Text("yyyy-MM-dd HH:mm:ss.SSS"); + private final Text fmtTextWithoutTime = new Text("yyyy-MM-dd"); + private final Text fmtTextInvalid = new Text("yyyy-abcdz"); @Test public void testAddMonthsInt() throws HiveException { diff --git a/ql/src/test/results/clientpositive/llap/udf_add_months.q.out b/ql/src/test/results/clientpositive/llap/udf_add_months.q.out index 61f9e07fad02..919d8039252d 100644 --- a/ql/src/test/results/clientpositive/llap/udf_add_months.q.out +++ b/ql/src/test/results/clientpositive/llap/udf_add_months.q.out @@ -9,11 +9,11 @@ POSTHOOK: query: DESCRIBE FUNCTION EXTENDED add_months POSTHOOK: type: DESCFUNCTION add_months(start_date, num_months, output_date_format) - Returns the date that is num_months after start_date. start_date is a string or timestamp indicating a valid date. num_months is a number. output_date_format is an optional String which specifies the format for output. -The default output format is 'YYYY-MM-dd'. +The default output format is 'yyyy-MM-dd'. Example: > SELECT add_months('2009-08-31', 1) FROM src LIMIT 1; '2009-09-30'. - > SELECT add_months('2017-12-31 14:15:16', 2, 'YYYY-MM-dd HH:mm:ss') LIMIT 1; + > SELECT add_months('2017-12-31 14:15:16', 2, 'yyyy-MM-dd HH:mm:ss') LIMIT 1; '2018-02-28 14:15:16'. Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFAddMonths