marklogic-community / marklogic-nifi-incubator

A collaboration space for processors, recipes, templates, etc. NOTE: improvements made to the connector in this project have been incorporated into the MarkLogic NiFi repository (https://github.com/marklogic/nifi).
Apache License 2.0
4 stars 11 forks source link

putMarkLogic process changing value of attribute to a constant of -9223372036836040000 #64

Closed marams closed 4 years ago

marams commented 4 years ago

putMarkLogic process is defaulting value to -9223372036836040000 when the values is -92233720368360XXXXX , this is true for all the values that are -92233720368360XXXXX.

In my flow process I am picking up value from a file and writing to MarkLogic, in the queue before putMarkLogic process I can see that the value is showing up correctly, but when it writes to MarkLogic the value is showing up a constant of -9223372036836040000

WrongValueInML CorrectValueinQueueBeforePutML CorrectValueinQueueBeforePutML-02

.

Any workaround / help is highly appreciated.

sjiang99 commented 4 years ago

In JavaScript, the Number type is a double-precision 64-bit binary format IEEE 754 value (numbers between -(2^53 − 1) and 2^53 − 1). You can check the "safe" integer range. Type "Number.MIN_SAFE_INTEGER" in Query Console produces a result of "-9007199254740991", which is "smaller" than -9223372036836040000. Nothing to change in the process. My guess is your used Java Long to generate that number, which has a different min/max range. Couple of thoughts for your fix:

  1. Change the id generator so that numbers fall within the safe range, or
  2. Change the id type to string by double-quoting it (and you must not convert it back to number afterwards)