本文整理汇总了Java中io.crate.metadata.FunctionIdent类的典型用法代码示例。如果您正苦于以下问题:Java FunctionIdent类的具体用法?Java FunctionIdent怎么用?Java FunctionIdent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FunctionIdent类属于io.crate.metadata包,在下文中一共展示了FunctionIdent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(ScalarFunctionModule module) {
List<DataType> supportedTimestampTypes = ImmutableList.<DataType>of(
DataTypes.TIMESTAMP, DataTypes.LONG, DataTypes.STRING);
for (DataType dataType : supportedTimestampTypes) {
// without format
module.register(new DateFormatFunction(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.of(dataType)),
DataTypes.STRING)
));
// with format
module.register(new DateFormatFunction(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.of(DataTypes.STRING, dataType)),
DataTypes.STRING)
));
// time zone aware variant
module.register(new DateFormatFunction(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.of(DataTypes.STRING, DataTypes.STRING, dataType)),
DataTypes.STRING)
));
}
}
示例2: visitArrayLikePredicate
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
@Override
public Symbol visitArrayLikePredicate(ArrayLikePredicate node, ExpressionAnalysisContext context) {
if (node.getEscape() != null) {
throw new UnsupportedOperationException("ESCAPE is not supported.");
}
Symbol rightSymbol = normalize(process(node.getValue(), context));
Symbol leftSymbol = normalize(process(node.getPattern(), context));
DataType rightType = rightSymbol.valueType();
if (!DataTypes.isCollectionType(rightType)) {
throw new IllegalArgumentException(
SymbolFormatter.format("invalid array expression: '%s'", rightSymbol));
}
rightSymbol = castIfNeededOrFail(rightSymbol, new ArrayType(DataTypes.STRING));
String operatorName = node.inverse() ? AnyNotLikeOperator.NAME : AnyLikeOperator.NAME;
FunctionIdent functionIdent = new FunctionIdent(operatorName, Arrays.asList(leftSymbol.valueType(), rightSymbol.valueType()));
FunctionInfo functionInfo = getFunctionInfo(functionIdent);
return context.allocateFunction(functionInfo, Arrays.asList(leftSymbol, rightSymbol));
}
示例3: initProxies
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
private void initProxies(Map<Function, EqProxy> existingProxies) {
Symbol left = origin.arguments().get(0);
DataType leftType = origin.info().ident().argumentTypes().get(0);
DataType rightType = ((CollectionType)origin.info().ident().argumentTypes().get(1)).innerType();
FunctionInfo eqInfo = new FunctionInfo(
new FunctionIdent(
EqOperator.NAME,
ImmutableList.of(leftType, rightType)
),
DataTypes.BOOLEAN
);
Literal arrayLiteral = (Literal)origin.arguments().get(1);
proxies = new HashMap<>();
for (Literal arrayElem : Literal.explodeCollection(arrayLiteral)) {
Function f = new Function(eqInfo, Arrays.asList(left, arrayElem));
EqProxy existingProxy = existingProxies.get(f);
if (existingProxy == null) {
existingProxy = new ChildEqProxy(f, this);
} else if (existingProxy instanceof ChildEqProxy) {
((ChildEqProxy) existingProxy).addParent(this);
}
proxies.put(f, existingProxy);
}
}
示例4: configure
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
@Override
protected void configure() {
functionBinder = MapBinder.newMapBinder(binder(), FunctionIdent.class, FunctionImplementation.class);
resolverBinder = MapBinder.newMapBinder(binder(), String.class, DynamicFunctionResolver.class);
IsNullPredicate.register(this);
NotPredicate.register(this);
MatchPredicate.register(this);
}
示例5: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (final DataType dataType : DataTypes.PRIMITIVE_TYPES) {
mod.register(new CollectSetAggregation(new FunctionInfo(new FunctionIdent(NAME,
ImmutableList.of(dataType)),
new SetType(dataType), FunctionInfo.Type.AGGREGATE)));
}
}
示例6: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (final DataType t : DataTypes.PRIMITIVE_TYPES) {
mod.register(new ArbitraryAggregation(
new FunctionInfo(new FunctionIdent(NAME, ImmutableList.of(t)), t,
FunctionInfo.Type.AGGREGATE)));
}
}
示例7: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (DataType t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
mod.register(new SumAggregation(new FunctionInfo(new FunctionIdent(NAME, ImmutableList.of(t)),
DataTypes.DOUBLE, FunctionInfo.Type.AGGREGATE)));
}
}
示例8: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
/**
* register as "avg" and "mean"
*/
public static void register(AggregationImplModule mod) {
for (String name :NAMES) {
for (DataType<?> t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
mod.register(new AverageAggregation(new FunctionInfo(
new FunctionIdent(name, ImmutableList.<DataType>of(t)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
mod.register(new AverageAggregation(new FunctionInfo(
new FunctionIdent(name, ImmutableList.<DataType>of(DataTypes.TIMESTAMP)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
}
示例9: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (DataType<?> t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
mod.register(new VarianceAggregation(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(t)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
mod.register(new VarianceAggregation(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.TIMESTAMP)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
示例10: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (DataType<?> t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
mod.register(new StandardDeviationAggregation(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(t)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
mod.register(new StandardDeviationAggregation(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.TIMESTAMP)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
示例11: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (final DataType dataType : DataTypes.PRIMITIVE_TYPES) {
FunctionInfo functionInfo = new FunctionInfo(new FunctionIdent(NAME, ImmutableList.of(dataType)),
dataType, FunctionInfo.Type.AGGREGATE);
if (dataType instanceof FixedWidthType) {
mod.register(new FixedMinimumAggregation(functionInfo));
} else {
mod.register(new VariableMinimumAggregation(functionInfo));
}
}
}
示例12: getForTypes
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
@Override
public FunctionImplementation<Function> getForTypes(List<DataType> dataTypes) throws IllegalArgumentException {
if (dataTypes.size() == 0) {
return new CountAggregation(COUNT_STAR_FUNCTION, false);
} else {
return new CountAggregation(
new FunctionInfo(new FunctionIdent(NAME, dataTypes),
DataTypes.LONG, FunctionInfo.Type.AGGREGATE), true);
}
}
示例13: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (final DataType dataType : DataTypes.PRIMITIVE_TYPES) {
FunctionInfo functionInfo = new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.of(dataType)), dataType, FunctionInfo.Type.AGGREGATE);
if (dataType instanceof FixedWidthType) {
mod.register(new FixedMaximumAggregation(functionInfo));
} else {
mod.register(new VariableMaximumAggregation(functionInfo));
}
}
}
示例14: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(AggregationImplModule mod) {
for (DataType<?> t : DataTypes.NUMERIC_PRIMITIVE_TYPES) {
mod.register(new GeometricMeanAggregation(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(t)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
mod.register(new GeometricMeanAggregation(new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(DataTypes.TIMESTAMP)), DataTypes.DOUBLE,
FunctionInfo.Type.AGGREGATE)));
}
示例15: register
import io.crate.metadata.FunctionIdent; //导入依赖的package包/类
public static void register(OperatorModule module) {
for (DataType type : DataTypes.PRIMITIVE_TYPES) {
FunctionInfo functionInfo = new FunctionInfo(
new FunctionIdent(NAME, ImmutableList.<DataType>of(type, new SetType(type))), DataTypes.BOOLEAN);
module.registerOperatorFunction(new InOperator(functionInfo));
}
}