本文整理匯總了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());
}