Skip to content

Long type user input coercion missing implicit conversion from java.math.BigDecimal #995

@majjhima

Description

@majjhima

We have been using Long type variables for output in our schema, but after adding an input variable of type Long, I would get an error message like:

Variable '$timestamp' expected value of type 'Long' but got: 1680746052401. Reason: Long value expected

After copying the LongType implicit conversion code to create a custom implicit val TimestampType: ScalarType[Long] and adding some debug output to test the user input datatype, I found:

Invalid Timestamp coerceUserInput, expected type Long, but got type class java.math.BigDecimal

The existing code has:

      case d: BigDecimal if d.isValidLong => Right(d.longValue)

but actually seems to need something like:

      case d: java.math.BigDecimal if BigDecimal(d).isValidLong => Right(d.longValue)

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