use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class StringToArrayFunctionIT method testStringToArrayFunction8.
@Test
public void testStringToArrayFunction8() throws Exception {
Connection conn = DriverManager.getConnection(getUrl());
ResultSet rs;
rs = conn.createStatement().executeQuery("SELECT STRING_TO_ARRAY(string2, delimiter2, '4') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
assertTrue(rs.next());
PhoenixArray expected = new PhoenixArray(PVarchar.INSTANCE, new Object[] { "1", "2", "3", null });
assertEquals(expected, rs.getArray(1));
assertFalse(rs.next());
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class StringToArrayFunctionIT method testStringToArrayFunction7.
@Test
public void testStringToArrayFunction7() throws Exception {
Connection conn = DriverManager.getConnection(getUrl());
ResultSet rs;
rs = conn.createStatement().executeQuery("SELECT STRING_TO_ARRAY(string2, delimiter2, '1') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
assertTrue(rs.next());
PhoenixArray expected = new PhoenixArray(PVarchar.INSTANCE, new Object[] { null, "2", "3", "4" });
assertEquals(expected, rs.getArray(1));
assertFalse(rs.next());
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class StringToArrayFunctionIT method testStringToArrayFunction11.
@Test
public void testStringToArrayFunction11() throws Exception {
Connection conn = DriverManager.getConnection(getUrl());
ResultSet rs;
rs = conn.createStatement().executeQuery("SELECT STRING_TO_ARRAY('a,hello,hello,hello,b', ',', 'hello') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
assertTrue(rs.next());
PhoenixArray expected = new PhoenixArray(PVarchar.INSTANCE, new Object[] { "a", null, null, null, "b" });
assertEquals(expected, rs.getArray(1));
assertFalse(rs.next());
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class StringToArrayFunctionIT method testStringToArrayFunctionWithNestedFunctions2.
@Test
public void testStringToArrayFunctionWithNestedFunctions2() throws Exception {
Connection conn = DriverManager.getConnection(getUrl());
ResultSet rs;
rs = conn.createStatement().executeQuery("SELECT STRING_TO_ARRAY(ARRAY_TO_STRING(ARRAY['a', 'b', 'c'], delimiter2), delimiter2, 'b') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
assertTrue(rs.next());
PhoenixArray expected = new PhoenixArray(PVarchar.INSTANCE, new Object[] { "a", null, "c" });
assertEquals(expected, rs.getArray(1));
assertFalse(rs.next());
}
use of org.apache.phoenix.schema.types.PhoenixArray in project phoenix by apache.
the class StringToArrayFunctionIT method testStringToArrayFunction12.
@Test
public void testStringToArrayFunction12() throws Exception {
Connection conn = DriverManager.getConnection(getUrl());
ResultSet rs;
rs = conn.createStatement().executeQuery("SELECT STRING_TO_ARRAY('b.a.b', delimiter2, 'b') FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
assertTrue(rs.next());
PhoenixArray expected = new PhoenixArray(PVarchar.INSTANCE, new Object[] { null, "a", null });
assertEquals(expected, rs.getArray(1));
assertFalse(rs.next());
}
Aggregations