Giter Club home page Giter Club logo

Comments (4)

mvollmary avatar mvollmary commented on June 24, 2024 1

My first point against this change was that you can't work properly in AQL with this anymore, but then I realized that you can type cast it in AQL with TO_NUMBER(value) but then you will have data loss. But that same argument is true when we save them as long and double :-)

So I think, from the point of avoiding data loss, we should serialize it as String 👍

With the change on the deserializers I also see no real pain point with backward compatibility.

from java-velocypack.

mvollmary avatar mvollmary commented on June 24, 2024

Hi @christian-lechner,

Yes that's right. I am not 100% satisfied with the current solution. At the time of the initial implementation I was guided by Jackson, which also serialize BigInteger and BigDecimal as numbers.

On the one hand, this is not really a big deal because you can just register a custom VPackSerializer when you need to serialize them as String, on the other hand we might want to offer a more convenient way to change the serialized type for BigInteger and BigDecimal.

A quick search on google shows what possibilities you have with Jackson.

  • converting the type in the getter (no option for us because we're not using setter/getter for serialization)
  • use a custom serializer by registering a module (which we can already do)
  • use a custom serializer by using annotation JsonSerialize (providing that kind of annotation is already on my todo list)

I am open to suggestions. Should we change the default to String or just document how the default behavior is and how to easily change it with a custom VPackSerializer.

What we can do in any case is to make the deserializer for BigInteger and BigDecimal compatible with both number and String.

best
Mark

from java-velocypack.

christian-lechner avatar christian-lechner commented on June 24, 2024

That's not an easy question. But considering that the reason why BigInteger and BigDecimal exist is that they can store much larger and more accurate numbers, then we have to ask if it makes sense to reduce them to long and double. Doesn't this make the use of both senseless?

What we can do in any case is to make the deserializer for BigInteger and BigDecimal compatible with both number and String.

I totally agree with that.

from java-velocypack.

mvollmary avatar mvollmary commented on June 24, 2024

fixen in 1.1.0

from java-velocypack.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.