Skip to content

Remove Int and Double boxing #113

Description

@rakyll

We don't seem to need to provide boxing to be more precise. Current way of detecting double numbers seem to be working fine. I want to remove Int and Double custom types for cleanup.

Does it sound good?

Activity

  1. added this to the milestone on Aug 15, 2014
  2. silvolu commented on Aug 15, 2014

    @silvolu
    Contributor

    SGTM.

  3. stephenplusplus commented on Aug 15, 2014

    @stephenplusplus
    Contributor

    Isn't boxing them the only way we do the detection? https://github.com/GoogleCloudPlatform/gcloud-node/blob/master/lib/datastore/entity.js#L208-215:

    if (v instanceof Int) {
      p.integerValue = v.get();
      return p;
    }
    if (v instanceof Double) {
      p.doubleValue = v.get();
      return p;
    }

    If we remove them, how would a user specify they want a double?

  4. rakyll commented on Aug 15, 2014

    @rakyll
    ContributorAuthor

    There would be no explicit way to force a field to be double. If it's not a floating point number, we will persist it as uint64 in the backend.

    I'm wondering about the impact it has to the backend and indexing. cc/ @pcostell

  5. pcostell commented on Aug 15, 2014

    @pcostell
    Contributor

    Unfortunately indexing uses property type to determine order: https://developers.google.com/appengine/docs/java/datastore/indexes#Java_Properties_with_mixed_value_types

    When two entities have properties of the same name but different value types, an index of the property sorts the entities first by value type and then by a secondary ordering appropriate to each type. For example, if two entities each have a property named age, one with an integer value and one with a string value, the entity with the integer value always precedes the one with the string value when sorted by the age property, regardless of the property values themselves.

  6. rakyll commented on Aug 15, 2014

    @rakyll
    ContributorAuthor

    Ah, an immediate WONTFIX then. Thanks.

  7. modified the milestones: , Core Stable on Feb 2, 2015
  8. 57 remaining items

  9. added a commit that references this issue on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.coretriage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions