rootType.setAllStructFieldTypeInfos(fieldTypes); inspector = OrcStruct.createObjectInspector(rootType);
rootType.setAllStructFieldTypeInfos(fieldTypes); inspector = OrcStruct.createObjectInspector(rootType);
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; }
sti.setAllStructFieldTypeInfos(newStructFieldInfos); sti.setAllStructFieldNames(structTypeInfo.getAllStructFieldNames()); return new ExprNodeConstantDesc(sti, newValues);
final StructTypeInfo mapStructTypeInfo = new StructTypeInfo(); mapStructTypeInfo.setAllStructFieldNames(Lists.newArrayList("keys", "values")); mapStructTypeInfo.setAllStructFieldTypeInfos( Lists.newArrayList(keyTypeInfo, valueTypeInfo)); final ListTypeInfo mapListStructTypeInfo = new ListTypeInfo();
StructTypeInfo rootType = new StructTypeInfo(); rootType.setAllStructFieldNames(columnNames); rootType.setAllStructFieldTypeInfos(fieldTypes); inspector = OrcStruct.createObjectInspector(rootType);
rowType.setAllStructFieldTypeInfos(fieldTypes); return OrcRecordUpdater.createEventSchema (OrcStruct.createObjectInspector(rowType));
private static List<OrcProto.Type> getSchemaOnRead(int numCols, Configuration conf) { String columnTypeProperty = conf.get(serdeConstants.LIST_COLUMN_TYPES); final String columnNameProperty = conf.get(serdeConstants.LIST_COLUMNS); if (columnTypeProperty == null || columnNameProperty == null) { return null; } ArrayList<String> columnNames = Lists.newArrayList(columnNameProperty.split(",")); ArrayList<TypeInfo> fieldTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty); StructTypeInfo structTypeInfo = new StructTypeInfo(); // Column types from conf includes virtual and partition columns at the end. We consider only // the actual columns in the file. structTypeInfo.setAllStructFieldNames(Lists.newArrayList(columnNames.subList(0, numCols))); structTypeInfo.setAllStructFieldTypeInfos(Lists.newArrayList(fieldTypes.subList(0, numCols))); ObjectInspector oi = TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(structTypeInfo); return getOrcTypes(oi); }
public static Schema convertTable(String table, Collection<FieldSchema> columns, @Nullable PartitionStrategy strategy) { ArrayList<String> fieldNames = Lists.newArrayList(); ArrayList<TypeInfo> fieldTypes = Lists.newArrayList(); LinkedList<String> start = Lists.newLinkedList(); Collection<String[]> requiredFields = requiredFields(strategy); List<Schema.Field> fields = Lists.newArrayList(); for (FieldSchema column : columns) { // pass null for the initial path to exclude the table name TypeInfo type = parseTypeInfo(column.getType()); fieldNames.add(column.getName()); fieldTypes.add(type); fields.add(convertField(start, column.getName(), type, requiredFields)); } StructTypeInfo struct = new StructTypeInfo(); struct.setAllStructFieldNames(fieldNames); struct.setAllStructFieldTypeInfos(fieldTypes); Schema recordSchema = Schema.createRecord(table, doc(struct), null, false); recordSchema.setFields(fields); return recordSchema; }
public static Schema convertTable(String table, Collection<FieldSchema> columns, @Nullable PartitionStrategy strategy) { ArrayList<String> fieldNames = Lists.newArrayList(); ArrayList<TypeInfo> fieldTypes = Lists.newArrayList(); LinkedList<String> start = Lists.newLinkedList(); Collection<String[]> requiredFields = requiredFields(strategy); List<Schema.Field> fields = Lists.newArrayList(); for (FieldSchema column : columns) { // pass null for the initial path to exclude the table name TypeInfo type = parseTypeInfo(column.getType()); fieldNames.add(column.getName()); fieldTypes.add(type); fields.add(convertField(start, column.getName(), type, requiredFields)); } StructTypeInfo struct = new StructTypeInfo(); struct.setAllStructFieldNames(fieldNames); struct.setAllStructFieldTypeInfos(fieldTypes); Schema recordSchema = Schema.createRecord(table, doc(struct), null, false); recordSchema.setFields(fields); return recordSchema; }
((StructTypeInfo)ti).setAllStructFieldTypeInfos(typeInfos); break; case DataType.BAG: