本文整理汇总了Java中org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory.INT属性的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveCategory.INT属性的具体用法?Java PrimitiveCategory.INT怎么用?Java PrimitiveCategory.INT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory
的用法示例。
在下文中一共展示了PrimitiveCategory.INT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isNumericObjectInspector
private static boolean isNumericObjectInspector(ObjectInspector oi, boolean constant) {
Category c = oi.getCategory();
if (c != Category.PRIMITIVE) {
return false;
}
PrimitiveCategory pc = ((PrimitiveObjectInspector) oi)
.getPrimitiveCategory();
if (pc != PrimitiveCategory.INT && pc != PrimitiveCategory.LONG) {
return false;
}
if (constant && !(oi instanceof ConstantObjectInspector)) {
return false;
}
return true;
}
示例2: initialize
@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
if (arguments.length != 1) {
throw new UDFArgumentLengthException(
"sorted_by_feature() has an single arguments: map<int, float> map");
}
switch (arguments[0].getCategory()) {
case MAP:
argumentOI = (MapObjectInspector) arguments[0];
ObjectInspector keyOI = argumentOI.getMapKeyObjectInspector();
ObjectInspector valueOI = argumentOI.getMapValueObjectInspector();
if (keyOI.getCategory().equals(Category.PRIMITIVE)
&& valueOI.getCategory().equals(Category.PRIMITIVE)) {
final PrimitiveCategory keyCategory = ((PrimitiveObjectInspector) keyOI).getPrimitiveCategory();
final PrimitiveCategory valueCategory = ((PrimitiveObjectInspector) valueOI).getPrimitiveCategory();
if (keyCategory == PrimitiveCategory.INT
&& valueCategory == PrimitiveCategory.FLOAT) {
break;
}
}
default:
throw new UDFArgumentTypeException(0, "Type mismatch: map");
}
return ObjectInspectorFactory.getStandardMapObjectInspector(
argumentOI.getMapKeyObjectInspector(), argumentOI.getMapValueObjectInspector());
}
示例3: GenericUDFTestINT
public GenericUDFTestINT() {
super("testHiveUDFINT", PrimitiveCategory.INT);
}
示例4: isIntTypeInfo
public static boolean isIntTypeInfo(@Nonnull TypeInfo typeInfo) {
if (typeInfo.getCategory() != ObjectInspector.Category.PRIMITIVE) {
return false;
}
return ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory() == PrimitiveCategory.INT;
}