[36/50] [abbrv] hive git commit: HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by Hari Subramaniyan)

2015-09-09 Thread xuf
HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by 
Hari Subramaniyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/492c8b1d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/492c8b1d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/492c8b1d

Branch: refs/heads/beeline-cli
Commit: 492c8b1d88ffcb68ba4f77a3a49ae8fc768cdd7c
Parents: 1fc9320
Author: Hari Subramaniyan 
Authored: Wed Sep 2 15:54:23 2015 -0700
Committer: Hari Subramaniyan 
Committed: Wed Sep 2 15:54:23 2015 -0700

--
 .../apache/hadoop/hive/ql/lib/RuleRegExp.java   | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/492c8b1d/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java 
b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
index c88ed68..fd5f133 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
@@ -125,13 +125,13 @@ public class RuleRegExp implements Rule {
*/
   private int costPatternWithoutWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
-String name = new String("");
 int patLen = patternWithoutWildCardChar.length();
-
+StringBuilder name = new StringBuilder(patLen + numElems);
 for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   if (name.length() >= patLen) {
-if (patternWithoutWildCardChar.equals(name)) {
+if (patternWithoutWildCardChar.contentEquals(name)) {
   return patLen;
 } else {
   return -1;
@@ -153,13 +153,14 @@ public class RuleRegExp implements Rule {
   private int costPatternWithORWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
 for (String pattern : patternORWildChar) {
-  String name = new String("");
   int patLen = pattern.length();
 
+  StringBuilder name = new StringBuilder(patLen + numElems);
   for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+String nodeName = stack.get(pos).getName() + "%";
+name.insert(0, nodeName);
 if (name.length() >= patLen) {
-  if (pattern.equals(name)) {
+  if (pattern.contentEquals(name)) {
 return patLen;
   } else {
 break;
@@ -181,11 +182,12 @@ public class RuleRegExp implements Rule {
* @throws SemanticException
*/
   private int costPatternWithWildCardChar(Stack stack) throws 
SemanticException {
-   int numElems = (stack != null ? stack.size() : 0);
-String name = "";
+int numElems = (stack != null ? stack.size() : 0);
+StringBuilder name = new StringBuilder();
 Matcher m = patternWithWildCardChar.matcher("");
 for (int pos = numElems - 1; pos >= 0; pos--) {
-  name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   m.reset(name);
   if (m.matches()) {
 return name.length();



[24/28] hive git commit: HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by Hari Subramaniyan)

2015-09-03 Thread sershe
HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by 
Hari Subramaniyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/492c8b1d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/492c8b1d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/492c8b1d

Branch: refs/heads/llap
Commit: 492c8b1d88ffcb68ba4f77a3a49ae8fc768cdd7c
Parents: 1fc9320
Author: Hari Subramaniyan 
Authored: Wed Sep 2 15:54:23 2015 -0700
Committer: Hari Subramaniyan 
Committed: Wed Sep 2 15:54:23 2015 -0700

--
 .../apache/hadoop/hive/ql/lib/RuleRegExp.java   | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/492c8b1d/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java 
b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
index c88ed68..fd5f133 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
@@ -125,13 +125,13 @@ public class RuleRegExp implements Rule {
*/
   private int costPatternWithoutWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
-String name = new String("");
 int patLen = patternWithoutWildCardChar.length();
-
+StringBuilder name = new StringBuilder(patLen + numElems);
 for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   if (name.length() >= patLen) {
-if (patternWithoutWildCardChar.equals(name)) {
+if (patternWithoutWildCardChar.contentEquals(name)) {
   return patLen;
 } else {
   return -1;
@@ -153,13 +153,14 @@ public class RuleRegExp implements Rule {
   private int costPatternWithORWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
 for (String pattern : patternORWildChar) {
-  String name = new String("");
   int patLen = pattern.length();
 
+  StringBuilder name = new StringBuilder(patLen + numElems);
   for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+String nodeName = stack.get(pos).getName() + "%";
+name.insert(0, nodeName);
 if (name.length() >= patLen) {
-  if (pattern.equals(name)) {
+  if (pattern.contentEquals(name)) {
 return patLen;
   } else {
 break;
@@ -181,11 +182,12 @@ public class RuleRegExp implements Rule {
* @throws SemanticException
*/
   private int costPatternWithWildCardChar(Stack stack) throws 
SemanticException {
-   int numElems = (stack != null ? stack.size() : 0);
-String name = "";
+int numElems = (stack != null ? stack.size() : 0);
+StringBuilder name = new StringBuilder();
 Matcher m = patternWithWildCardChar.matcher("");
 for (int pos = numElems - 1; pos >= 0; pos--) {
-  name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   m.reset(name);
   if (m.matches()) {
 return name.length();



hive git commit: HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by Hari Subramaniyan)

2015-09-02 Thread harisankar
Repository: hive
Updated Branches:
  refs/heads/branch-1 edbbb8bb4 -> 1666aeb84


HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by 
Hari Subramaniyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1666aeb8
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1666aeb8
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1666aeb8

Branch: refs/heads/branch-1
Commit: 1666aeb846178ce1c0fa4c33d06a395b4c8514ae
Parents: edbbb8b
Author: Hari Subramaniyan 
Authored: Wed Sep 2 15:54:23 2015 -0700
Committer: Hari Subramaniyan 
Committed: Wed Sep 2 15:55:47 2015 -0700

--
 .../apache/hadoop/hive/ql/lib/RuleRegExp.java   | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/1666aeb8/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java 
b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
index c88ed68..fd5f133 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
@@ -125,13 +125,13 @@ public class RuleRegExp implements Rule {
*/
   private int costPatternWithoutWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
-String name = new String("");
 int patLen = patternWithoutWildCardChar.length();
-
+StringBuilder name = new StringBuilder(patLen + numElems);
 for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   if (name.length() >= patLen) {
-if (patternWithoutWildCardChar.equals(name)) {
+if (patternWithoutWildCardChar.contentEquals(name)) {
   return patLen;
 } else {
   return -1;
@@ -153,13 +153,14 @@ public class RuleRegExp implements Rule {
   private int costPatternWithORWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
 for (String pattern : patternORWildChar) {
-  String name = new String("");
   int patLen = pattern.length();
 
+  StringBuilder name = new StringBuilder(patLen + numElems);
   for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+String nodeName = stack.get(pos).getName() + "%";
+name.insert(0, nodeName);
 if (name.length() >= patLen) {
-  if (pattern.equals(name)) {
+  if (pattern.contentEquals(name)) {
 return patLen;
   } else {
 break;
@@ -181,11 +182,12 @@ public class RuleRegExp implements Rule {
* @throws SemanticException
*/
   private int costPatternWithWildCardChar(Stack stack) throws 
SemanticException {
-   int numElems = (stack != null ? stack.size() : 0);
-String name = "";
+int numElems = (stack != null ? stack.size() : 0);
+StringBuilder name = new StringBuilder();
 Matcher m = patternWithWildCardChar.matcher("");
 for (int pos = numElems - 1; pos >= 0; pos--) {
-  name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   m.reset(name);
   if (m.matches()) {
 return name.length();



hive git commit: HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by Hari Subramaniyan)

2015-09-02 Thread harisankar
Repository: hive
Updated Branches:
  refs/heads/master 1fc9320f0 -> 492c8b1d8


HIVE-11671 : Optimize RuleRegExp in DPP codepath (Rajesh Balamohan, reviewed by 
Hari Subramaniyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/492c8b1d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/492c8b1d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/492c8b1d

Branch: refs/heads/master
Commit: 492c8b1d88ffcb68ba4f77a3a49ae8fc768cdd7c
Parents: 1fc9320
Author: Hari Subramaniyan 
Authored: Wed Sep 2 15:54:23 2015 -0700
Committer: Hari Subramaniyan 
Committed: Wed Sep 2 15:54:23 2015 -0700

--
 .../apache/hadoop/hive/ql/lib/RuleRegExp.java   | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/492c8b1d/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java 
b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
index c88ed68..fd5f133 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java
@@ -125,13 +125,13 @@ public class RuleRegExp implements Rule {
*/
   private int costPatternWithoutWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
-String name = new String("");
 int patLen = patternWithoutWildCardChar.length();
-
+StringBuilder name = new StringBuilder(patLen + numElems);
 for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   if (name.length() >= patLen) {
-if (patternWithoutWildCardChar.equals(name)) {
+if (patternWithoutWildCardChar.contentEquals(name)) {
   return patLen;
 } else {
   return -1;
@@ -153,13 +153,14 @@ public class RuleRegExp implements Rule {
   private int costPatternWithORWildCardChar(Stack stack) throws 
SemanticException {
 int numElems = (stack != null ? stack.size() : 0);
 for (String pattern : patternORWildChar) {
-  String name = new String("");
   int patLen = pattern.length();
 
+  StringBuilder name = new StringBuilder(patLen + numElems);
   for (int pos = numElems - 1; pos >= 0; pos--) {
-name = stack.get(pos).getName() + "%" + name;
+String nodeName = stack.get(pos).getName() + "%";
+name.insert(0, nodeName);
 if (name.length() >= patLen) {
-  if (pattern.equals(name)) {
+  if (pattern.contentEquals(name)) {
 return patLen;
   } else {
 break;
@@ -181,11 +182,12 @@ public class RuleRegExp implements Rule {
* @throws SemanticException
*/
   private int costPatternWithWildCardChar(Stack stack) throws 
SemanticException {
-   int numElems = (stack != null ? stack.size() : 0);
-String name = "";
+int numElems = (stack != null ? stack.size() : 0);
+StringBuilder name = new StringBuilder();
 Matcher m = patternWithWildCardChar.matcher("");
 for (int pos = numElems - 1; pos >= 0; pos--) {
-  name = stack.get(pos).getName() + "%" + name;
+  String nodeName = stack.get(pos).getName() + "%";
+  name.insert(0, nodeName);
   m.reset(name);
   if (m.matches()) {
 return name.length();