本文整理汇总了Java中org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions类的典型用法代码示例。如果您正苦于以下问题:Java ObjectInspectorOptions类的具体用法?Java ObjectInspectorOptions怎么用?Java ObjectInspectorOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectInspectorOptions类属于org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory包,在下文中一共展示了ObjectInspectorOptions类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStructObjectInspector
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions; //导入依赖的package包/类
public static LazySimpleStructObjectInspector createStructObjectInspector(TypeInfo type,
LazySerDeParameters serdeParams) {
StructTypeInfo structTypeInfo = (StructTypeInfo) type;
List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
List<ObjectInspector> fieldObjectInspectors = new ArrayList<ObjectInspector>(fieldTypeInfos.size());
for (int i = 0; i < fieldTypeInfos.size(); i++) {
fieldObjectInspectors.add(createObjectInspector(fieldTypeInfos.get(i), serdeParams));
}
return LazyObjectInspectorFactory.getLazySimpleStructObjectInspector(
fieldNames, fieldObjectInspectors, null,
serdeParams.getSeparators()[1],
serdeParams, ObjectInspectorOptions.JAVA);
// return ObjectInspectorFactory.getStandardStructObjectInspector(fieldNames, fieldObjectInspectors);
}
示例2: createLazyPhoenixInspector
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions; //导入依赖的package包/类
private ObjectInspector createLazyPhoenixInspector(Configuration conf, Properties tbl) throws SerDeException {
List<String> columnNameList = Arrays.asList(tbl.getProperty(serdeConstants.LIST_COLUMNS).split(PhoenixStorageHandlerConstants.COMMA));
List<TypeInfo> columnTypeList = TypeInfoUtils.getTypeInfosFromTypeString(tbl.getProperty(serdeConstants.LIST_COLUMN_TYPES));
List<ObjectInspector> columnObjectInspectors = Lists.newArrayListWithExpectedSize(columnTypeList.size());
for (TypeInfo typeInfo : columnTypeList) {
columnObjectInspectors.add(PhoenixObjectInspectorFactory.createObjectInspector(typeInfo, serdeParams));
}
return LazyObjectInspectorFactory.getLazySimpleStructObjectInspector(columnNameList,
columnObjectInspectors, null, serdeParams.getSeparators()[0], serdeParams, ObjectInspectorOptions.JAVA);
}
示例3: initialize
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions; //导入依赖的package包/类
@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
if (arguments.length != 1) {
throw new UDFArgumentLengthException("normalize() has an only single argument.");
}
switch (arguments[0].getCategory()) {
case LIST:
ObjectInspector elmOI = ((ListObjectInspector) arguments[0]).getListElementObjectInspector();
if (elmOI.getCategory().equals(Category.PRIMITIVE)) {
if (((PrimitiveObjectInspector) elmOI).getPrimitiveCategory() == PrimitiveCategory.STRING) {
break;
}
}
default:
throw new UDFArgumentTypeException(0,
"normalize() must have List[String] as an argument, but "
+ arguments[0].getTypeName() + " was found.");
}
// Create a ObjectInspector converter for arguments
ObjectInspector outputElemOI = ObjectInspectorFactory.getReflectionObjectInspector(
Text.class, ObjectInspectorOptions.JAVA);
ObjectInspector outputOI = ObjectInspectorFactory.getStandardListObjectInspector(outputElemOI);
toListText = ObjectInspectorConverters.getConverter(arguments[0], outputOI);
ObjectInspector listElemOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
ObjectInspector returnElemOI = ObjectInspectorUtils.getStandardObjectInspector(listElemOI);
return ObjectInspectorFactory.getStandardListObjectInspector(returnElemOI);
}