hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1166941 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/udf/UDFLike.java test/queries/clientpositive/udf_like.q test/results/clientpositive/udf_like.q.out
Date Thu, 08 Sep 2011 23:37:17 GMT
Author: jvs
Date: Thu Sep  8 23:37:16 2011
New Revision: 1166941

URL: http://svn.apache.org/viewvc?rev=1166941&view=rev
Log:
HIVE-2402. Function like with empty string is throwing null pointer exception
(Chinna Rao Lalam via jvs)


Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java
    hive/trunk/ql/src/test/queries/clientpositive/udf_like.q
    hive/trunk/ql/src/test/results/clientpositive/udf_like.q.out

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java?rev=1166941&r1=1166940&r2=1166941&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java Thu Sep  8 23:37:16
2011
@@ -49,7 +49,7 @@ public class UDFLike extends UDF {
     COMPLEX, // all other cases, such as "ab%c_de"
   }
 
-  private PatternType type = PatternType.COMPLEX;
+  private PatternType type = PatternType.NONE;
   private final Text simplePattern = new Text();
 
   private final BooleanWritable result = new BooleanWritable();

Modified: hive/trunk/ql/src/test/queries/clientpositive/udf_like.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/udf_like.q?rev=1166941&r1=1166940&r2=1166941&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/udf_like.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/udf_like.q Thu Sep  8 23:37:16 2011
@@ -4,10 +4,10 @@ DESCRIBE FUNCTION EXTENDED like;
 EXPLAIN
 SELECT '_%_' LIKE '%\_\%\_%', '__' LIKE '%\_\%\_%', '%%_%_' LIKE '%\_\%\_%', '%_%_%' LIKE
'%\%\_\%',
   '_%_' LIKE '\%\_%', '%__' LIKE '__\%%', '_%' LIKE '\_\%\_\%%', '_%' LIKE '\_\%_%',
-  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a'
+  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a','ab' LIKE '','' LIKE
''
 FROM src WHERE src.key = 86;
 
 SELECT '_%_' LIKE '%\_\%\_%', '__' LIKE '%\_\%\_%', '%%_%_' LIKE '%\_\%\_%', '%_%_%' LIKE
'%\%\_\%',
   '_%_' LIKE '\%\_%', '%__' LIKE '__\%%', '_%' LIKE '\_\%\_\%%', '_%' LIKE '\_\%_%',
-  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a'
+  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a','ab' LIKE '','' LIKE
''
 FROM src WHERE src.key = 86;

Modified: hive/trunk/ql/src/test/results/clientpositive/udf_like.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/udf_like.q.out?rev=1166941&r1=1166940&r2=1166941&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/udf_like.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/udf_like.q.out Thu Sep  8 23:37:16 2011
@@ -14,17 +14,17 @@ Example:
 PREHOOK: query: EXPLAIN
 SELECT '_%_' LIKE '%\_\%\_%', '__' LIKE '%\_\%\_%', '%%_%_' LIKE '%\_\%\_%', '%_%_%' LIKE
'%\%\_\%',
   '_%_' LIKE '\%\_%', '%__' LIKE '__\%%', '_%' LIKE '\_\%\_\%%', '_%' LIKE '\_\%_%',
-  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a'
+  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a','ab' LIKE '','' LIKE
''
 FROM src WHERE src.key = 86
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN
 SELECT '_%_' LIKE '%\_\%\_%', '__' LIKE '%\_\%\_%', '%%_%_' LIKE '%\_\%\_%', '%_%_%' LIKE
'%\%\_\%',
   '_%_' LIKE '\%\_%', '%__' LIKE '__\%%', '_%' LIKE '\_\%\_\%%', '_%' LIKE '\_\%_%',
