nbruno commented on a change in pull request #9151: URL: https://github.com/apache/arrow/pull/9151#discussion_r565612067
########## File path: java/vector/src/main/codegen/templates/StructWriters.java ########## @@ -184,6 +189,44 @@ public ListWriter list(String name) { return writer; } + @Override + public MapWriter map(String name) { + // returns existing writer + final FieldWriter writer = fields.get(handleCase(name)); + Preconditions.checkNotNull(writer); Review comment: This should be following the paradigm for other complex types that require arguments. In general, `foo(String name)` seems to be used to return an existing writer when the given type requires arguments. The existing writer is expected to have already been created by calling a same-named method with the type's arguments. For a Map, you need to send in keysSorted for us to be able to construct a writer. There's other types that you need to specify some additional info in order to be able to construct it (Duration needs a TimeUnit, Decimal needs scale / precision). I am guessing that these methods are provided for convenience, so the caller can do: writer.decimal256("example", 2, 5).writeDecimal256(..) // Now, they can reference that vector later on without constructing a new writer: writer.decimal256("example").writeDecimal256(..) That's why this is returning an existing writer and failing otherwise. ---------------------------------------------------------------- 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: us...@infra.apache.org