Special values in Synapse

Special values in Synapse

This document is an attempt to capture how special values like None/NULL/NA/NaN/Inf/-Inf are handled in PLFM and across different clients as of today.

Questions: should this be available in REST and client docs, and keeping them updated there?

Background

There are several feature in Synapse that support floating point values like Annotations on Entity, Annotations on Submissions, and Table.

Since File View and Project View display File's and Project's annotations, there is a conversion between Annotations on Entity to Table Column Type.

Java

Since PLFM is written in Java, the backend, we depends on what Java supports.

Java supports NULL for all types.

Java has Double.POSITIVE_INFINITY, Double.NEGATIVE_INFITIVE, and Double.NaN.

Python

Python uses None (NoneType) for NULL values.

Python supports NaN, Inf and -Inf for floating point values. 

R

R uses NULL for NULL values.

R supports NaN, Inf, and -Inf for numeric values.

R also use NA for "Not Available" values.

References:

Annotations

API 

At the API level, an annotation on an entity can have the following types:

  • String

  • byte[]

  • Long

  • Double

  • Date

Client Behaviors

The below experiments are done on Double on the following services:

Client

Empty value

NULL

None

NA

NaN

Inf

-Inf

Date

Client

Empty value

NULL

None

NA

NaN

Inf

-Inf

Date

curl (repo-201)

PUT

GET

Empty list

PUT

GET

Not applicable

Not applicable

PUT

GET

PUT

GET

"Infinity" or "+Infinity"

PUT

GET

"-Infinity"

10/19/2017

web client (201)

PUT

GET

PUT

 

Not applicable

Not applicable

PUT

GET

PUT

GET

"Infinity" or "+Infinity"

PUT

GET

"-Infinity"

10/20/2017

python (synapseclient_1.7.2)

Not applicable

 

Not applicable

PUT

GET

Becomes string

Not applicable

PUT

GET

PUT

GET

PUT

GET

10/20/2017

old r client 

Not applicable

PUT

Not applicable

PUT

PUT

PUT

PUT

10/23/2017

synapser

Not applicable

PUT

Not applicable

PUT

GET

Becomes "None"

PUT

GET

PUT

GET

PUT

GET

10/23/2017

Related Jira Tickets

Submission Annotations

API

At the API level, an annotation on a submission has the following types:

  • StringAnnotation

  • DoubleAnnotation

  • LongAnnotation

Client Behaviors

The below experiements are done on DoubleAnnotation on the following services:

Client

Empty value

NULL

None

NA

NaN

Inf

-Inf

Date

Client

Empty value

NULL

None

NA

NaN

Inf

-Inf

Date

curl (repo-201)

PUT

GET

'value' is not set

PUT

GET

Not applicable

Not applicable

PUT

GET

PUT

GET

"Infinity" or "+Infinity"

PUT

GET

"-Infinity"

10/19/2017

web client (201)

Not supported

10/20/2017

python (synapseclient_1.7.2)

PUT

GET

Not applicable

PUT

GET

Becomes empty

Not applicable

PUT

GET

PUT

GET

"Infinity" or "+Infinity"

PUT

GET

"-Infinity"

10/23/2017

old r client

PUT

PUT

Not applicable

PUT

PUT

PUT

PUT

10/23/2017

synapser

PUT

GET

PUT

Not applicable

PUT

GET

Becomes empty

PUT

GET

PUT

GET

"Infinity" or "+Infinity"

PUT

GET

"-Infinity"

10/23/2017

Table

API

At the API level, a table column has the following types:

  • STRING

  • DOUBLE

  • INTEGER

  • BOOLEAN

  • DATE

  • FILEHANDLEID

  • ENTITYID

  • LINK

  • LARGETEXT

  • USERID

Client Behaviors

The below experiments are done on DOUBLE on the following services:

Client

Empty value

NULL

None

NA

NaN

Inf

-Inf

Date

Client

Empty value

NULL

None

NA

NaN

Inf

-Inf

Date

curl (repo-201)

update

query

"" becomes NULL

update

query

Not applicable

Not applicable

update

query

update

query

Becomes "Infinity" or "+Infinity"

update

query

Becomes "-Infinity"

10/23/2017

web client (201)

update

query

update

Not applicable

Not applicable

update

query

update

query

"Infinity" or "+Infinity"

update

query

"-Infinity"

10/20/2017

python (synapseclient_1.7.2)

Not applicable

Not applicable

update

query

Not applicable

update

query

update

query

update

query

10/23/2017

old r client

 

 

 

 

 

 

 

 

synapser

Not applicable

Not applicable

Not applicable

update

query

Becomes NULL

update

query

update

query

Becomes "Infinity" or "+Infinity"

update

query

Becomes "-Infinity"

10/23/2017

The below experiments are done on DOUBLE on the following services:

Client

Empty Value

NULL

None

NA

NaN

Inf

-Inf

Date

Client

Empty Value

NULL

None

NA

NaN

Inf

-Inf

Date

curl (repo-201)

 

 

 

 

 

 

 

 

web client (201)

update

query

Ignore empty rows

update

Not applicable

Not applicable

update

query

update

query

When query, returns "Infinity"

update

query

When retrieved, returns "-Infinity"

10/20/2017

python (synapseclient_1.7.2)

update

Can be uploaded from csv, cannot be read from Pandas

Not applicable

update

Lost in Pandas for row with only None, and becomes NaN in float column

Not applicable

update

query

Pandas writes NaN as empty values to csv, but can read NaN from csv

update

query

float inf turns into "Infinity"

update

query

float --inf turns into "-Infinity"

10/20/2017

old r client

Not applicable

Not applicable

Not applicable

update

query

update

query

update

query

update

query

10/23/2017

synapser

Not applicable

Not applicable

Not applicable

update