vvysotskyi commented on a change in pull request #1805: DRILL-7268: Read Hive
array with parquet native reader
URL: https://github.com/apache/drill/pull/1805#discussion_r292040376
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet2/DrillParquetGroupConverter.java
##########
@@ -131,43 +132,79 @@ public DrillParquetGroupConverter(OutputMutator mutator,
MapWriter mapWriter, Gr
name = type.getName();
}
- if (!isPrimitive) {
- Collection<SchemaPath> c = new ArrayList<>();
+ Converter converter = createFieldConverter(skipRepeated, type, name,
colNextChild);
+ converters.add(converter);
+ }
+ }
- while(colNextChild!=null) {
- if(colNextChild.isNamed()) {
- break;
- }
- colNextChild=colNextChild.getChild();
- }
+ private Converter createFieldConverter(boolean skipRepeated, Type fieldType,
String name, PathSegment colNextChild) {
+ Converter converter;
+ if (fieldType.isPrimitive()) {
+ converter = getConverterForType(name, fieldType.asPrimitiveType());
+ } else {
+ while (colNextChild != null && !colNextChild.isNamed()) {
+ colNextChild = colNextChild.getChild();
+ }
- if(colNextChild!=null) {
- SchemaPath s = new SchemaPath(colNextChild.getNameSegment());
- c.add(s);
- }
- if (rep != Repetition.REPEATED) {
- DrillParquetGroupConverter converter = new
DrillParquetGroupConverter(
- mutator, mapWriter.map(name), type.asGroupType(), c, options,
containsCorruptedDates);
- converters.add(converter);
+ Collection<SchemaPath> c = colNextChild == null
+ ? Collections.emptyList()
+ : Collections.singletonList(new
SchemaPath(colNextChild.getNameSegment()));
+
+ BaseWriter writer;
+ GroupType fieldGroupType = fieldType.asGroupType();
+ if (isLogicalListType(fieldGroupType)) {
+ writer = getWriter(name, (m, s) -> m.list(s), l -> l.list());
+ converter = new DrillParquetGroupConverter(mutator, writer,
fieldGroupType, c, options,
+ containsCorruptedDates, true, converterName);
+ } else if (fieldType.isRepetition(Repetition.REPEATED)) {
+ if (skipRepeated && fieldGroupType.getFieldCount() > 0) {
Review comment:
Looks like this check may be simplified to `skipRepeated` only.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services