[Java] Improve VectorSchemaRoot.getVector(String name) lookup performance

Open
#1,148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
java
Domain
data, performance

Research direction

Start in vector/src/main/java/org/apache/arrow/vector/VectorSchemaRoot.java at getVector(String name), then inspect the existing fieldVectorsMap and the construction paths for field vectors. Confirm the name-based lookup preserves current behavior and compare it on a schema with many vectors; done means repeated name lookups no longer scan every field vector.

Written by the indexing model from the issue text.

Description

Type: enhancement
Describe the enhancement requested

The Java VectorSchemaRoot.getVector(String name) can be quite slow if a schema has many vectors. The code currently loops over all the field vectors until it finds the string match. Link to code.

Could we stroe a hash map of the FieldVector String name to the actual FieldVector? Basically the same thing as the fieldVectorsMap that maps the Field to FieldVector. For really wide datasets the trade off of a bit more memory for faster vector lookups would be really nice to have!

Happy to open up a PR with the improvement, thanks!

Dominant language
Java
Stars
95
Forks
154
Avg merge
2d 16h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/arrow-java

All issues in apache/arrow-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.