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


Java TypeProtos.DataMode方法代码示例

本文整理汇总了Java中org.apache.drill.common.types.TypeProtos.DataMode方法的典型用法代码示例。如果您正苦于以下问题:Java TypeProtos.DataMode方法的具体用法?Java TypeProtos.DataMode怎么用?Java TypeProtos.DataMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.drill.common.types.TypeProtos的用法示例。


在下文中一共展示了TypeProtos.DataMode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReturnType

import org.apache.drill.common.types.TypeProtos; //导入方法依赖的package包/类
@Override
public MajorType getReturnType(List<LogicalExpression> args) {

    TypeProtos.DataMode mode = returnValue.type.getMode();
    boolean nullInput = false;
    int scale = 0;
    int precision = 0;

    for (LogicalExpression e : args) {
        if (e.getMajorType().getMode() == TypeProtos.DataMode.OPTIONAL) {
            nullInput = true;
        }
        scale = Math.max(scale, e.getMajorType().getScale());
        precision = Math.max(precision, e.getMajorType().getPrecision());
    }

    if (nullHandling == NullHandling.NULL_IF_NULL && nullInput) {
        mode = TypeProtos.DataMode.OPTIONAL;
    }

    return (TypeProtos.MajorType.newBuilder().setMinorType(returnValue.type.getMinorType()).setScale(scale).setPrecision(precision).setMode(mode).build());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:DrillDecimalMaxScaleFuncHolder.java

示例2: getReturnType

import org.apache.drill.common.types.TypeProtos; //导入方法依赖的package包/类
@Override
public MajorType getReturnType(List<LogicalExpression> args) {

  int precision = 0;
  TypeProtos.DataMode mode = returnValue.type.getMode();

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

  return (TypeProtos.MajorType.newBuilder().setMinorType(returnValue.type.getMinorType()).setScale(0).setPrecision(precision).setMode(mode).build());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:DrillDecimalZeroScaleFuncHolder.java

示例3: getReturnType

import org.apache.drill.common.types.TypeProtos; //导入方法依赖的package包/类
@Override
public MajorType getReturnType(List<LogicalExpression> args) {

    TypeProtos.DataMode mode = returnValue.type.getMode();

    if (nullHandling == NullHandling.NULL_IF_NULL) {
        // if any one of the input types is nullable, then return nullable return type
        for (LogicalExpression e : args) {
            if (e.getMajorType().getMode() == TypeProtos.DataMode.OPTIONAL) {
                mode = TypeProtos.DataMode.OPTIONAL;
                break;
            }
        }
    }

    if (args.size() != 3) {
        StringBuilder err = new StringBuilder();
        for (int i = 0; i < args.size(); i++) {
            err.append("arg" + i + ": " + args.get(i).getMajorType().getMinorType());
        }
        throw new DrillRuntimeException("Decimal cast function invoked with incorect arguments" + err);
    }

    int scale = (int) ((ValueExpressions.LongExpression)(args.get(args.size() - 1))).getLong();
    int precision = (int) ((ValueExpressions.LongExpression)(args.get(args.size() - 2))).getLong();
    return (TypeProtos.MajorType.newBuilder().setMinorType(returnValue.type.getMinorType()).setScale(scale).setPrecision(precision).setMode(mode).build());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:28,代码来源:DrillDecimalCastFuncHolder.java

示例4: getDataMode

import org.apache.drill.common.types.TypeProtos; //导入方法依赖的package包/类
private TypeProtos.DataMode getDataMode(ColumnDescriptor column) {
  if (column.getMaxRepetitionLevel() > 0 ) {
    return DataMode.REPEATED;
  } else if (column.getMaxDefinitionLevel() == 0) {
    return TypeProtos.DataMode.REQUIRED;
  } else {
    return TypeProtos.DataMode.OPTIONAL;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:ParquetRecordReader.java

示例5: toMajorType

import org.apache.drill.common.types.TypeProtos; //导入方法依赖的package包/类
public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName primitiveTypeName, int length,
                                        TypeProtos.DataMode mode, SchemaElement schemaElement,
                                        OptionManager options) {
  MinorType minorType = getMinorType(primitiveTypeName, length, schemaElement, options);
  TypeProtos.MajorType.Builder typeBuilder = TypeProtos.MajorType.newBuilder().setMinorType(minorType).setMode(mode);

  if (CoreDecimalUtility.isDecimalType(minorType)) {
    typeBuilder.setPrecision(schemaElement.getPrecision()).setScale(schemaElement.getScale());
  }
  return typeBuilder.build();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:ParquetToDrillTypeConverter.java

示例6: resolveHash

import org.apache.drill.common.types.TypeProtos; //导入方法依赖的package包/类
public void resolveHash(DrillConfig config, LogicalExpression arg, TypeProtos.MajorType expectedArg,
                                  TypeProtos.MajorType expectedOut, TypeProtos.DataMode expectedBestInputMode,
                                  FunctionImplementationRegistry registry) throws JClassAlreadyExistsException, IOException {
  final List<LogicalExpression> args = new ArrayList<>();
  args.add(arg);
  final String[] registeredNames = { "hash" };
  FunctionCall call = new FunctionCall(
      "hash",
      args,
      ExpressionPosition.UNKNOWN
  );
  final FunctionResolver resolver = FunctionResolverFactory.getResolver(call);
  final DrillFuncHolder matchedFuncHolder = registry.findDrillFunction(resolver, call);
  assertEquals( expectedBestInputMode, matchedFuncHolder.getParmMajorType(0).getMode());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:TestSimpleFunctions.java


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