use of org.apache.parquet.io.api.Converter in project parquet-mr by apache.
the class ColumnReadStoreImpl method getPrimitiveConverter.
private PrimitiveConverter getPrimitiveConverter(ColumnDescriptor path) {
Type currentType = schema;
Converter currentConverter = recordConverter;
for (String fieldName : path.getPath()) {
final GroupType groupType = currentType.asGroupType();
int fieldIndex = groupType.getFieldIndex(fieldName);
currentType = groupType.getType(fieldName);
currentConverter = currentConverter.asGroupConverter().getConverter(fieldIndex);
}
PrimitiveConverter converter = currentConverter.asPrimitiveConverter();
return converter;
}
use of org.apache.parquet.io.api.Converter in project parquet-mr by apache.
the class FilteringGroupConverter method getConverter.
// When a converter is asked for, we get the real one from the delegate, then wrap it
// in a filtering pass-through proxy.
// TODO: making the assumption that getConverter(i) is only called once, is that valid?
@Override
public Converter getConverter(int fieldIndex) {
// get the real converter from the delegate
Converter delegateConverter = checkNotNull(delegate.getConverter(fieldIndex), "delegate converter");
// determine the indexFieldPath for the converter proxy we're about to make, which is
// this converter's path + the requested fieldIndex
List<Integer> newIndexFieldPath = new ArrayList<Integer>(indexFieldPath.size() + 1);
newIndexFieldPath.addAll(indexFieldPath);
newIndexFieldPath.add(fieldIndex);
if (delegateConverter.isPrimitive()) {
PrimitiveColumnIO columnIO = getColumnIO(newIndexFieldPath);
ColumnPath columnPath = ColumnPath.get(columnIO.getColumnDescriptor().getPath());
ValueInspector[] valueInspectors = getValueInspectors(columnPath);
return new FilteringPrimitiveConverter(delegateConverter.asPrimitiveConverter(), valueInspectors);
} else {
return new FilteringGroupConverter(delegateConverter.asGroupConverter(), newIndexFieldPath, valueInspectorsByColumn, columnIOsByIndexFieldPath);
}
}
Aggregations