Skip to content

Strange behavior with integer number literals being returned as objects {high: 23, low: 0} #122

Closed
@adrianseeley

Description

@adrianseeley
package: "neo4j-driver": "^1.1.0-M01"
node: v6.2.1

I'm creating a new node in Neo4J using the following from NodeJS, noting that the property 'datapoints' is a number literal:

CREATE (a:pipeline)
    SET a.uuid       = {uuid},
        a.type       = "datasource",
        a.datapoints = 0,
        a.normalized = {normalized},
        a.headers    = {headers},
        a.types      = {types},
        a.t_created  = {now}
RETURN a

Now when I go to lookup that node using the following statement I get different results from the Neo4J browser and NodeJS driver:

MATCH (a:pipeline)
RETURN a

If I run this statement from the Neo4J browser I get a response as expected where datapoints is indeed a number:

{
  "records": [
    {
      "keys": [
        "a"
      ],
      "length": 1,
      "_fields": [
        {
          "identity": "37225",
          "labels": [
            "pipeline"
          ],
          "properties": {
            "headers": [
              "dt",
              "h"
            ],
            "datapoints": "0",
            "types": [
              "Date",
              "Float"
            ],
            "normalized": false,
            "type": "datasource",
            "t_created": 1472143439959,
            "uuid": "1472143439959.562064"
          },
          "id": "37225"
        }
      ],
      "_fieldLookup": {
        "a": 0
      }
    }
  ],
  "summary": {
    "statement": {
      "text": "MATCH (a:pipeline)\nRETURN a",
      "parameters": {}
    },
    "statementType": "r",
    "updateStatistics": {
      "_stats": {
        "nodesCreated": 0,
        "nodesDeleted": 0,
        "relationshipsCreated": 0,
        "relationshipsDeleted": 0,
        "propertiesSet": 0,
        "labelsAdded": 0,
        "labelsRemoved": 0,
        "indexesAdded": 0,
        "indexesRemoved": 0,
        "constraintsAdded": 0,
        "constraintsRemoved": 0
      }
    },
    "plan": false,
    "profile": false,
    "notifications": []
  },
  "responseTime": 316
}

However when I run the same statement using the NodeJS package I get an unexpected object for datapoints:

{
   "records": [
      {
         "keys": [
            "a"
         ],
         "length": 1,
         "_fields": [
            {
               "identity": {
                  "low": 37225,
                  "high": 0
               },
               "labels": [
                  "pipeline"
               ],
               "properties": {
                  "headers": [
                     "dt",
                     "h"
                  ],
                  "datapoints": {
                     "low": 0,
                     "high": 0
                  },
                  "types": [
                     "Date",
                     "Float"
                  ],
                  "normalized": false,
                  "type": "datasource",
                  "t_created": 1472143439959,
                  "uuid": "1472143439959.562064"
               }
            }
         ],
         "_fieldLookup": {
            "a": 0
         }
      }
   ],
   "summary": {
      "statement": {
         "text": "MATCH (a:pipeline)\r\nRETURN a",
         "parameters": {}
      },
      "statementType": "r",
      "updateStatistics": {
         "_stats": {
            "nodesCreated": 0,
            "nodesDeleted": 0,
            "relationshipsCreated": 0,
            "relationshipsDeleted": 0,
            "propertiesSet": 0,
            "labelsAdded": 0,
            "labelsRemoved": 0,
            "indexesAdded": 0,
            "indexesRemoved": 0,
            "constraintsAdded": 0,
            "constraintsRemoved": 0
         }
      },
      "plan": false,
      "profile": false,
      "notifications": []
   }
}

The result seems to be same for setting the property's value to any integer literal value, however setting the property's value to a floating point literal value (other than 0.0) behaves as expected:

{
   "records": [
      {
         "keys": [
            "a"
         ],
         "length": 1,
         "_fields": [
            {
               "identity": {
                  "low": 37253,
                  "high": 0
               },
               "labels": [
                  "pipeline"
               ],
               "properties": {
                  "headers": [
                     "dt",
                     "h"
                  ],
                  "datapoints": 0.1,
                  "types": [
                     "Date",
                     "Float"
                  ],
                  "normalized": false,
                  "type": "datasource",
                  "t_created": 1472143956047,
                  "uuid": "1472143956047.414768"
               }
            }
         ],
         "_fieldLookup": {
            "a": 0
         }
      }
   ],
   "summary": {
      "statement": {
         "text": "MATCH (a:pipeline)\r\nRETURN a",
         "parameters": {}
      },
      "statementType": "r",
      "updateStatistics": {
         "_stats": {
            "nodesCreated": 0,
            "nodesDeleted": 0,
            "relationshipsCreated": 0,
            "relationshipsDeleted": 0,
            "propertiesSet": 0,
            "labelsAdded": 0,
            "labelsRemoved": 0,
            "indexesAdded": 0,
            "indexesRemoved": 0,
            "constraintsAdded": 0,
            "constraintsRemoved": 0
         }
      },
      "plan": false,
      "profile": false,
      "notifications": []
   }
}

I considered that it may be the name of my property that was causing the issue, and can add that any property name is currently having this effect. Is this maybe the result of a database corruption?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions