use of io.crate.types.SetType in project crate by crate.
the class LuceneReferenceResolverTest method testGetImplementationWithColumnsOfTypeCollection.
@Test
public void testGetImplementationWithColumnsOfTypeCollection() {
Reference arrayRef = new Reference(new ReferenceIdent(new TableIdent("s", "t"), "a"), RowGranularity.DOC, DataTypes.DOUBLE_ARRAY);
assertThat(luceneReferenceResolver.getImplementation(arrayRef), instanceOf(DocCollectorExpression.ChildDocCollectorExpression.class));
Reference setRef = new Reference(new ReferenceIdent(new TableIdent("s", "t"), "a"), RowGranularity.DOC, new SetType(DataTypes.DOUBLE));
assertThat(luceneReferenceResolver.getImplementation(setRef), instanceOf(DocCollectorExpression.ChildDocCollectorExpression.class));
}
use of io.crate.types.SetType in project crate by crate.
the class AbstractScalarFunctionsTest method prepareFunctions.
@Before
public void prepareFunctions() throws Exception {
DocTableInfo tableInfo = TestingTableInfo.builder(new TableIdent(DocSchemaInfo.NAME, "users"), null).add("id", DataTypes.INTEGER).add("name", DataTypes.STRING).add("tags", new ArrayType(DataTypes.STRING)).add("age", DataTypes.INTEGER).add("a", DataTypes.INTEGER).add("x", DataTypes.LONG).add("shape", DataTypes.GEO_SHAPE).add("timestamp", DataTypes.TIMESTAMP).add("timezone", DataTypes.STRING).add("interval", DataTypes.STRING).add("time_format", DataTypes.STRING).add("long_array", new ArrayType(DataTypes.LONG)).add("int_array", new ArrayType(DataTypes.INTEGER)).add("long_set", new SetType(DataTypes.LONG)).add("regex_pattern", DataTypes.STRING).add("geoshape", DataTypes.GEO_SHAPE).add("geopoint", DataTypes.GEO_POINT).add("geostring", DataTypes.STRING).add("is_awesome", DataTypes.BOOLEAN).add("double_val", DataTypes.DOUBLE).add("float_val", DataTypes.DOUBLE).add("short_val", DataTypes.SHORT).add("obj", DataTypes.OBJECT, ImmutableList.of()).build();
DocTableRelation tableRelation = new DocTableRelation(tableInfo);
tableSources = ImmutableMap.of(new QualifiedName("users"), tableRelation);
sqlExpressions = new SqlExpressions(tableSources);
functions = sqlExpressions.getInstance(Functions.class);
}
use of io.crate.types.SetType in project crate by crate.
the class SubscriptFunctionTest method testNotRegisteredForSets.
@Test
public void testNotRegisteredForSets() throws Exception {
expectedException.expect(UnsupportedOperationException.class);
expectedException.expectMessage("unknown function: subscript(integer_set, integer)");
FunctionIdent functionIdent = new FunctionIdent(SubscriptFunction.NAME, Arrays.<DataType>asList(new SetType(DataTypes.INTEGER), DataTypes.INTEGER));
functions.getSafe(functionIdent);
}
use of io.crate.types.SetType in project crate by crate.
the class CollectSetAggregationTest method testReturnType.
@Test
public void testReturnType() throws Exception {
FunctionIdent fi = new FunctionIdent("collect_set", ImmutableList.<DataType>of(DataTypes.INTEGER));
assertEquals(new SetType(DataTypes.INTEGER), functions.get(fi).info().returnType());
}
Aggregations