当前位置: 首页>>代码示例>>Java>>正文


Java ObjectInspectorOptions类代码示例

本文整理汇总了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);
	}
 
开发者ID:mini666,项目名称:hive-phoenix-handler,代码行数:19,代码来源:PhoenixObjectInspectorFactory.java

示例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);
}
 
开发者ID:mini666,项目名称:hive-phoenix-handler,代码行数:14,代码来源:PhoenixSerDe.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);
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:31,代码来源:L2NormalizationUDFWrapper.java


注:本文中的org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory.ObjectInspectorOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。