use of com.hazelcast.query.impl.CompositeConverter in project hazelcast by hazelcast.
the class MapTableConverterResolutionTest method checkCompositeConverter.
private void checkCompositeConverter(TypeConverter converter1, TypeConverter converter2, QueryDataType... expectedTypes) {
CompositeConverter converter = new CompositeConverter(new TypeConverter[] { converter1, converter2 });
List<QueryDataType> types = MapTableUtils.indexConverterToSqlTypes(converter);
List<QueryDataType> expectedTypes0 = expectedTypes == null ? Collections.emptyList() : Arrays.asList(expectedTypes);
assertEquals(expectedTypes0, types);
}
use of com.hazelcast.query.impl.CompositeConverter in project hazelcast by hazelcast.
the class MapTableUtils method indexConverterToSqlTypes.
public static List<QueryDataType> indexConverterToSqlTypes(TypeConverter converter) {
if (converter == null) {
return Collections.emptyList();
}
if (converter instanceof CompositeConverter) {
CompositeConverter converter0 = ((CompositeConverter) converter);
List<QueryDataType> res = new ArrayList<>(converter0.getComponentCount());
for (int i = 0; i < converter0.getComponentCount(); i++) {
QueryDataType type = indexConverterToSqlType(converter0.getComponentConverter(i));
if (type == null) {
break;
} else {
res.add(type);
}
}
if (!res.isEmpty()) {
return res;
}
} else {
QueryDataType type = indexConverterToSqlType(converter);
if (type != null) {
return Collections.singletonList(type);
}
}
return Collections.emptyList();
}
use of com.hazelcast.query.impl.CompositeConverter in project hazelcast by hazelcast.
the class MapTableConverterResolutionTest method checkUnsupportedConverter.
private void checkUnsupportedConverter(TypeConverter converter) {
assertNull(MapTableUtils.indexConverterToSqlType(converter));
assertEquals(Collections.emptyList(), MapTableUtils.indexConverterToSqlTypes(converter));
CompositeConverter badGood = new CompositeConverter(new TypeConverter[] { converter, INTEGER_CONVERTER });
assertEquals(Collections.emptyList(), MapTableUtils.indexConverterToSqlTypes(badGood));
CompositeConverter goodBad = new CompositeConverter(new TypeConverter[] { INTEGER_CONVERTER, converter });
assertEquals(Collections.singletonList(INT), MapTableUtils.indexConverterToSqlTypes(goodBad));
}
Aggregations