hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r935811 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/udf/UDFFromUnixTime.java ql/src/test/queries/clientpositive/udf5.q ql/src/test/results/clientpositive/udf5.q.out
Date Tue, 20 Apr 2010 06:23:44 GMT
Author: namit
Date: Tue Apr 20 06:23:44 2010
New Revision: 935811

URL: http://svn.apache.org/viewvc?rev=935811&view=rev
Log:
HIVE-1260. from_unixtime should accept bigints
(Ning Zhang via namit)


Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFFromUnixTime.java
    hadoop/hive/trunk/ql/src/test/queries/clientpositive/udf5.q
    hadoop/hive/trunk/ql/src/test/results/clientpositive/udf5.q.out

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=935811&r1=935810&r2=935811&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Tue Apr 20 06:23:44 2010
@@ -378,6 +378,9 @@ Trunk -  Unreleased
     HIVE-1312. hive trunk does not compile with 0.17 any more
     (John Sichi via Ning Zhang)
 
+    HIVE-1260. from_unixtime should accept bigints
+    (Ning Zhang via namit)
+
 Release 0.5.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFFromUnixTime.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFFromUnixTime.java?rev=935811&r1=935810&r2=935811&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFFromUnixTime.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFFromUnixTime.java Tue Apr
20 06:23:44 2010
@@ -69,6 +69,21 @@ public class UDFFromUnixTime extends UDF
 
     return eval(unixtime.get(), format);
   }
+  
+  /**
+   * Convert UnixTime to a string format.
+   * 
+   * @param unixtime
+   *          The number of seconds from 1970-01-01 00:00:00
+   * @return a String in default format specified.
+   */
+  public Text evaluate(LongWritable unixtime) {
+    if (unixtime == null) {
+      return null;
+    }
+
+    return eval(unixtime.get(), defaultFormat);
+  }
 
   /**
    * Convert UnixTime to a string format.

Modified: hadoop/hive/trunk/ql/src/test/queries/clientpositive/udf5.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/udf5.q?rev=935811&r1=935810&r2=935811&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/udf5.q (original)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/udf5.q Tue Apr 20 06:23:44 2010
@@ -8,6 +8,6 @@ SELECT from_unixtime(1226446340), to_dat
 SELECT from_unixtime(1226446340), to_date(from_unixtime(1226446340)), day('2008-11-01'),
month('2008-11-01'), year('2008-11-01'), day('2008-11-01 15:32:20'), month('2008-11-01 15:32:20'),
year('2008-11-01 15:32:20') FROM dest1;
 
 EXPLAIN
-SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss') from dest1;
+SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss'), from_unixtime(unix_timestamp('2010-01-13 11:57:40')) from dest1;
 
-SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss') from dest1;
+SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss'), from_unixtime(unix_timestamp('2010-01-13 11:57:40')) from dest1;

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/udf5.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/udf5.q.out?rev=935811&r1=935810&r2=935811&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/udf5.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/udf5.q.out Tue Apr 20 06:23:44 2010
@@ -67,22 +67,22 @@ STAGE PLANS:
 PREHOOK: query: SELECT from_unixtime(1226446340), to_date(from_unixtime(1226446340)), day('2008-11-01'),
month('2008-11-01'), year('2008-11-01'), day('2008-11-01 15:32:20'), month('2008-11-01 15:32:20'),
year('2008-11-01 15:32:20') FROM dest1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@dest1
-PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_1/build/ql/scratchdir/hive_2010-04-05_18-31-58_898_5011020567611932458/10000
+PREHOOK: Output: file:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-04-19_17-39-03_099_6014269130198716651/10000
 POSTHOOK: query: SELECT from_unixtime(1226446340), to_date(from_unixtime(1226446340)), day('2008-11-01'),
month('2008-11-01'), year('2008-11-01'), day('2008-11-01 15:32:20'), month('2008-11-01 15:32:20'),
year('2008-11-01 15:32:20') FROM dest1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@dest1
-POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_1/build/ql/scratchdir/hive_2010-04-05_18-31-58_898_5011020567611932458/10000
+POSTHOOK: Output: file:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-04-19_17-39-03_099_6014269130198716651/10000
 POSTHOOK: Lineage: dest1.c1 SIMPLE []
 2008-11-11 15:32:20	2008-11-11	1	11	2008	1	11	2008
 PREHOOK: query: EXPLAIN
-SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss') from dest1
+SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss'), from_unixtime(unix_timestamp('2010-01-13 11:57:40')) from dest1
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN
-SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss') from dest1
+SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'), 'MM/dd/yy
HH:mm:ss'), from_unixtime(unix_timestamp('2010-01-13 11:57:40')) from dest1
 POSTHOOK: type: QUERY
 POSTHOOK: Lineage: dest1.c1 SIMPLE []
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_TABREF dest1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE))
(TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION from_unixtime (TOK_FUNCTION unix_timestamp '2010-01-13
11:57:40' 'yyyy-MM-dd HH:mm:ss') 'MM/dd/yy HH:mm:ss')))))
+  (TOK_QUERY (TOK_FROM (TOK_TABREF dest1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE))
(TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION from_unixtime (TOK_FUNCTION unix_timestamp '2010-01-13
11:57:40' 'yyyy-MM-dd HH:mm:ss') 'MM/dd/yy HH:mm:ss')) (TOK_SELEXPR (TOK_FUNCTION from_unixtime
(TOK_FUNCTION unix_timestamp '2010-01-13 11:57:40'))))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -99,7 +99,9 @@ STAGE PLANS:
               expressions:
                     expr: from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd
HH:mm:ss'), 'MM/dd/yy HH:mm:ss')
                     type: string
-              outputColumnNames: _col0
+                    expr: from_unixtime(unix_timestamp('2010-01-13 11:57:40'))
+                    type: string
+              outputColumnNames: _col0, _col1
               File Output Operator
                 compressed: false
                 GlobalTableId: 0
@@ -112,13 +114,13 @@ STAGE PLANS:
       limit: -1
 
 
-PREHOOK: query: SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'),
'MM/dd/yy HH:mm:ss') from dest1
+PREHOOK: query: SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'),
'MM/dd/yy HH:mm:ss'), from_unixtime(unix_timestamp('2010-01-13 11:57:40')) from dest1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@dest1
-PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_1/build/ql/scratchdir/hive_2010-04-05_18-32-02_458_5386918569512888341/10000
-POSTHOOK: query: SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'),
'MM/dd/yy HH:mm:ss') from dest1
+PREHOOK: Output: file:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-04-19_17-39-07_199_2154448099622014630/10000
+POSTHOOK: query: SELECT from_unixtime(unix_timestamp('2010-01-13 11:57:40', 'yyyy-MM-dd HH:mm:ss'),
'MM/dd/yy HH:mm:ss'), from_unixtime(unix_timestamp('2010-01-13 11:57:40')) from dest1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@dest1
-POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_1/build/ql/scratchdir/hive_2010-04-05_18-32-02_458_5386918569512888341/10000
+POSTHOOK: Output: file:/data/users/nzhang/work/784/apache-hive/build/ql/scratchdir/hive_2010-04-19_17-39-07_199_2154448099622014630/10000
 POSTHOOK: Lineage: dest1.c1 SIMPLE []
-01/13/10 11:57:40
+01/13/10 11:57:40	2010-01-13 11:57:40



Mime
View raw message