use of org.apache.ignite.client.Config.SERVER in project ignite by apache.
the class ArrayIndexTest method checkTableExpression.
/**
*/
private void checkTableExpression(boolean useTypedArrays) throws Exception {
System.setProperty(IGNITE_USE_BINARY_ARRAYS, Boolean.toString(useTypedArrays));
BinaryArray.initUseBinaryArrays();
try (IgniteEx ex = startGrid(0);
IgniteEx cli = startClientGrid(1);
IgniteClient thinCli = Ignition.startClient(new ClientConfiguration().setAddresses(SERVER))) {
ex.cluster().active(true);
executeSql(cli, "CREATE TABLE T1 (id int not null, name varchar(1), PRIMARY KEY(id))");
String insertQry = "INSERT INTO T1(id, name) VALUES (?, ?)";
executeSql(cli, insertQry, 1, "A");
executeSql(cli, insertQry, 2, "B");
executeSql(cli, insertQry, 3, "C");
String select = "SELECT T1.ID, T1.NAME FROM T1 INNER JOIN TABLE (id2 int = ?) T2 on (T1.id = T2.id2) ORDER BY id";
Object arg = new Integer[] { 1, 2 };
Consumer<List<List<?>>> checker = res -> {
assertNotNull(res);
assertEquals(2, res.size());
assertEquals(1, res.get(0).get(0));
assertEquals("A", res.get(0).get(1));
assertEquals(2, res.get(1).get(0));
assertEquals("B", res.get(1).get(1));
};
checker.accept(executeSql(ex, select, arg));
checker.accept(executeSql(cli, select, arg));
checker.accept(thinCli.query(new SqlFieldsQuery(select).setArgs(arg)).getAll());
} finally {
System.clearProperty(IGNITE_USE_BINARY_ARRAYS);
BinaryArray.initUseBinaryArrays();
}
}
Aggregations