[24/50] [abbrv] phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ffc380aa Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ffc380aa Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ffc380aa Branch: refs/heads/4.14-HBase-1.3 Commit: ffc380aad453497020109b855b2668bb026fe5cf Parents: 81f8875 Author: James Taylor Authored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:36:41 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffc380aa/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffc380aa/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), true, false, null); queryPlanToBe = compiler.compile(); // This is
[09/50] [abbrv] phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9335972f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9335972f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9335972f Branch: refs/heads/4.x-HBase-1.4 Commit: 9335972fb1d231f9ff1cce8b55ca5753149cba2c Parents: 8d80d5a Author: James Taylor Authored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:39:35 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9335972f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/9335972f/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), true, false, null); queryPlanToBe = compiler.compile(); // This is
[09/24] phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ffc380aa Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ffc380aa Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ffc380aa Branch: refs/heads/omid2 Commit: ffc380aad453497020109b855b2668bb026fe5cf Parents: 81f8875 Author: James Taylor Authored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:36:41 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffc380aa/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffc380aa/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), true, false, null); queryPlanToBe = compiler.compile(); // This is post-fix:
[1/4] phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) [Forced Update!]
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.14 c7e9c1955 -> 758ab6d72 (forced update) PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/53f37ef0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/53f37ef0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/53f37ef0 Branch: refs/heads/4.x-cdh5.14 Commit: 53f37ef05ea9af232bf34ba80f03b44da18156ac Parents: cbca731 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:42:04 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
[1/4] phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) [Forced Update!]
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.13 79c8a6637 -> 522256646 (forced update) PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/53f37ef0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/53f37ef0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/53f37ef0 Branch: refs/heads/4.x-cdh5.13 Commit: 53f37ef05ea9af232bf34ba80f03b44da18156ac Parents: cbca731 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:42:04 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
[1/4] phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) [Forced Update!]
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.12 4e3295017 -> 2bb92cca8 (forced update) PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/53f37ef0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/53f37ef0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/53f37ef0 Branch: refs/heads/4.x-cdh5.12 Commit: 53f37ef05ea9af232bf34ba80f03b44da18156ac Parents: cbca731 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:42:04 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 824860ca7 -> bac88a6d4 PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bac88a6d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bac88a6d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bac88a6d Branch: refs/heads/5.x-HBase-2.0 Commit: bac88a6d4382b5302186b8d95f6034bdd749ac48 Parents: 824860c Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:48:26 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bac88a6d/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/bac88a6d/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 0cf977e..6fd6e72 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 b0b5456ff -> 3de69287c PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3de69287 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3de69287 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3de69287 Branch: refs/heads/4.x-HBase-0.98 Commit: 3de69287c62ffaeca27861a52abe52d322792854 Parents: b0b5456 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:46:12 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3de69287/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/3de69287/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 9d22e30..03db29c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -548,7 +548,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 6a69a255c -> 43163c8f3 PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/43163c8f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/43163c8f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/43163c8f Branch: refs/heads/4.x-HBase-1.1 Commit: 43163c8f39c725d279863ccec12676f6cf4c673b Parents: 6a69a25 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:44:05 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/43163c8f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/43163c8f/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/4.x-cdh5.11 cbca73177 -> 53f37ef05 PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/53f37ef0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/53f37ef0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/53f37ef0 Branch: refs/heads/4.x-cdh5.11 Commit: 53f37ef05ea9af232bf34ba80f03b44da18156ac Parents: cbca731 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:42:04 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/53f37ef0/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 629a9175b -> 2e8498295 PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2e849829 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2e849829 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2e849829 Branch: refs/heads/4.x-HBase-1.2 Commit: 2e849829505b4359d7311d6a17938ba7ffc19459 Parents: 629a917 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:40:05 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2e849829/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/2e849829/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/master 8d80d5a98 -> 9335972fb PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9335972f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9335972f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9335972f Branch: refs/heads/master Commit: 9335972fb1d231f9ff1cce8b55ca5753149cba2c Parents: 8d80d5a Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:39:35 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9335972f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/9335972f/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new
phoenix git commit: PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 81f887584 -> ffc380aad PHOENIX-4728 ARRAY_APPEND and ARRAY_REMOVE should work with null column value (Xavier Jodoin) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ffc380aa Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ffc380aa Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ffc380aa Branch: refs/heads/4.x-HBase-1.3 Commit: ffc380aad453497020109b855b2668bb026fe5cf Parents: 81f8875 Author: James TaylorAuthored: Fri May 25 09:36:41 2018 -0700 Committer: James Taylor Committed: Fri May 25 09:36:41 2018 -0700 -- .../phoenix/end2end/ArrayAppendFunctionIT.java | 38 .../apache/phoenix/compile/UpsertCompiler.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffc380aa/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java index caa17fe..7962a7a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayAppendFunctionIT.java @@ -132,6 +132,24 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { } @Test +public void testUpsertEmptyArrayModification() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +ResultSet rs; +String[] strings = new String[]{"34567"}; +Array array = conn.createArrayOf("VARCHAR", strings); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,nullVarChar) SELECT region_name,ARRAY_APPEND(nullVarChar,'34567') FROM " + tableName); +conn.commit(); + +rs = conn.createStatement().executeQuery("SELECT nullVarChar FROM " + tableName + " LIMIT 1"); +assertTrue(rs.next()); +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} + +@Test public void testArrayAppendFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String tableName = initTables(conn); @@ -147,6 +165,26 @@ public class ArrayAppendFunctionIT extends ParallelStatsDisabledIT { assertEquals(array, rs.getArray(1)); assertFalse(rs.next()); } + +@Test +public void testUpsertArrayAppendFunctionVarchar() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +String tableName = initTables(conn); + +conn.createStatement().execute("UPSERT INTO " + tableName + " (region_name,varchars) SELECT region_name,ARRAY_APPEND(varchars,'34567') as varchars FROM " + tableName+ " WHERE region_name = 'SF Bay Area'"); +conn.commit(); + +ResultSet rs; +rs = conn.createStatement().executeQuery("SELECT varchars FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); +assertTrue(rs.next()); + +String[] strings = new String[]{"2345", "46345", "23234", "34567"}; + +Array array = conn.createArrayOf("VARCHAR", strings); + +assertEquals(array, rs.getArray(1)); +assertFalse(rs.next()); +} @Test public void testArrayAppendFunctionInteger() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/ffc380aa/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index 30f0c18..c3cfa10 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -549,7 +549,7 @@ public class UpsertCompiler { select = SelectStatement.create(select, hint); // Pass scan through if same table in upsert and select so that projection is computed correctly // Use optimizer to choose the best plan -QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns, parallelIteratorFactoryToBe, new SequenceManager(statement), false, false, null); +QueryCompiler compiler = new QueryCompiler(statement, select, selectResolver, targetColumns,