Skip to content

Bug with storing raw arrays #76

Description

@TomDLT

With @gxlilyBerkeley, we identified a bug when storing raw arrays, which was quite annoying.

If we upload some arrays and download them immediately, they might be changed in the process. We narrowed down the bug to the following conditions:

  • python 2
  • storing as raw arrays
  • large arrays (that trigger Zsdt compression)
  • non C-contiguous arrays

Here is a reproducing example:

import sys
import numpy as np
import cottoncandy as cc

# the bug is only in python 2
print(sys.version_info)

# create some large sparse data to be compressed
array_in = np.zeros((100, 100, 30000)).T
mask = np.random.randn(*array_in.shape) > 3
array_in[mask] = 1

# there is no bug if the array is contiguous in memory
if False:
    array_in = np.ascontiguousarray(array_in)

# store and load the array, using raw arrays
cci = cc.get_interface('tomdlt_tmp', verbose=False)
cci.upload_raw_array("test_array", array_in)
array_out = cci.download_raw_array("test_array")

# array_in and array_out are not identical
np.testing.assert_array_equal(array_in, array_out)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions