Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverflowError: unsigned integer not in range(0, 64), got 64 #1

Closed
Jeanbouvatt opened this issue Sep 16, 2021 · 3 comments
Closed

OverflowError: unsigned integer not in range(0, 64), got 64 #1

Jeanbouvatt opened this issue Sep 16, 2021 · 3 comments

Comments

@Jeanbouvatt
Copy link

Jeanbouvatt commented Sep 16, 2021

I got this message when trying to encode values :


values = [-0.39263690585168304, -0.39263690585168304, -0.39263690585168304, 0.450762617155903, 0.450762617155903, 0.450762617155903, -0.284155454538896]
values_encoder = gc.ValuesEncoder()
for v in values:
    print(v)
    values_encoder.encode_next(v)

This output :

-0.39263690585168304
-0.39263690585168304
-0.39263690585168304
0.450762617155903
0.450762617155903
0.450762617155903
-0.284155454538896

---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
/tmp/ipykernel_9713/2845470605.py in <module>
     10 for v in values:
     11     print(v)
---> 12     values_encoder.encode_next(v)

~/.local/lib/python3.8/site-packages/gorillacompression/values/encode.py in encode_next(self, value)
    118             # Encode length of the meaningful XORed value.
    119             length_of_the_meaningful_xored_value = self.n_bits_value - n_leading_zeros - n_trailing_zeros
--> 120             self.bit_array += util.int2ba(
    121                 length_of_the_meaningful_xored_value,
    122                 length=self.n_bits_length_of_the_meaningful_xored_value)

~/.local/lib/python3.8/site-packages/bitarray/util.py in int2ba(__i, length, endian, signed)
    267             raise OverflowError("unsigned integer not positive, got %d" % __i)
    268         if length and __i >= (1 << length):
--> 269             raise OverflowError("unsigned integer not in range(0, %d), "
    270                                 "got %d" % (1 << length, __i))
    271 

OverflowError: unsigned integer not in range(0, 64), got 64

Version 0.0.1

same problem with encode_all

@ghilesmeddour
Copy link
Owner

Hi @Jeanbouvatt

Thank you for reporting this. This is happening because I forgot to add the block size adjustment.

I'll fix it and cut a new release.

Thanks again

ghilesmeddour added a commit that referenced this issue Sep 16, 2021
ghilesmeddour added a commit that referenced this issue Sep 16, 2021
@ghilesmeddour
Copy link
Owner

@Jeanbouvatt It's done. Can you please update and confirm that it now works properly for you.

@Jeanbouvatt
Copy link
Author

I confirm it now works perfectly, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants