use of io.crate.types.DataType in project crate by crate.
the class TrigonometricFunctions method register.
private static void register(ScalarFunctionModule module, String name, DoubleUnaryOperator func) {
for (DataType inputType : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
FunctionIdent ident = new FunctionIdent(name, Collections.singletonList(inputType));
module.register(new DoubleScalar(new FunctionInfo(ident, DataTypes.DOUBLE), func));
}
}
use of io.crate.types.DataType in project crate by crate.
the class CastFunctionResolver method generateCastFunction.
public static Symbol generateCastFunction(Symbol sourceSymbol, DataType targetType, boolean tryCast) {
DataType sourceType = sourceSymbol.valueType();
FunctionInfo functionInfo = functionInfo(sourceType, targetType, tryCast);
//noinspection ArraysAsListWithZeroOrOneArgument # arguments of Function must be mutable
return new io.crate.analyze.symbol.Function(functionInfo, Arrays.asList(sourceSymbol));
}
use of io.crate.types.DataType in project crate by crate.
the class CoordinateFunction method register.
private static void register(ScalarFunctionModule module, String name, Function<Object, Double> func) {
for (DataType inputType : SUPPORTED_INPUT_TYPES) {
FunctionIdent ident = new FunctionIdent(name, Collections.singletonList(inputType));
module.register(new UnaryScalar<>(new FunctionInfo(ident, DataTypes.DOUBLE), func));
}
}
use of io.crate.types.DataType in project crate by crate.
the class GeoHashFunction method register.
private static void register(ScalarFunctionModule module, String name, Function<Object, BytesRef> func) {
for (DataType inputType : SUPPORTED_INPUT_TYPES) {
FunctionIdent ident = new FunctionIdent(name, Collections.singletonList(inputType));
module.register(new UnaryScalar<>(new FunctionInfo(ident, DataTypes.STRING), func));
}
}
use of io.crate.types.DataType in project crate by crate.
the class MergePhase method writeTo.
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
distributionInfo.writeTo(out);
out.writeVInt(numUpstreams);
int numCols = inputTypes.size();
out.writeVInt(numCols);
for (DataType inputType : inputTypes) {
DataTypes.toStream(inputType, out);
}
if (executionNodes == null) {
out.writeVInt(0);
} else {
out.writeVInt(executionNodes.size());
for (String node : executionNodes) {
out.writeString(node);
}
}
PositionalOrderBy.toStream(positionalOrderBy, out);
}
Aggregations