You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by go...@apache.org on 2019/08/02 06:24:51 UTC
[hive] branch master updated: HIVE-22008: LIKE Operator should
match multi-line input (Gopal V, reviewed by Jesus Camacho Rodriguez)
This is an automated email from the ASF dual-hosted git repository.
gopalv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new d7475aa HIVE-22008: LIKE Operator should match multi-line input (Gopal V, reviewed by Jesus Camacho Rodriguez)
d7475aa is described below
commit d7475aa98f6a2fc813e2e1c0ad99f902cb28cc00
Author: Gopal V <go...@apache.org>
AuthorDate: Thu Aug 1 23:24:25 2019 -0700
HIVE-22008: LIKE Operator should match multi-line input (Gopal V, reviewed by Jesus Camacho Rodriguez)
Signed-off-by: Gopal V <go...@apache.org>
---
.../org/apache/hadoop/hive/ql/udf/UDFLike.java | 2 +-
ql/src/test/queries/clientpositive/udf_like.q | 5 +++++
ql/src/test/results/clientpositive/udf_like.q.out | 26 ++++++++++++++++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java
index 793e8a7..4889b2e 100755
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLike.java
@@ -184,7 +184,7 @@ public class UDFLike extends UDF {
parseSimplePattern(strLikePattern);
if (type == PatternType.COMPLEX) {
- p = Pattern.compile(likePatternToRegExp(strLikePattern));
+ p = Pattern.compile(likePatternToRegExp(strLikePattern), Pattern.DOTALL);
}
}
diff --git a/ql/src/test/queries/clientpositive/udf_like.q b/ql/src/test/queries/clientpositive/udf_like.q
index d7728e7..a4a7251 100644
--- a/ql/src/test/queries/clientpositive/udf_like.q
+++ b/ql/src/test/queries/clientpositive/udf_like.q
@@ -23,3 +23,8 @@ SELECT '1+2' LIKE '_+_',
'|||' LIKE '|_|',
'+++' LIKE '1+_'
FROM src tablesample (1 rows);
+
+
+CREATE TEMPORARY TABLE SplitLines(`id` string) STORED AS ORC;
+INSERT INTO SplitLines SELECT 'withdraw\ncash';
+SELECT `id` LIKE '%withdraw%cash' FROM SplitLines ;
diff --git a/ql/src/test/results/clientpositive/udf_like.q.out b/ql/src/test/results/clientpositive/udf_like.q.out
index 3a131ac..8a0bb98 100644
--- a/ql/src/test/results/clientpositive/udf_like.q.out
+++ b/ql/src/test/results/clientpositive/udf_like.q.out
@@ -84,3 +84,29 @@ POSTHOOK: type: QUERY
POSTHOOK: Input: default@src
#### A masked pattern was here ####
true true false true false
+PREHOOK: query: CREATE TEMPORARY TABLE SplitLines(`id` string) STORED AS ORC
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@SplitLines
+POSTHOOK: query: CREATE TEMPORARY TABLE SplitLines(`id` string) STORED AS ORC
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@SplitLines
+PREHOOK: query: INSERT INTO SplitLines SELECT 'withdraw\ncash'
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@splitlines
+POSTHOOK: query: INSERT INTO SplitLines SELECT 'withdraw\ncash'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@splitlines
+POSTHOOK: Lineage: splitlines.id SIMPLE []
+PREHOOK: query: SELECT `id` LIKE '%withdraw%cash' FROM SplitLines
+PREHOOK: type: QUERY
+PREHOOK: Input: default@splitlines
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT `id` LIKE '%withdraw%cash' FROM SplitLines
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@splitlines
+#### A masked pattern was here ####
+true