Hello Drillers,
I'm currently working on integration with Hive complex types
(DRILL-3290 [1]) and trying to make small POC before publishing
design document. I started from Hive array of INT type, and was able
to use repeated value vector
successfully. But later I realized that our repeated vectors are not
suitable for storing null as array and as element in array.
So then I found ListVector, but all my attempts to write null inside
array row weren't successful. First, I tried to do so using Mutator,
but it doesn't contain any methods for writing elements of array.
After that I tried to use writer obtained
via listVector.getWriter(). Check the code called for each table row:
IntObjectInspector eoi = (IntObjectInspector)
oi.getListElementObjectInspector();
List<?> nullableIntList = oi.getList(hiveFieldValue);
UnionListWriter listWriter = outputVV.getWriter();
listWriter.startList();
IntStream.range(0, nullableIntList.size()).forEach(innerIndex -> {
Object val = nullableIntList.get(innerIndex);
if (val == null) {
listWriter.writeNull();
} else {
listWriter.writeInt(eoi.get(val));
}
});
listWriter.endList();
And got two problems here: 1) listWriter.writeNull() throws exception
immediately 2) listWriter.writeInt(eoi.get(val)) writes all rows
arrays into one first row array.
I'd apppreciate if you guys could give me a suggestion about how to
use or where to look for correct usages of the ListVector ?
[1] https://issues.apache.org/jira/browse/DRILL-3290
Thank you in advance,
Igor Guzenko