本文整理汇总了Java中org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo.getMapValueTypeInfo方法的典型用法代码示例。如果您正苦于以下问题:Java MapTypeInfo.getMapValueTypeInfo方法的具体用法?Java MapTypeInfo.getMapValueTypeInfo怎么用?Java MapTypeInfo.getMapValueTypeInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo
的用法示例。
在下文中一共展示了MapTypeInfo.getMapValueTypeInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MDSMapObjectInspector
import org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo; //导入方法依赖的package包/类
public MDSMapObjectInspector( final MapTypeInfo typeInfo ){
TypeInfo keyTypeInfo = typeInfo.getMapKeyTypeInfo();
if( keyTypeInfo.getCategory() == ObjectInspector.Category.PRIMITIVE && ( (PrimitiveTypeInfo)keyTypeInfo ).getPrimitiveCategory() == PrimitiveCategory.STRING ){
keyObjectInspector = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
}
else{
throw new RuntimeException( "Map key type is string only." );
}
valueObjectInspector = MDSObjectInspectorFactory.craeteObjectInspectorFromTypeInfo( typeInfo.getMapValueTypeInfo() );
if( valueObjectInspector.getCategory() == ObjectInspector.Category.PRIMITIVE ){
getField = new PrimitiveGetField( (PrimitiveObjectInspector)valueObjectInspector );
}
else if( valueObjectInspector.getCategory() == ObjectInspector.Category.UNION ){
getField = new UnionGetField( (UnionTypeInfo)( typeInfo.getMapValueTypeInfo() ) );
}
else{
getField = new NestedGetField();
}
}
示例2: parseMap
import org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo; //导入方法依赖的package包/类
/**
* Parse a JSON object as a map. This uses the Hive metadata for the map
* values to determine how to parse the values. The map is assumed to have
* a string for a key.
*
* @param field - The JSON list to parse
* @param fieldTypeInfo - Metadata about the Hive column
* @return
*/
private Object parseMap(Object field, MapTypeInfo fieldTypeInfo) {
Map<Object,Object> map = (Map<Object,Object>) field;
TypeInfo valueTypeInfo = fieldTypeInfo.getMapValueTypeInfo();
for (Map.Entry<Object,Object> entry : map.entrySet()) {
map.put(entry.getKey(), parseField(entry.getValue(), valueTypeInfo));
}
return map;
}
示例3: parseMap
import org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo; //导入方法依赖的package包/类
/**
* Parse a JSON object as a map. This uses the Hive metadata for the map
* values to determine how to parse the values. The map is assumed to have
* a string for a key.
*
* @param field - The JSON list to parse
* @param fieldTypeInfo - Metadata about the Hive column
* @return
*/
private Object parseMap(Object field, MapTypeInfo fieldTypeInfo) {
Map<Object, Object> map = (Map<Object, Object>) field;
TypeInfo valueTypeInfo = fieldTypeInfo.getMapValueTypeInfo();
if (map != null) {
for (Map.Entry<Object, Object> entry : map.entrySet()) {
map.put(entry.getKey(), parseField(entry.getValue(), valueTypeInfo));
}
}
return map;
}
示例4: parseMap
import org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo; //导入方法依赖的package包/类
/**
* Parse a JSON object as a map. This uses the Hive metadata for the map
* values to determine how to parse the values. The map is assumed to have a
* string for a key.
*
* @param field
* - The JSON list to parse
* @param fieldTypeInfo
* - Metadata about the Hive column
* @return
*/
@SuppressWarnings("unchecked")
private Object parseMap(final Object field, final MapTypeInfo fieldTypeInfo) {
final Map<Object, Object> map = (Map<Object, Object>) field;
final TypeInfo valueTypeInfo = fieldTypeInfo.getMapValueTypeInfo();
for (final Map.Entry<Object, Object> entry : map.entrySet()) {
map.put(entry.getKey(), parseField(entry.getValue(), valueTypeInfo));
}
return map;
}