use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionBiValue in project hazelcast by hazelcast.
the class SqlIndexAbstractTest method fill.
private void fill() {
// Create an object with non-null fields to initialize converters
for (int i = 0; i < instances().length; ++i) {
int key = getLocalKeys(instances()[i], 1, value -> value).get(0);
ExpressionBiValue value = ExpressionBiValue.createBiValue(valueClass, key, f1.valueFrom(), f2.valueFrom());
map.put(key, value);
map.remove(key);
}
// Fill with values
int keyCounter = 0;
localMap = new HashMap();
for (Object firstField : f1.values()) {
for (Object secondField : f2.values()) {
// Put the same value twice intentionally to test index key with multiple values
for (int i = 0; i < 2 * DEFAULT_MEMBERS_COUNT; i++) {
int key = keyCounter++;
ExpressionBiValue value = ExpressionBiValue.createBiValue(valueClass, key, firstField, secondField);
localMap.put(key, value);
}
}
}
map.putAll(localMap);
}
use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionBiValue in project hazelcast by hazelcast.
the class SqlIndexConverterMismatchTest method testMismatch.
/**
* @see MapIndexScanExecIterator#getIndexEntries
*/
@SuppressWarnings({ "StatementWithEmptyBody", "JavadocReference" })
@Ignore("https://github.com/hazelcast/hazelcast/issues/19287")
@Test
public void testMismatch() {
ExpressionBiValue value1 = new ExpressionBiValue.IntegerIntegerVal();
value1.field1(10);
value1.field2(10);
ExpressionBiValue value2 = new ExpressionBiValue.StringIntegerVal();
value2.field1("10");
value2.field2(10);
map.put(getLocalKey(member1, key -> key), value1);
map.put(getLocalKey(member2, key -> key), value2);
try {
try (SqlResult result = member1.getSql().execute("SELECT key FROM " + MAP_NAME + " WHERE field1=1")) {
for (SqlRow ignore : result) {
// No-op.
}
}
fail("Must fail!");
} catch (HazelcastSqlException e) {
assertEquals(SqlErrorCode.INDEX_INVALID, e.getCode());
Throwable ex = findRootQueryException(e);
assertEquals("Cannot use the index \"index\" of the IMap \"map\" because it has component \"field1\" of type VARCHAR, but INTEGER was expected", ex.getMessage());
}
}
use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionBiValue in project hazelcast by hazelcast.
the class CaseOperatorIntegrationTest method putBiValue.
private void putBiValue(Object field1, Object field2, ExpressionType<?> type1, ExpressionType<?> type2) {
ExpressionBiValue value = ExpressionBiValue.createBiValue(ExpressionBiValue.createBiClass(type1, type2), field1, field2);
put(value);
}
Aggregations