Java Code Examples for org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo#getListElementTypeInfo()
The following examples show how to use
org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo#getListElementTypeInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CobolDeserializer.java From Cobol-to-Hive with Apache License 2.0 | 6 votes |
private Object deserializeList(String columnName, ListTypeInfo columnType) throws RuntimeException { int size = Integer.parseInt(rowElements.get(propertiesList.get(fieldNo).get("dcol"))); List<Object> listContents = new ArrayList<Object>(); TypeInfo ti = columnType.getListElementTypeInfo(); String tn = columnType.getTypeName(); rowElements.add(""); int tempfieldNo = fieldNo, fieldNoList=fieldNo; for (int j = 0; j < size; j++) { listContents.add(worker(tn,ti)); fieldNoList = fieldNo; fieldNo = tempfieldNo; } fieldNo = fieldNoList; return listContents; }
Example 2
Source File: BlurObjectInspectorGenerator.java From incubator-retired-blur with Apache License 2.0 | 6 votes |
private ObjectInspector createObjectInspectorWorker(TypeInfo ti) throws SerDeException { switch (ti.getCategory()) { case PRIMITIVE: PrimitiveTypeInfo pti = (PrimitiveTypeInfo) ti; return PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(pti); case STRUCT: StructTypeInfo sti = (StructTypeInfo) ti; List<ObjectInspector> ois = new ArrayList<ObjectInspector>(sti.getAllStructFieldTypeInfos().size()); for (TypeInfo typeInfo : sti.getAllStructFieldTypeInfos()) { ois.add(createObjectInspectorWorker(typeInfo)); } return ObjectInspectorFactory.getStandardStructObjectInspector(sti.getAllStructFieldNames(), ois); case LIST: ListTypeInfo lti = (ListTypeInfo) ti; TypeInfo listElementTypeInfo = lti.getListElementTypeInfo(); return ObjectInspectorFactory.getStandardListObjectInspector(createObjectInspectorWorker(listElementTypeInfo)); default: throw new SerDeException("No Hive categories matched for [" + ti + "]"); } }
Example 3
Source File: HiveBucketingV2.java From presto with Apache License 2.0 | 5 votes |
private static int hashOfList(ListTypeInfo type, Block singleListBlock) { TypeInfo elementTypeInfo = type.getListElementTypeInfo(); int result = 0; for (int i = 0; i < singleListBlock.getPositionCount(); i++) { result = result * 31 + hash(elementTypeInfo, singleListBlock, i); } return result; }
Example 4
Source File: HiveBucketingV1.java From presto with Apache License 2.0 | 5 votes |
private static int hashOfList(ListTypeInfo type, Block singleListBlock) { TypeInfo elementTypeInfo = type.getListElementTypeInfo(); int result = 0; for (int i = 0; i < singleListBlock.getPositionCount(); i++) { result = result * 31 + hash(elementTypeInfo, singleListBlock, i); } return result; }
Example 5
Source File: MDSListObjectInspector.java From multiple-dimension-spread with Apache License 2.0 | 5 votes |
public MDSListObjectInspector( final ListTypeInfo typeInfo ){ valueObjectInspector = MDSObjectInspectorFactory.craeteObjectInspectorFromTypeInfo( typeInfo.getListElementTypeInfo() ); if( valueObjectInspector.getCategory() == ObjectInspector.Category.PRIMITIVE ){ getField = new PrimitiveGetField( (PrimitiveObjectInspector)valueObjectInspector ); } else if( valueObjectInspector.getCategory() == ObjectInspector.Category.UNION ){ getField = new UnionGetField( (UnionTypeInfo)( typeInfo.getListElementTypeInfo() ) ); } else{ getField = new NestedGetField(); } }
Example 6
Source File: JSONCDHSerDe.java From bigdata-tutorial with Apache License 2.0 | 5 votes |
/** * Parse a JSON list and its elements. This uses the Hive metadata for the * list elements to determine how to parse the elements. * * @param field - The JSON list to parse * @param fieldTypeInfo - Metadata about the Hive column * @return - A list of the parsed elements */ private Object parseList(Object field, ListTypeInfo fieldTypeInfo) { ArrayList<Object> list = (ArrayList<Object>) field; TypeInfo elemTypeInfo = fieldTypeInfo.getListElementTypeInfo(); if (list != null) { for (int i = 0; i < list.size(); i++) { list.set(i, parseField(list.get(i), elemTypeInfo)); } } return list.toArray(); }
Example 7
Source File: JSONSerDe.java From searchanalytics-bigdata with MIT License | 5 votes |
/** * Parse a JSON list and its elements. This uses the Hive metadata for the * list elements to determine how to parse the elements. * * @param field * - The JSON list to parse * @param fieldTypeInfo * - Metadata about the Hive column * @return - A list of the parsed elements */ @SuppressWarnings("unchecked") private Object parseList(final Object field, final ListTypeInfo fieldTypeInfo) { final ArrayList<Object> list = (ArrayList<Object>) field; final TypeInfo elemTypeInfo = fieldTypeInfo.getListElementTypeInfo(); for (int i = 0; i < list.size(); i++) { list.set(i, parseField(list.get(i), elemTypeInfo)); } return list.toArray(); }
Example 8
Source File: SingleLevelArrayMapKeyValuesSchemaConverter.java From presto with Apache License 2.0 | 4 votes |
private static GroupType convertArrayType(String name, ListTypeInfo typeInfo, Repetition repetition) { TypeInfo subType = typeInfo.getListElementTypeInfo(); return listWrapper(name, OriginalType.LIST, convertType("array_element", subType, Repetition.REPEATED), repetition); }
Example 9
Source File: SingleLevelArraySchemaConverter.java From presto with Apache License 2.0 | 4 votes |
private static GroupType convertArrayType(String name, ListTypeInfo typeInfo, Repetition repetition) { TypeInfo subType = typeInfo.getListElementTypeInfo(); return listWrapper(name, OriginalType.LIST, convertType("array", subType, Repetition.REPEATED), repetition); }
Example 10
Source File: MapKeyValuesSchemaConverter.java From presto with Apache License 2.0 | 4 votes |
private static GroupType convertArrayType(String name, ListTypeInfo typeInfo) { TypeInfo subType = typeInfo.getListElementTypeInfo(); return listWrapper(name, OriginalType.LIST, new GroupType(Repetition.REPEATED, ParquetHiveSerDe.ARRAY.toString(), convertType("array_element", subType))); }
Example 11
Source File: HiveSchemaConverter.java From parquet-mr with Apache License 2.0 | 4 votes |
private static GroupType convertArrayType(final String name, final ListTypeInfo typeInfo) { final TypeInfo subType = typeInfo.getListElementTypeInfo(); return listWrapper(name, listType(), new GroupType(Repetition.REPEATED, ParquetHiveSerDe.ARRAY.toString(), convertType("array_element", subType))); }