use of io.crate.metadata.FunctionIdent in project crate by crate.
the class AggregationTest method normalize.
protected Symbol normalize(String functionName, Symbol... args) {
DataType[] argTypes = new DataType[args.length];
for (int i = 0; i < args.length; i++) {
argTypes[i] = args[i].valueType();
}
AggregationFunction function = (AggregationFunction) functions.get(new FunctionIdent(functionName, Arrays.asList(argTypes)));
return function.normalizeSymbol(new Function(function.info(), Arrays.asList(args)), new TransactionContext(SessionContext.SYSTEM_SESSION));
}
use of io.crate.metadata.FunctionIdent in project crate by crate.
the class ArbitraryAggregationTest method testReturnType.
@Test
public void testReturnType() throws Exception {
FunctionIdent fi = new FunctionIdent("arbitrary", ImmutableList.<DataType>of(DataTypes.INTEGER));
assertEquals(DataTypes.INTEGER, functions.get(fi).info().returnType());
}
use of io.crate.metadata.FunctionIdent in project crate by crate.
the class CountAggregationTest method testReturnType.
@Test
public void testReturnType() throws Exception {
FunctionIdent fi = new FunctionIdent("count", ImmutableList.<DataType>of(DataTypes.INTEGER));
// Return type is fixed to Long
assertEquals(DataTypes.LONG, functions.get(fi).info().returnType());
}
use of io.crate.metadata.FunctionIdent in project crate by crate.
the class GeometricMeanAggregationtest method testReturnType.
@Test
public void testReturnType() throws Exception {
for (DataType<?> type : Iterables.concat(DataTypes.NUMERIC_PRIMITIVE_TYPES, Arrays.asList(DataTypes.TIMESTAMP))) {
FunctionIdent fi = new FunctionIdent("geometric_mean", ImmutableList.<DataType>of(type));
// Return type is fixed to Double
assertEquals(DataTypes.DOUBLE, functions.get(fi).info().returnType());
}
}
use of io.crate.metadata.FunctionIdent in project crate by crate.
the class MaximumAggregationTest method testReturnType.
@Test
public void testReturnType() throws Exception {
FunctionIdent fi = new FunctionIdent("max", ImmutableList.<DataType>of(DataTypes.INTEGER));
assertEquals(DataTypes.INTEGER, functions.get(fi).info().returnType());
}
Aggregations