You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Teodor Kostov (Jira)" <ji...@apache.org> on 2022/04/27 12:07:00 UTC

[jira] [Created] (ARROW-16371) [JS] Empty table should provide an empty iterator

Teodor Kostov created ARROW-16371:
-------------------------------------

             Summary: [JS] Empty table should provide an empty iterator
                 Key: ARROW-16371
                 URL: https://issues.apache.org/jira/browse/ARROW-16371
             Project: Apache Arrow
          Issue Type: Bug
          Components: JavaScript
            Reporter: Teodor Kostov


When a table is created without any data and an iterator is requested I would expect to get an empty iterator that just returns that it's done.

Expected result:
{code:json}
{"value": null, "done": true}
{code}

However, the code fails in {{strideForType()}} with {{Uncaught TypeError: type2 is undefined}}.


{code:javascript}
schema = new arrow.Schema(dataType.children)
data = new arrow.Table(this.schema)

const iter = data[Symbol.iterator]()
{code}

It seems that the [table just creates a new vector with its data|https://github.com/apache/arrow/blob/e9481532e93e4f29a1c2c322e00f268d6cd9f534/js/src/table.ts#L227] and then the [{{strideForType}} method fails|https://github.com/apache/arrow/blob/e9481532e93e4f29a1c2c322e00f268d6cd9f534/js/src/type.ts#L652].



--
This message was sent by Atlassian Jira
(v8.20.7#820007)