You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the union types are tried in-order, the num-coercable? function used for type-guarding ints and longs runs first, causing all our floats/doubles to cast to integers when serializing to avro.
Replacing the implementation with the following, fixes it:
(defnint-coercable?"Checks whether `x` can be coerced to a integer with `coercion-fn` (such as `long`)."
[x coercion-fn]
(try
(and (integer? x)
(coercion-fn (bigint x)))
(catch RuntimeException _e
false)))
(def ^:deprecated num-coercable?int-coercable?
The text was updated successfully, but these errors were encountered:
We have a schema which is admittedly wonky and there's a field with the union type declared in this order:
Because the union types are tried in-order, the
num-coercable?
function used for type-guarding ints and longs runs first, causing all our floats/doubles to cast to integers when serializing to avro.Replacing the implementation with the following, fixes it:
The text was updated successfully, but these errors were encountered: