in tools/src/main/scala/magnolify/tools/ParquetParser.scala [56:82]
private def isList(groupType: GroupType): Boolean =
groupType.getLogicalTypeAnnotation == LTA.listType() &&
groupType.getFieldCount == 1 &&
groupType.getType(0).isRepetition(Type.Repetition.REPEATED)
// list and element names may not be used in existing data and should not be enforced as errors when reading
// groupType.getFieldName(0) == "list" &&
// groupType.getType(0).asGroupType().getFieldName(0) == "element"
private def parseList(groupType: GroupType): Schema =
parseType(groupType.getType(0))
private def isMap(groupType: GroupType): Boolean =
(groupType.getLogicalTypeAnnotation == LTA.mapType() ||
groupType.getLogicalTypeAnnotation == MapKeyValueTypeAnnotation.getInstance()) &&
groupType.getFieldCount == 1 &&
groupType.getType(0).isRepetition(Type.Repetition.REPEATED) &&
groupType.getType(0).asGroupType().getFieldCount == 2
// key_value, key and value names may not be used in existing data and should not be enforced as errors when reading
// groupType.getFieldName(0) == "key_value"
// groupType.getType(0).asGroupType().getFieldName(0) == "key"
// groupType.getType(0).asGroupType().getFieldName(1) == "value"
private def parseMap(groupType: GroupType): Schema = {
val kvGroupType = groupType.getType(0).asGroupType()
val keySchema = parseType(kvGroupType.getType(0))
val valueSchema = parseType(kvGroupType.getType(1))
Mapped(keySchema, valueSchema)
}