use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionValue in project hazelcast by hazelcast.
the class IsNullPredicateIntegrationTest method testLiteral.
@Test
public void testLiteral() {
Class<? extends ExpressionValue> clazz = ExpressionValue.createClass(INTEGER);
int key = 0;
ExpressionValue value = ExpressionValue.create(clazz, 0, 1);
put(key, value);
checkLiteral("null", true);
checkLiteral("true", false);
checkLiteral("false", false);
checkLiteral("1", false);
checkLiteral("1.1", false);
checkLiteral("1.1E1", false);
checkLiteral("'a'", false);
}
use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionValue in project hazelcast by hazelcast.
the class SqlIndexCastTest method check.
private void check(ExpressionType<?> typeFrom, QueryDataTypeFamily typeTo, boolean expectedIndexUsage) {
// Put value into map.
Map map = instance().getMap(MAP_NAME);
Class<? extends ExpressionValue> valueClass = ExpressionValue.createClass(typeFrom);
ExpressionValue value = ExpressionValue.create(valueClass).field1(typeFrom.valueFrom());
map.put(0, value);
checkComparison(typeFrom, typeTo, expectedIndexUsage);
checkIsNull(typeFrom, typeTo, expectedIndexUsage);
}
use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionValue in project hazelcast by hazelcast.
the class ColumnIntegrationTest method testColumn_auto.
@Test
public void testColumn_auto() {
for (ExpressionType<?> type : ExpressionTypes.all()) {
Class<? extends ExpressionValue> clazz = ExpressionValue.createClass(type.typeName());
ExpressionValue value = ExpressionValue.create(clazz, type.valueFrom());
ExpressionValue nullValue = ExpressionValue.create(clazz, null);
SqlColumnType expectedType = type.getFieldConverterType().getTypeFamily().getPublicType();
Object expectedResult = type.getFieldConverterType().getConverter().convertToSelf(type.getFieldConverterType().getConverter(), type.valueFrom());
putAndCheckValue(value, sql("field1"), expectedType, expectedResult);
putAndCheckValue(nullValue, sql("field1"), expectedType, null);
}
}
use of com.hazelcast.jet.sql.impl.support.expressions.ExpressionValue in project hazelcast by hazelcast.
the class IsNullPredicateIntegrationTest method testParameter.
@Test
public void testParameter() {
Class<? extends ExpressionValue> clazz = ExpressionValue.createClass(INTEGER);
int key = 0;
ExpressionValue value = ExpressionValue.create(clazz, 0, 1);
put(key, value);
assertEquals(set(key), keys("SELECT key FROM map WHERE ? IS NULL", new Object[] { null }));
assertEquals(set(), keys("SELECT key FROM map WHERE ? IS NOT NULL", new Object[] { null }));
checkParameter(key, BOOLEAN);
checkParameter(key, BYTE);
checkParameter(key, SHORT);
checkParameter(key, INTEGER);
checkParameter(key, LONG);
checkParameter(key, BIG_INTEGER);
checkParameter(key, BIG_DECIMAL);
checkParameter(key, FLOAT);
checkParameter(key, DOUBLE);
checkParameter(key, STRING);
checkParameter(key, CHARACTER);
checkParameter(key, LOCAL_DATE);
checkParameter(key, LOCAL_TIME);
checkParameter(key, LOCAL_DATE_TIME);
checkParameter(key, OFFSET_DATE_TIME);
checkParameter(key, OBJECT);
}
Aggregations