Skip to content

Field Metadata Not Read #4495

@treyhakanson

Description

@treyhakanson

Field metadata is not read when using @apache-arrow/ts@0.13.0. Example below also uses pyarrow==0.13.0

Steps to reproduce:

Adding metadata:

import pyarrow as pa
import pandas as pd

source = "sample.csv"
output = "sample.arrow"
df = pd.read_csv(source)
table = pa.Table.from_pandas(df)
schema = pa.schema([
    column.field.add_metadata({"foo": "bar"}))
    for column
    in table.columns
])
writer = pa.RecordBatchFileWriter(output, schema)
writer.write(table)
writer.close()

Reading field metadata using pyarrow:

source = "sample.arrow"
field = "foo"
reader = pa.RecordBatchFileReader(source)
reader.schema.field_by_name(field).metadata  # Correctly shows `{"foo": "bar"}`

Reading field metadata using @apache-arrow/ts:

import { Table, Field, Type } from "@apache-arrow/ts";

const url = "https://example.com/sample.arrow";
const buf = await fetch(url).then(res => res.arrayBuffer());
const table = Table.from([new Uint8Array(buf)]);
for (let field of table.schema.fields) {
    field.metadata;  // Incorrectly shows an empty map
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions