Giter Site home page Giter Site logo

Comments (4)

tr00gle avatar tr00gle commented on May 18, 2024

Disregard Question 3: I commented out the @spec and @spec_match and ran the tests as is in the source: they work.

Then, I changed 5_000_000 to 500_000_000 and received the argument error again:

  1) test decode (primitive) integer (AvroEx.Decode.Test)
     test/decode_test.exs:22
     ** (ArgumentError) argument error
     code: assert {:ok, 500_000_000} = @test_module.decode(schema, big)
     stacktrace:
       (avro_ex 1.1.0) lib/avro_ex/decode.ex:238: AvroEx.Decode.variable_integer_decode/3
       (avro_ex 1.1.0) lib/avro_ex/decode.ex:64: AvroEx.Decode.do_decode/3
       (avro_ex 1.1.0) lib/avro_ex/decode.ex:12: AvroEx.Decode.decode/2
       test/decode_test.exs:33: (test)

from avro_ex.

tr00gle avatar tr00gle commented on May 18, 2024

Ok, so after a bunch more research, it seems that the threshold is 134_217_727.

134_217_727 passes, but 134_217_728 fails. What are the constraints here that it's written this way? Would it be possible to catch these argument errors and treat them as type long automatically? I'm not sure what the potential ramifications are here, but I'm happy to research/do whatever I can to assist.

from avro_ex.

tr00gle avatar tr00gle commented on May 18, 2024

After more research, and studying the avro-official decoding/encoding implementations in ruby and javascript, and it seems like the implemented logic in this library is pretty similar, except swapping while loops for recursive calls. A key difference is that the ruby implementation is that the integer-related logic delegates to the same logic for type long, and I wonder if that might be helpful here?

Also, the inability to decode integers that have an absolute value larger than 134_217_727 seems like an unexpectedly low threshold still. A few more follow up questions:

  1. Since tests tend serve as a form of documentation, would it be appropriate to update the test cases for decoding integers to use the value 134_217_727 instead of 5_000_000? I have a branch and commit ready to go, but if it's not something we want, I won't open a PR.
  2. Should we update the tests for type long accordingly as well?
  3. Again, these numbers aren't particularly large. Has nobody else run into these issues either?

from avro_ex.

tr00gle avatar tr00gle commented on May 18, 2024

NICE!

from avro_ex.

Related Issues (20)

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.