本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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;
}
}
示例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();
}
示例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());
}