Github user vvysotskyi commented on a diff in the pull request: https://github.com/apache/drill/pull/1068#discussion_r156621897 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java --- @@ -131,7 +131,7 @@ public static TypedFieldId getFieldIdIfMatches(ValueVector vector, TypedFieldId. } else if(v instanceof ListVector) { ListVector list = (ListVector) v; return getFieldIdIfMatches(list, builder, addToBreadCrumb, seg.getChild()); - } else if (v instanceof UnionVector) { + } else if (v instanceof UnionVector && !seg.isLastPath()) { --- End diff -- Good catch! I think we should add check for nulls into method `getFieldIdIfMatchesUnion()` as it was done for `getFieldIdIfMatches()`. Also please add a unit test for this change. You may use [testFieldWithDots()](https://github.com/apache/drill/blob/acc5ed927e1fa4011ac1c3724d15197484b9f45b/exec/java-exec/src/test/java/org/apache/drill/exec/vector/complex/writer/TestJsonReader.java#L705) as an example. But one more point: with this change error is not thrown, but only nulls are returned. I think we should also fix this issue on the borders of this pull request.
---