File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,25 @@ macro select(v,expression)
251
251
return Expr (:call ,:select ,esc (v),args... )
252
252
end
253
253
254
+
255
+
256
+ # transform the ranges if possible to avoid issue
257
+ # https://github.com/meggart/DiskArrays.jl/issues/138
258
+ # for the most common case
259
+ _maybetorange (v) = v
260
+ function _maybetorange (v:: AbstractVector )
261
+ if isempty (v)
262
+ return v
263
+ end
264
+
265
+ r = v[begin ]: v[end ]
266
+ if v == r
267
+ return r
268
+ else
269
+ return v
270
+ end
271
+ end
272
+
254
273
"""
255
274
vsubset = CommonDataModel.select(v,param1 => condition1, param2 => condition2,...)
256
275
dssubset = CommonDataModel.select(ds,param1 => condition1, param2 => condition2,...)
@@ -334,9 +353,9 @@ function select(v,conditions...)
334
353
end
335
354
336
355
if v isa AbstractArray
337
- view (v, indices... )
356
+ view (v, _maybetorange .( indices) ... )
338
357
else
339
- view (v; indices... )
358
+ view (v; ((k => _maybetorange (v)) for (k,v) in indices) . .. )
340
359
end
341
360
end
342
361
You can’t perform that action at this time.
0 commit comments