Skip to content

Spanner - transaction.runStream : fails for large query results : Uncaught TypeError: Cannot read property 'rowType' of null #2273

Closed

Description

@dominiksteiner

Environment details

  • OS: Mac OSX 10.12.4
  • Node.js version: 6.7.0
  • npm version: 3.10.8
  • @google-cloud/spanner version: 0.4.2

Steps to reproduce

  1. require @google-cloud/spanner
  2. Run transaction.runStream on a large result set (~10k records)
        collectionSelf.connection.runTransaction(function(err, transaction) {
          if (err) {
            var msg = `${name} : could not run transaction : ${JSON.stringify(err)}`;
            log.error(msg);
            log.error(err.stack);
            reject(msg);
          }
          var results = [];
          transaction.runStream(query)
            .on('error', function(err) {
              log.error(`${name} : runStream error : ${JSON.stringify(err)}`);
              reject(err);
            })
            .on('data', function(row) {
              log.silly(`${name} : runStream : ${JSON.stringify(row)}`);
              results.push(row);
            })
            .on('end', function() {
              log.debug(`${name} : runStream end`);
              resolve(results);
            });
        });
  1. The following error happens

Uncaught TypeError: Cannot read property 'rowType' of null
at Function.partialResultStream.formatRow_ (node_modules/@google-cloud/spanner/src/partial-result-stream.js:167:28)

it seems that row.metadata is null in the response

https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/spanner/src/partial-result-stream.js#L164

As printing out row gives the following

{"values": [<very long array of objets>,"metadata":null,"chunkedValue":false,"resumeToken":[],"stats":null}]}

Are large result sets not supported even with runStream? Thanks

Activity

  1. changed the title [-]Transaction.runStream : fails for large query results : Uncaught TypeError: Cannot read property 'rowType' of null[/-] [+]Spanner - transaction.runStream : fails for large query results : Uncaught TypeError: Cannot read property 'rowType' of null[/+] on May 2, 2017
  2. stephenplusplus commented on May 2, 2017

    @stephenplusplus
    Contributor

    This is likely a bug in our code, thank you for reporting.

    @callmehiphop in implementing the full set of tests in Spanner, has anything come up that would touch on this? 'metadata' is only present in the first response of a result set, so it would seem we are calling formatRow_ at an incorrect time.

  3. added
    api: spannerIssues related to the Spanner API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on May 2, 2017
  4. callmehiphop commented on May 8, 2017

    @callmehiphop
    Contributor

    @stephenplusplus this did come up, we just needed to cache the metadata from previous requests. This should be fixed/released by EOW

  5. dominiksteiner commented on May 16, 2017

    @dominiksteiner
    Author

    Thanks for the update, was there any change on this last week?

  6. stephenplusplus commented on May 16, 2017

    @stephenplusplus
    Contributor

    No change yet- the fix is in #2313.

  7. dominiksteiner commented on May 16, 2017

    @dominiksteiner
    Author

    @stephenplusplus thanks for the update and for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions