Comments (4)
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.
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.
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:
- 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 of5_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. - Should we update the tests for type
long
accordingly as well? - Again, these numbers aren't particularly large. Has nobody else run into these issues either?
from avro_ex.
NICE!
from avro_ex.
Related Issues (20)
- Fix dialyzer issues, run dialyzer in CI
- Support encoding AvroEx.Schema back to JSON
- Canonicalize schemas
- Semantic error messages
- Property test AvroEx HOT 1
- Better error for named top-level union HOT 1
- Change implementation of encodeable? HOT 2
- Records without a name fail poorly
- Records do not support logical types HOT 2
- Add a strict parsing mode HOT 1
- strict parsing should only allow known metadata fields
- Defaults with logicalTypes in them must be encoded as json
- Improve the quality of decode errors
- default values of `null` are removed from schema in `encode_schema` HOT 2
- Property test failure HOT 1
- Empty string for namespace makes `AvroEx.decode_schema/1` fail HOT 2
- Difference between encoding/decoding of avro_ex and avrora/erlavro HOT 1
- Expose AvroEx.Decode.decode HOT 9
- New release? HOT 1
- Array encode error if optional key is not presented HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avro_ex.