You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Trey Hakanson (JIRA)" <ji...@apache.org> on 2019/06/07 22:41:00 UTC

[jira] [Created] (ARROW-5532) Field Metadata Not Read

Trey Hakanson created ARROW-5532:
------------------------------------

             Summary: Field Metadata Not Read
                 Key: ARROW-5532
                 URL: https://issues.apache.org/jira/browse/ARROW-5532
             Project: Apache Arrow
          Issue Type: Bug
    Affects Versions: 0.13.0
         Environment: Mac OSX 10.14, Chrome 74
            Reporter: Trey Hakanson


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:

```py
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`:

```py
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`:

```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
}
```



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)