当前位置: 首页>>代码示例>>Java>>正文


Java FunctionTemplate类代码示例

本文整理汇总了Java中org.apache.drill.exec.expr.annotations.FunctionTemplate的典型用法代码示例。如果您正苦于以下问题:Java FunctionTemplate类的具体用法?Java FunctionTemplate怎么用?Java FunctionTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FunctionTemplate类属于org.apache.drill.exec.expr.annotations包,在下文中一共展示了FunctionTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getType

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
/**
 * Return type is used for functions where we need to remove the scale part.
 * For example, truncate and round functions.
 *
 * @param logicalExpressions logical expressions
 * @param attributes function attributes
 * @return return type
 */
@Override
public TypeProtos.MajorType getType(List<LogicalExpression> logicalExpressions, FunctionAttributes attributes) {

  int precision = 0;
  TypeProtos.DataMode mode = attributes.getReturnValue().getType().getMode();

  if (attributes.getNullHandling() == FunctionTemplate.NullHandling.NULL_IF_NULL) {
    // if any one of the input types is nullable, then return nullable return type
    for (LogicalExpression e : logicalExpressions) {
      if (e.getMajorType().getMode() == TypeProtos.DataMode.OPTIONAL) {
        mode = TypeProtos.DataMode.OPTIONAL;
      }
      precision = Math.max(precision, e.getMajorType().getPrecision());
    }
  }

  return TypeProtos.MajorType.newBuilder()
      .setMinorType(attributes.getReturnValue().getType().getMinorType())
      .setScale(0)
      .setPrecision(precision)
      .setMode(mode)
      .build();
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:32,代码来源:DecimalReturnTypeInference.java

示例2: getReturnTypeDataMode

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
/**
 * Calculates return type data mode based on give logical expressions.
 * If null handling strategy is internal, returns return value data mode.
 * If null handling strategy is null if null and at least one of the input types are nullable,
 * return nullable data mode.
 *
 * @param logicalExpressions logical expressions
 * @param attributes function attributes
 * @return data mode
 */
public static TypeProtos.DataMode getReturnTypeDataMode(final List<LogicalExpression> logicalExpressions, FunctionAttributes attributes) {
  if (attributes.getNullHandling() == FunctionTemplate.NullHandling.NULL_IF_NULL) {
    for (final LogicalExpression logicalExpression : logicalExpressions) {
      if (logicalExpression.getMajorType().getMode() == TypeProtos.DataMode.OPTIONAL) {
        return TypeProtos.DataMode.OPTIONAL;
      }
    }
  }
  return attributes.getReturnValue().getType().getMode();
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:21,代码来源:FunctionUtils.java

示例3: FunctionAttributes

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public FunctionAttributes (FunctionTemplate template,
                           ValueReference[] parameters,
                           ValueReference returnValue,
                           WorkspaceReference[] workspaceVars) {
  this.template = template;
  this.registeredNames = ((template.name().isEmpty()) ? template.names() : new String[] {template.name()});
  this.parameters = parameters;
  this.returnValue = returnValue;
  this.workspaceVars = workspaceVars;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:11,代码来源:FunctionAttributes.java

示例4: verifyAnnotations

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
private void verifyAnnotations(Annotation[] annotations, List<AnnotationDescriptor> scannedAnnotations) throws Exception {
  assertEquals(Arrays.toString(annotations) + " expected but got " + scannedAnnotations, annotations.length, scannedAnnotations.size());
  for (int i = 0; i < annotations.length; i++) {
    Annotation annotation = annotations[i];
    AnnotationDescriptor scannedAnnotation = scannedAnnotations.get(i);
    Class<? extends Annotation> annotationType = annotation.annotationType();
    assertEquals(annotationType.getName(), scannedAnnotation.getAnnotationType());
    if (annotation instanceof FunctionTemplate) {
      FunctionTemplate ft = (FunctionTemplate)annotation;
      if (ft.name() != null && !ft.name().equals("")) {
        assertEquals(ft.name(), scannedAnnotation.getSingleValue("name"));
      }
    }
    // generally verify all properties
    Annotation proxy = scannedAnnotation.getProxy(annotationType);
    Method[] declaredMethods = annotationType.getDeclaredMethods();
    for (Method method : declaredMethods) {
      if (method.getParameterTypes().length == 0) {
        Object reflectValue = method.invoke(annotation);
        Object byteCodeValue = method.invoke(proxy);
        String message = annotationType.getSimpleName() + "." + method.getName();
        if (method.getReturnType().isArray()) {
          assertArrayEquals(message, (Object[])reflectValue, (Object[])byteCodeValue);
        } else {
          assertEquals(message, reflectValue, byteCodeValue);
        }
      }
    }
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:31,代码来源:TestClassPathScanner.java

示例5: DrillDecimalSetScaleFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalSetScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalSetScaleFuncHolder.java

示例6: DrillDecimalAddFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalAddFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalAddFuncHolder.java

示例7: DrillDecimalMaxScaleFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalMaxScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars,
        methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillDecimalMaxScaleFuncHolder.java

示例8: DrillDecimalCastFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalCastFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalCastFuncHolder.java

示例9: DrillDecimalDivScaleFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalDivScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalDivScaleFuncHolder.java

示例10: DrillDecimalSumScaleFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalSumScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
    super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalSumScaleFuncHolder.java

示例11: DrillDecimalAggFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalAggFuncHolder(FunctionTemplate.FunctionScope scope, FunctionTemplate.NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:DrillDecimalAggFuncHolder.java

示例12: DrillDecimalZeroScaleFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalZeroScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalZeroScaleFuncHolder.java

示例13: DrillDecimalSumAggFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalSumAggFuncHolder(FunctionTemplate.FunctionScope scope, FunctionTemplate.NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom, String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars, Map<String, String> methods, List<String> imports) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:DrillDecimalSumAggFuncHolder.java

示例14: DrillDecimalModScaleFuncHolder

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
public DrillDecimalModScaleFuncHolder(FunctionScope scope, NullHandling nullHandling, boolean isBinaryCommutative, boolean isRandom,
                                      String[] registeredNames, ValueReference[] parameters, ValueReference returnValue, WorkspaceReference[] workspaceVars,
                                      Map<String, String> methods, List<String> imports, FunctionTemplate.FunctionCostCategory costCategory, Class<? extends DrillSimpleFunc> drillFuncClass) {
  super(scope, nullHandling, isBinaryCommutative, isRandom, registeredNames, parameters, returnValue, workspaceVars, methods, imports, costCategory, drillFuncClass);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillDecimalModScaleFuncHolder.java

示例15: getSelfCost

import org.apache.drill.exec.expr.annotations.FunctionTemplate; //导入依赖的package包/类
@Override
public int getSelfCost() {
  return FunctionTemplate.FunctionCostCategory.getDefault().getValue();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:HiveFuncHolderExpr.java


注:本文中的org.apache.drill.exec.expr.annotations.FunctionTemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。