apache / apache/arrow-js

Add (Field|Schema).withMetadata() helper to match other Arrow bindings

Open
#333 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
112
Forks
23
Avg merge
21h 18m
Merged PRs (30d)
8

Description

### Describe the enhancement requested

Manipulating field and schema metadata in the JS bindings currently requires manually constructing Map instances and re-instantiating Field/Objects objects.

Other Arrow implementations:

- C++ [Field](https://github.com/apache/arrow/blob/main/cpp/src/arrow/type.cc#L308-L311) + [Schema](https://github.com/apache/arrow/blob/main/cpp/src/arrow/type.cc#L2465-L2468)

- Rust [Field](https://docs.rs/arrow-schema/57.0.0/src/arrow_schema/field.rs.html#366-369) + [Schema](https://docs.rs/arrow-schema/57.0.0/src/arrow_schema/schema.rs.html#244-246)

expose a helper that replaces a field/schema’s metadata map (and accepts null/None to clear it).

**Request**

Add a `Field.withMetadata()`, and `Schema.withMetadata()` method that:

- Accepts a `Map`, a plain object `Record`, or `null` (to clear metadata).
- Returns a new Field with the supplied metadata (replacement semantics, not merging).

This brings the JavaScript bindings in line with the existing C++/PyArrow/Rust APIs and makes metadata updates more ergonomic (and less error-prone).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.