Skip to content

Commit a6496f5

Browse files
authored
fix bug in Julia-latest (#111)
* fix bug in Julia-latest * Update dscol.jl
1 parent 56be987 commit a6496f5

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/abstractdataset/dscol.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const SubOrDSCol = Union{SubDatasetColumn,DatasetColumn}
88
# isequal also use for == , since we don't want missing be annoying
99
Base.parent(col1::DatasetColumn) = col1.ds
1010

11+
Base.eachindex(col1::SubOrDSCol) = Base.axes1(col1)
12+
1113
Base.length(col1::SubOrDSCol) = length(__!(col1))
1214
Base.size(col1::SubOrDSCol) = size(__!(col1))
1315
Base.size(col1::SubOrDSCol, i::Integer) = size(__!(col1), i)
@@ -18,12 +20,14 @@ Base.eltype(col1::SubOrDSCol) = eltype(__!(col1))
1820
Base.ndims(col1::SubOrDSCol) = ndims(__!(col1))
1921
Base.ndims(::Type{<:SubDatasetColumn}) = 1
2022
Base.isassigned(col1::SubOrDSCol, i) = isassigned(__!(col1), i)
23+
# FIXME: unsafe method - an alias of col1 is out and it can be modified without any control
2124
Base.identity(col1::SubOrDSCol) = identity(__!(col1))
2225
Base.similar(col1::SubOrDSCol, args...) = similar(__!(col1), args...)
2326
Base.copy(col1::SubOrDSCol) = copy(__!(col1))
2427
Base.pairs(col1::SubOrDSCol) = pairs(IndexLinear(), __!(col1))
2528
Base.iterate(col1::SubOrDSCol, kwargs...) = iterate(__!(col1), kwargs...)
2629
PooledArrays.PooledArray(col1::SubOrDSCol; arg...) = PooledArray(__!(col1); arg...)
30+
# FIXME: unsafe when alias are created
2731
Base.convert(T::Type{<:AbstractVector}, col1::SubOrDSCol) = convert(T, __!(col1))
2832
DataAPI.refarray(col::SubOrDSCol) = DataAPI.refarray(__!(col))
2933
DataAPI.refpool(col::SubOrDSCol) = DataAPI.refpool(__!(col))

src/byrow/util.jl

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ end
296296
return pos
297297
end
298298

299+
# before Julia 1.10 these functions where defined in Ryu, however, they moved to Base and their syntax has changed.
300+
# we only use them here so we define them for our purpose
301+
_memcpy(d, doff, s, soff, n) = (ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), d + doff - 1, s + soff - 1, n); nothing)
302+
_memmove(d, doff, s, soff, n) = (ccall(:memmove, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), d + doff - 1, s + soff - 1, n); nothing)
303+
299304
### From Base.Ryu, because we need buf to be View of an array not vector (maybe we should change it in Ryu?)
300305
function _writeshortest(buf, pos, x::T,
301306
plus=false, space=false, hash=true,
@@ -436,10 +441,10 @@ function _writeshortest(buf, pos, x::T,
436441
c1 = (c ÷ 100) << 1
437442
d0 = (d % 100) << 1
438443
d1 = (d ÷ 100) << 1
439-
Base.Ryu.memcpy(ptr, pos + olength - 2, ptr2, c0 + 1, 2)
440-
Base.Ryu.memcpy(ptr, pos + olength - 4, ptr2, c1 + 1, 2)
441-
Base.Ryu.memcpy(ptr, pos + olength - 6, ptr2, d0 + 1, 2)
442-
Base.Ryu.memcpy(ptr, pos + olength - 8, ptr2, d1 + 1, 2)
444+
_memcpy(ptr, pos + olength - 2, ptr2, c0 + 1, 2)
445+
_memcpy(ptr, pos + olength - 4, ptr2, c1 + 1, 2)
446+
_memcpy(ptr, pos + olength - 6, ptr2, d0 + 1, 2)
447+
_memcpy(ptr, pos + olength - 8, ptr2, d1 + 1, 2)
443448
i += 8
444449
end
445450
output2 = output % UInt32
@@ -448,14 +453,14 @@ function _writeshortest(buf, pos, x::T,
448453
output2 = div(output2, UInt32(10000))
449454
c0 = (c % 100) << 1
450455
c1 = (c ÷ 100) << 1
451-
Base.Ryu.memcpy(ptr, pos + olength - i - 2, ptr2, c0 + 1, 2)
452-
Base.Ryu.memcpy(ptr, pos + olength - i - 4, ptr2, c1 + 1, 2)
456+
_memcpy(ptr, pos + olength - i - 2, ptr2, c0 + 1, 2)
457+
_memcpy(ptr, pos + olength - i - 4, ptr2, c1 + 1, 2)
453458
i += 4
454459
end
455460
if output2 >= 100
456461
c = (output2 % UInt32(100)) << 1
457462
output2 = div(output2, UInt32(100))
458-
Base.Ryu.memcpy(ptr, pos + olength - i - 2, ptr2, c + 1, 2)
463+
_memcpy(ptr, pos + olength - i - 2, ptr2, c + 1, 2)
459464
i += 2
460465
end
461466
if output2 >= 10
@@ -498,7 +503,7 @@ function _writeshortest(buf, pos, x::T,
498503
end
499504
else
500505
pointoff = olength - abs(nexp)
501-
Base.Ryu.memmove(ptr, pos + pointoff + 1, ptr, pos + pointoff, olength - pointoff + 1)
506+
_memmove(ptr, pos + pointoff + 1, ptr, pos + pointoff, olength - pointoff + 1)
502507
buf[pos + pointoff] = decchar
503508
pos += olength + 1
504509
precision -= olength
@@ -543,11 +548,11 @@ function _writeshortest(buf, pos, x::T,
543548

544549
if exp2 >= 100
545550
c = exp2 % 10
546-
Base.Ryu.memcpy(ptr, pos, ptr2, 2 * div(exp2, 10) + 1, 2)
551+
_memcpy(ptr, pos, ptr2, 2 * div(exp2, 10) + 1, 2)
547552
buf[pos + 2] = UInt8('0') + (c % UInt8)
548553
pos += 3
549554
elseif exp2 >= 10
550-
Base.Ryu.memcpy(ptr, pos, ptr2, 2 * exp2 + 1, 2)
555+
_memcpy(ptr, pos, ptr2, 2 * exp2 + 1, 2)
551556
pos += 2
552557
else
553558
if padexp

0 commit comments

Comments
 (0)