[20/48] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishnaAuthored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t1 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("INTEGER",new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t2 VALUES('a',ARRAY['10',null])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t2 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("VARCHAR",new Object[]{"10",null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t3 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("BIGINT",new Object[]{(long)2,null,(long)32335,(long)4}); + +
[20/44] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishnaAuthored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t1 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("INTEGER",new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t2 VALUES('a',ARRAY['10',null])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t2 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("VARCHAR",new Object[]{"10",null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t3 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("BIGINT",new Object[]{(long)2,null,(long)32335,(long)4}); + +
[20/43] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishnaAuthored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t1 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("INTEGER",new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t2 VALUES('a',ARRAY['10',null])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t2 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("VARCHAR",new Object[]{"10",null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute("CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])"); + +PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])"); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery("Select a from t3 where k = 'a'"); +rs.next(); +Array array = conn.createArrayOf("BIGINT",new Object[]{(long)2,null,(long)32335,(long)4}); + +
[20/34] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new Object[]{(long)2,null,(long)32335,(long)4}); + +assertEquals(rs.getArray(1),array); +conn.close();
[20/37] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new Object[]{(long)2,null,(long)32335,(long)4}); + +assertEquals(rs.getArray(1),array); +conn.close();
[20/31] phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new Object[]{(long)2,null,(long)32335,(long)4}); + +assertEquals(rs.getArray(1),array); +conn.close();
[32/49] phoenix git commit: PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7f6bf10b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7f6bf10b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7f6bf10b Branch: refs/heads/json Commit: 7f6bf10b2cc54279b9210772323dc8f4d2939a19 Parents: 9e686b7 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:13:44 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:13:44 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7f6bf10b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new Object[]{(long)2,null,(long)32335,(long)4}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} +
[40/50] [abbrv] phoenix git commit: PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika)
PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7f6bf10b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7f6bf10b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7f6bf10b Branch: refs/heads/calcite Commit: 7f6bf10b2cc54279b9210772323dc8f4d2939a19 Parents: 9e686b7 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:13:44 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:13:44 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7f6bf10b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new Object[]{(long)2,null,(long)32335,(long)4}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +}
phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 9c5fa - 6f890ade0 PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f890ade Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f890ade Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f890ade Branch: refs/heads/4.x-HBase-1.1 Commit: 6f890ade0691d03469ff8fce81c2fa9edd6941af Parents: 9c5f111 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:18:51 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:18:51 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f890ade/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new
phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.1 fb1cb7e96 - 72abeb150 PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/72abeb15 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/72abeb15 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/72abeb15 Branch: refs/heads/4.4-HBase-1.1 Commit: 72abeb1507503d819d34b66c6e3c3dcd3a8cb789 Parents: fb1cb7e Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:22:56 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:22:56 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/72abeb15/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new
phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.0 861900975 - c222b8206 PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c222b820 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c222b820 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c222b820 Branch: refs/heads/4.4-HBase-1.0 Commit: c222b82062a359f0ea4b6361ca3244a83b48da3b Parents: 8619009 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:24:24 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:24:24 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c222b820/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new
phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
Repository: phoenix Updated Branches: refs/heads/4.4-HBase-0.98 c88606da6 - b351c6b69 PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b351c6b6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b351c6b6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b351c6b6 Branch: refs/heads/4.4-HBase-0.98 Commit: b351c6b692db08eb56102303c9991b69af745b26 Parents: c88606d Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:25:38 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:25:38 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b351c6b6/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new
phoenix git commit: PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika)
Repository: phoenix Updated Branches: refs/heads/master 9e686b758 - 7f6bf10b2 PHOENIX-777 Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7f6bf10b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7f6bf10b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7f6bf10b Branch: refs/heads/master Commit: 7f6bf10b2cc54279b9210772323dc8f4d2939a19 Parents: 9e686b7 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:13:44 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:13:44 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7f6bf10b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new
phoenix git commit: PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika)
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 4849a5675 - 3413a8e05 PHOENIX-777 - Support null value for fixed length ARRAY (Dumindu Buddhika) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3413a8e0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3413a8e0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3413a8e0 Branch: refs/heads/4.x-HBase-1.0 Commit: 3413a8e05d4649fe798ef50d7b87490c846965bb Parents: 4849a56 Author: ramkrishna ramkrishna.s.vasude...@gmail.com Authored: Tue Jun 2 11:20:33 2015 +0530 Committer: ramkrishna ramkrishna.s.vasude...@gmail.com Committed: Tue Jun 2 11:20:33 2015 +0530 -- .../phoenix/end2end/ArraysWithNullsIT.java | 300 +++ .../phoenix/compile/ExpressionCompiler.java | 9 +- .../apache/phoenix/schema/types/PBinary.java| 2 +- .../org/apache/phoenix/schema/types/PChar.java | 5 +- .../org/apache/phoenix/schema/types/PDate.java | 6 +- .../apache/phoenix/schema/types/PDecimal.java | 3 + .../apache/phoenix/schema/types/PTimestamp.java | 17 +- .../phoenix/schema/types/PhoenixArray.java | 51 ++-- 8 files changed, 358 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3413a8e0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java new file mode 100644 index 000..b034193 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArraysWithNullsIT.java @@ -0,0 +1,300 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.phoenix.end2end; + +import static org.junit.Assert.assertEquals; + +import java.sql.*; + +import org.apache.phoenix.schema.types.PTimestamp; +import org.apache.phoenix.schema.types.PhoenixArray; +import org.junit.Test; + +public class ArraysWithNullsIT extends BaseClientManagedTimeIT { + +@Test +public void testArrayUpsertIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t1 ( k VARCHAR PRIMARY KEY, a INTEGER[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t1 VALUES('a',ARRAY[null,3,null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t1 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(INTEGER,new Object[]{null,3,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + + + +@Test +public void testArrayUpsertVarcharWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t2 ( k VARCHAR PRIMARY KEY, a VARCHAR[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t2 VALUES('a',ARRAY['10',null])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t2 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(VARCHAR,new Object[]{10,null}); + +assertEquals(rs.getArray(1),array); +conn.close(); + +} + +@Test +public void testArrayUpsertBigIntWithNulls() throws Exception { +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute(CREATE TABLE t3 ( k VARCHAR PRIMARY KEY, a BIGINT[])); + +PreparedStatement stmt = conn.prepareStatement(UPSERT INTO t3 VALUES('a',ARRAY[2,null,32335,4])); +stmt.execute(); +conn.commit(); + +ResultSet rs = conn.createStatement().executeQuery(Select a from t3 where k = 'a'); +rs.next(); +Array array = conn.createArrayOf(BIGINT,new