-  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a'
+  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a','ab' LIKE '','' LIKE
''
 FROM src WHERE src.key = 86
 POSTHOOK: type: QUERY
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR
TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (LIKE '_%_' '%\_\%\_%')) (TOK_SELEXPR (LIKE '__' '%\_\%\_%'))
(TOK_SELEXPR (LIKE '%%_%_' '%\_\%\_%')) (TOK_SELEXPR (LIKE '%_%_%' '%\%\_\%')) (TOK_SELEXPR
(LIKE '_%_' '\%\_%')) (TOK_SELEXPR (LIKE '%__' '__\%%')) (TOK_SELEXPR (LIKE '_%' '\_\%\_\%%'))
(TOK_SELEXPR (LIKE '_%' '\_\%_%')) (TOK_SELEXPR (LIKE '%_' '\%\_')) (TOK_SELEXPR (LIKE 'ab'
'\%\_')) (TOK_SELEXPR (LIKE 'ab' '_a%')) (TOK_SELEXPR (LIKE 'ab' 'a'))) (TOK_WHERE (= (. (TOK_TABLE_OR_COL
src) key) 86))))
+  (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR
TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (LIKE '_%_' '%\_\%\_%')) (TOK_SELEXPR (LIKE '__' '%\_\%\_%'))
(TOK_SELEXPR (LIKE '%%_%_' '%\_\%\_%')) (TOK_SELEXPR (LIKE '%_%_%' '%\%\_\%')) (TOK_SELEXPR
(LIKE '_%_' '\%\_%')) (TOK_SELEXPR (LIKE '%__' '__\%%')) (TOK_SELEXPR (LIKE '_%' '\_\%\_\%%'))
(TOK_SELEXPR (LIKE '_%' '\_\%_%')) (TOK_SELEXPR (LIKE '%_' '\%\_')) (TOK_SELEXPR (LIKE 'ab'
'\%\_')) (TOK_SELEXPR (LIKE 'ab' '_a%')) (TOK_SELEXPR (LIKE 'ab' 'a')) (TOK_SELEXPR (LIKE
'ab' '')) (TOK_SELEXPR (LIKE '' ''))) (TOK_WHERE (= (. (TOK_TABLE_OR_COL src) key) 86))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -67,7 +67,11 @@ STAGE PLANS:
                       type: boolean
                       expr: ('ab' like 'a')
                       type: boolean
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7,
_col8, _col9, _col10, _col11
+                      expr: ('ab' like '')
+                      type: boolean
+                      expr: ('' like '')
+                      type: boolean
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7,
_col8, _col9, _col10, _col11, _col12, _col13
                 File Output Operator
                   compressed: false
                   GlobalTableId: 0
@@ -82,16 +86,16 @@ STAGE PLANS:
 
 PREHOOK: query: SELECT '_%_' LIKE '%\_\%\_%', '__' LIKE '%\_\%\_%', '%%_%_' LIKE '%\_\%\_%',
'%_%_%' LIKE '%\%\_\%',
   '_%_' LIKE '\%\_%', '%__' LIKE '__\%%', '_%' LIKE '\_\%\_\%%', '_%' LIKE '\_\%_%',
-  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a'
+  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a','ab' LIKE '','' LIKE
''
 FROM src WHERE src.key = 86
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
-PREHOOK: Output: file:/tmp/sdong/hive_2011-02-10_17-36-27_972_7663123608612028482/-mr-10000
+PREHOOK: Output: file:/tmp/root/hive_2011-09-08_09-43-08_304_8824037322418226774/-mr-10000
 POSTHOOK: query: SELECT '_%_' LIKE '%\_\%\_%', '__' LIKE '%\_\%\_%', '%%_%_' LIKE '%\_\%\_%',
'%_%_%' LIKE '%\%\_\%',
   '_%_' LIKE '\%\_%', '%__' LIKE '__\%%', '_%' LIKE '\_\%\_\%%', '_%' LIKE '\_\%_%',
-  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a'
+  '%_' LIKE '\%\_', 'ab' LIKE '\%\_', 'ab' LIKE '_a%', 'ab' LIKE 'a','ab' LIKE '','' LIKE
''
 FROM src WHERE src.key = 86
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
-POSTHOOK: Output: file:/tmp/sdong/hive_2011-02-10_17-36-27_972_7663123608612028482/-mr-10000
-true	false	true	true	false	false	false	false	true	false	false	false
+POSTHOOK: Output: file:/tmp/root/hive_2011-09-08_09-43-08_304_8824037322418226774/-mr-10000
+true	false	true	true	false	false	false	false	true	false	false	false	false	true



Mime
View raw message