Skip to content

Commit 7065372

Browse files
committed
fix issue pandas-dev#135
1 parent 7a4c9c5 commit 7065372

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

arctic/chunkstore/chunkstore.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,17 @@ def read(self, symbol, chunk_range=None):
116116
"""
117117

118118
sym = self._get_symbol_info(symbol)
119-
120119
if not sym:
121120
raise NoDataFoundException('No data found for %s in library %s' % (symbol, self._collection.get_name()))
122121

123122
spec = {'symbol': symbol,
124123
}
125124

126-
if chunk_range is not None:
125+
if chunk_range:
127126
spec['start'] = self.chunker.to_mongo(chunk_range)
128127

129128
segments = []
130-
i = -1
131-
for i, x in enumerate(self._collection.find(spec, sort=[('start', pymongo.ASCENDING)],)):
129+
for _, x in enumerate(self._collection.find(spec, sort=[('start', pymongo.ASCENDING)],)):
132130
segments.append(decompress(x['data']))
133131

134132
data = b''.join(segments)
@@ -169,10 +167,9 @@ def write(self, symbol, item, chunk_size):
169167

170168
previous_shas = []
171169
if self._get_symbol_info(symbol):
172-
previous_shas = set([x['sha'] for x in self._collection.find({'symbol': symbol},
170+
previous_shas = set([Binary(x['sha']) for x in self._collection.find({'symbol': symbol},
173171
projection={'sha': True, '_id': False},
174172
)])
175-
176173
records = []
177174
ranges = []
178175
dtype = None
@@ -205,6 +202,7 @@ def write(self, symbol, item, chunk_size):
205202
chunk['end'] = end
206203
chunk['symbol'] = symbol
207204
chunk['sha'] = checksum(symbol, chunk)
205+
208206
if chunk['sha'] not in previous_shas:
209207
op = True
210208
bulk.find({'symbol': symbol, 'sha': chunk['sha']},

arctic/store/_ndarray_store.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def _do_write(self, collection, version, symbol, item, previous_version, segment
391391

392392
previous_shas = []
393393
if previous_version:
394-
previous_shas = set([x['sha'] for x in
394+
previous_shas = set([Binary(x['sha']) for x in
395395
collection.find({'symbol': symbol},
396396
projection={'sha': 1, '_id': 0},
397397
)

0 commit comments

Comments
 (0)