public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) { TypeInfo result = cachedListTypeInfo.get(elementTypeInfo); if (result == null) { result = new ListTypeInfo(elementTypeInfo); TypeInfo prev = cachedListTypeInfo.putIfAbsent(elementTypeInfo, result); if (prev != null) { result = prev; } } return result; }
static ListTypeInfo toStructListTypeInfo(MapTypeInfo mapTypeInfo) { final StructTypeInfo structTypeInfo = new StructTypeInfo(); structTypeInfo.setAllStructFieldNames(Lists.newArrayList("keys", "values")); structTypeInfo.setAllStructFieldTypeInfos(Lists.newArrayList( mapTypeInfo.getMapKeyTypeInfo(), mapTypeInfo.getMapValueTypeInfo())); final ListTypeInfo structListTypeInfo = new ListTypeInfo(); structListTypeInfo.setListElementTypeInfo(structTypeInfo); return structListTypeInfo; }
@Override public void readBatch(int total, ColumnVector column, TypeInfo columnType) throws IOException { MapColumnVector mapColumnVector = (MapColumnVector) column; MapTypeInfo mapTypeInfo = (MapTypeInfo) columnType; ListTypeInfo keyListTypeInfo = new ListTypeInfo(); keyListTypeInfo.setListElementTypeInfo(mapTypeInfo.getMapKeyTypeInfo()); ListTypeInfo valueListTypeInfo = new ListTypeInfo(); valueListTypeInfo.setListElementTypeInfo(mapTypeInfo.getMapValueTypeInfo()); // initialize 2 ListColumnVector for keys and values ListColumnVector keyListColumnVector = new ListColumnVector(); ListColumnVector valueListColumnVector = new ListColumnVector(); // read the keys and values keyColumnReader.readBatch(total, keyListColumnVector, keyListTypeInfo); valueColumnReader.readBatch(total, valueListColumnVector, valueListTypeInfo); // set the related attributes according to the keys and values mapColumnVector.keys = keyListColumnVector.child; mapColumnVector.values = valueListColumnVector.child; mapColumnVector.isNull = keyListColumnVector.isNull; mapColumnVector.offsets = keyListColumnVector.offsets; mapColumnVector.lengths = keyListColumnVector.lengths; mapColumnVector.childCount = keyListColumnVector.childCount; mapColumnVector.isRepeating = keyListColumnVector.isRepeating && valueListColumnVector.isRepeating; } }
ListTypeInfo listTypeInfo = new ListTypeInfo(); listTypeInfo.setListElementTypeInfo(elementTypeInfo); typeInfo = listTypeInfo;
mapStructTypeInfo.setAllStructFieldTypeInfos( Lists.newArrayList(keyTypeInfo, valueTypeInfo)); final ListTypeInfo mapListStructTypeInfo = new ListTypeInfo(); mapListStructTypeInfo.setListElementTypeInfo(mapStructTypeInfo);
public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) { TypeInfo result = cachedListTypeInfo.get(elementTypeInfo); if (result == null) { result = new ListTypeInfo(elementTypeInfo); TypeInfo prev = cachedListTypeInfo.putIfAbsent(elementTypeInfo, result); if (prev != null) { result = prev; } } return result; }
public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) { TypeInfo result = cachedListTypeInfo.get(elementTypeInfo); if (result == null) { result = new ListTypeInfo(elementTypeInfo); TypeInfo prev = cachedListTypeInfo.putIfAbsent(elementTypeInfo, result); if (prev != null) { result = prev; } } return result; }
public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) { TypeInfo result = cachedListTypeInfo.get(elementTypeInfo); if (result == null) { result = new ListTypeInfo(elementTypeInfo); TypeInfo prev = cachedListTypeInfo.putIfAbsent(elementTypeInfo, result); if (prev != null) { result = prev; } } return result; }
public static TypeInfo getListTypeInfo(TypeInfo elementTypeInfo) { TypeInfo result = cachedListTypeInfo.get(elementTypeInfo); if (result == null) { result = new ListTypeInfo(elementTypeInfo); TypeInfo prev = cachedListTypeInfo.putIfAbsent(elementTypeInfo, result); if (prev != null) { result = prev; } } return result; }
break; case DataType.BAG: ti = new ListTypeInfo(); if (fs.getSchema()==null || fs.getSchema().getFields().length!=1) { throw new IOException("Wrong bag inner schema");