當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。