Skip to content

[Spark] Tidy ArrowFieldWriter: generic vector field and a single place that advances count #14

Closed

Description

@ChristopherWirt

ArrowFieldWriter (PR #7) has two small structural issues worth tidying. Neither is a bug today.

1. Each subclass copies the base vector field

17 subclasses keep a second, typed copy of the base vector (bits, bytes, shorts, ...), each with a constructor that only sets it.

Fix: make the base class generic, ArrowFieldWriter<V extends FieldVector> with a final V vector, and drop the copies.

2. count is advanced in two places

write() increments count, but StructWriter.setNull also increments each child's count by hand. A future writer that forgets this misaligns the struct's children with no error.

Fix: a writeNull() helper that calls setNull() and then count++, used for nulled struct children.

Where

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions