Not getting desired results using mapd-connector

Comments

1 comment

  • Avatar
    Chris Root

    due to javascript not having a true integer type (all numeric variables are 64-bit flt-pt), big integer values (which is the returned type for a COUNT(*) ) are stored as a special Thrift type backed by an ArrayBuffer. There are a couple of ways to convert this special Thrift type back to a javascript number. The easiest way:

    const count_n = Number(results[0].n);

    another way:

    const count_n = results[0].n.valueOf()

    The former is generally preferred as it would work universally for all returned numeric types (as long as the returned value can be represented by 64-bit floating pt)

    0
    Comment actions Permalink

Please sign in to leave a comment.