paul-rogers commented on a change in pull request #1870: DRILL-7359: Add
support for DICT type in RowSet Framework
URL: https://github.com/apache/drill/pull/1870#discussion_r347114932
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/resultSet/model/single/BaseWriterBuilder.java
##########
@@ -75,19 +78,32 @@ protected BaseWriterBuilder(ColumnConversionFactory
conversionFactory) {
private AbstractObjectWriter buildVectorWriter(ValueVector vector,
VectorDescrip descrip) {
final MajorType type = vector.getField().getType();
switch (type.getMinorType()) {
- case MAP:
- return MapWriter.buildMapWriter(descrip.metadata,
- (AbstractMapVector) vector,
- buildMap((AbstractMapVector) vector, descrip));
+ case DICT:
+ return buildDict(vector, descrip);
+ case MAP:
+ return MapWriter.buildMapWriter(descrip.metadata,
+ (AbstractMapVector) vector,
+ buildMap((AbstractMapVector) vector, descrip));
- case UNION:
- return buildUnion((UnionVector) vector, descrip);
+ case UNION:
+ return buildUnion((UnionVector) vector, descrip);
- case LIST:
- return buildList(vector, descrip);
+ case LIST:
+ return buildList(vector, descrip);
- default:
- return ColumnWriterFactory.buildColumnWriter(descrip.metadata,
conversionFactory, vector);
+ default:
+ return ColumnWriterFactory.buildColumnWriter(descrip.metadata,
conversionFactory, vector);
+ }
+ }
+
+ private AbstractObjectWriter buildDict(ValueVector vector, VectorDescrip
descrip) {
+ if (vector.getField().getType().getMode() == DataMode.REPEATED) {
Review comment:
Again, it *should* be possible to simply call `buildVectorWriter` and handle
the key and value vectors recursively so you don't have to repeat the type
checks in this method.
If the recursive construction does not work, it is likely because of some
details that we can figure out. (As noted above, this code is tricky because of
multiple constraints imposed by the `MaterializedField`, `VaueVector` and
writer classes.)
----------------------------------------------------------------
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