phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-12 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 f0d3809d2 -> 2b36fa2d7


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2b36fa2d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2b36fa2d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2b36fa2d

Branch: refs/heads/4.x-HBase-0.98
Commit: 2b36fa2d7a5bb4b2d27ca704728aadf720e25afe
Parents: f0d3809
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 12 11:49:58 2018 -0700

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  |  7 +++-
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 40 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2b36fa2d/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public 

phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-05 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 81784909f -> 6e7b7d4ca


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6e7b7d4c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6e7b7d4c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6e7b7d4c

Branch: refs/heads/5.x-HBase-2.0
Commit: 6e7b7d4ca7fe0cf7b8e6213a2644758c0096be2e
Parents: 8178490
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 5 13:50:35 2018 -0800

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  | 10 ++
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 44 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e7b7d4c/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public 

phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-05 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 c1fcc92ce -> b8a3ef3cc


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: b8a3ef3ccfe280ff2a5a3aae982feece18fd55a5
Parents: c1fcc92
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 5 13:49:07 2018 -0800

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  | 10 ++
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 44 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b8a3ef3c/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public 

phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-05 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 d14233ccd -> 1459cbce5


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1459cbce
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1459cbce
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1459cbce

Branch: refs/heads/4.x-cdh5.11.2
Commit: 1459cbce5bd26add34bed9f7bc583d395b9790d3
Parents: d14233c
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 5 13:47:50 2018 -0800

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  | 10 ++
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 44 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1459cbce/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public 

phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-05 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 8f19583c5 -> e06882c20


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


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

Branch: refs/heads/4.x-HBase-1.2
Commit: e06882c2087ee1c822098e2d933a430e1d4e9310
Parents: 8f19583
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 5 13:46:26 2018 -0800

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  | 10 ++
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 44 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e06882c2/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public 

phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-05 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 26f06354a -> bad0381df


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


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

Branch: refs/heads/4.x-HBase-1.3
Commit: bad0381df675d7b10de200671c8738b8572ebf2f
Parents: 26f0635
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 5 13:44:52 2018 -0800

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  | 10 ++
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 44 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bad0381d/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public 

phoenix git commit: PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)

2018-03-05 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 2b7861536 -> 916186e97


PHOENIX-4624 COLLATION_KEY function cannot handle null values (Shehzaad Nakhoda)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/916186e9
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/916186e9
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/916186e9

Branch: refs/heads/master
Commit: 916186e974da77e4b58ca9392c3052957b8eecba
Parents: 2b78615
Author: James Taylor 
Authored: Mon Mar 5 13:44:09 2018 -0800
Committer: James Taylor 
Committed: Mon Mar 5 13:44:09 2018 -0800

--
 .../phoenix/end2end/CollationKeyFunctionIT.java | 37 ++--
 .../function/CollationKeyFunction.java  | 10 ++
 .../function/CollationKeyFunctionTest.java  |  7 
 3 files changed, 44 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/916186e9/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
index efbab64..9f9e4d1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CollationKeyFunctionIT.java
@@ -41,7 +41,10 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
// (0-6) chinese characters
"\u963f", "\u55c4", "\u963e", "\u554a", "\u4ec8", 
"\u3d9a", "\u9f51",
// (7-13) western characters, some with accent
-   "a", "b", "ä", "A", "a", "ä", "A" };
+   "a", "b", "ä", "A", "a", "ä", "A",
+   // null for null-input tests 
+   null
+   };
 
@Before
public void initAndPopulateTable() throws Exception {
@@ -69,27 +72,27 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
 
@Test
public void testZhSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", 0, 6, new 
Integer[] { 3, 0, 1, 6, 5, 4, 2 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh", false, 0, 6, 
new Integer[] { 3, 0, 1, 6, 5, 4, 2 });
}
 
@Test
public void testZhTwSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", 0, 6, new 
Integer[] { 0, 3, 4, 1, 5, 2, 6 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW", false, 0, 
6, new Integer[] { 0, 3, 4, 1, 5, 2, 6 });
}
 
@Test
public void testZhTwStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 0, 
6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh_TW_STROKE", 
false, 0, 6, new Integer[] { 4, 2, 0, 3, 1, 6, 5 });
}
 
@Test
public void testZhStrokeSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__STROKE", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
public void testZhPinyinSort() throws Exception {
-   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 0, 
6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
+   queryWithCollKeyDefaultArgsWithExpectedOrder("zh__PINYIN", 
false, 0, 6, new Integer[] { 0, 1, 3, 4, 6, 2, 5 });
}
 
@Test
@@ -120,6 +123,18 @@ public class CollationKeyFunctionIT extends 
ParallelStatsDisabledIT {
queryWithCollKeyWithStrengthWithExpectedOrder("en", 
Collator.TERTIARY, true, 7, 13,
new Integer[] { 8, 12, 9, 13, 10, 11, 7 });
}
+   
+   // Null before anything else when doing ascending sort
+   @Test
+   public void testSortWithNullInputAsc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", false, 13, 
14, new Integer[] {14, 13});
+   }
+   
+   // Null before anything else when doing descending sort (same behavior 
when doing order by without collation_key)
+   @Test
+   public void testSortWithNullInputDesc() throws Exception {
+   queryWithCollKeyDefaultArgsWithExpectedOrder("en", true, 13, 
14, new Integer[] {14, 13});
+   }
 

/**
@@ -132,14 +147,16 @@ public class