Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-9479: [JS] Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) #7771

Closed
wants to merge 1 commit into from

Conversation

H-Plus-Time
Copy link
Contributor

Steps for reproduction:

const foo = new arrow.List(new arrow.Field('bar', new arrow.Float64()))
const table = arrow.Table.empty(foo) // ⚡ 

The Data constructor assumes childData is either falsey, a zero-length array (still falsey, but worth distinguishing) or a non-zero length array of valid instances of Data or objects with a data property. Coercing undefineds to empty arrays a little earlier for compound types (List, FixedSizeList, Map) avoids this.

Guard against undefined childData input - compound types need to coerce undefined childData to an empty array, rather than encapsulating it (i.e. `[undefined]`)
@github-actions
Copy link

Thanks for opening a pull request!

Could you open an issue for this pull request on JIRA?
https://issues.apache.org/jira/browse/ARROW

Then could you also rename pull request title in the following format?

ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}

See also:

@wesm wesm changed the title Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) [JS] Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) Jul 15, 2020
@H-Plus-Time H-Plus-Time changed the title [JS] Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) [ARROW-9479]: [JS] Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) Jul 16, 2020
@wesm wesm changed the title [ARROW-9479]: [JS] Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) ARROW-9479: [JS] Fix Table.from for zero-item serialized tables, Table.empty for schemas containing compound types (List, FixedSizeList, Map) Jul 16, 2020
@github-actions
Copy link

@emkornfield
Copy link
Contributor

@trxcllnt @TheNeuralBit could one of you review?

@trxcllnt
Copy link
Contributor

LGTM 👍, thanks @H-Plus-Time!

kszucs pushed a commit that referenced this pull request Oct 19, 2020
…e.empty for schemas containing compound types (List, FixedSizeList, Map)

Steps for reproduction:
```js
const foo = new arrow.List(new arrow.Field('bar', new arrow.Float64()))
const table = arrow.Table.empty(foo) // ⚡
```

The Data constructor assumes childData is either falsey, a zero-length array (still falsey, but worth distinguishing) or a non-zero length array of valid instances of Data or objects with a data property. Coercing undefineds to empty arrays a little earlier for compound types (List, FixedSizeList, Map) avoids this.

Closes #7771 from H-Plus-Time/ARROW-9479

Authored-by: H-Plus-Time <Nicholas.Roberts.au@gmail.com>
Signed-off-by: Brian Hulette <bhulette@google.com>
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
…e.empty for schemas containing compound types (List, FixedSizeList, Map)

Steps for reproduction:
```js
const foo = new arrow.List(new arrow.Field('bar', new arrow.Float64()))
const table = arrow.Table.empty(foo) // ⚡
```

The Data constructor assumes childData is either falsey, a zero-length array (still falsey, but worth distinguishing) or a non-zero length array of valid instances of Data or objects with a data property. Coercing undefineds to empty arrays a little earlier for compound types (List, FixedSizeList, Map) avoids this.

Closes apache#7771 from H-Plus-Time/ARROW-9479

Authored-by: H-Plus-Time <Nicholas.Roberts.au@gmail.com>
Signed-off-by: Brian Hulette <bhulette@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants