Skip to content

Commit da823dd

Browse files
committed
bug fix
1 parent 7d3ab5b commit da823dd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/byrow/util.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ end
133133
function write_vals!(a, pos, ::Missing)
134134
pos
135135
end
136+
function write_vals!(a, pos, ::Nothing)
137+
pos
138+
end
136139

137140

138141
function write_vals!(a, pos, x::AbstractString)
@@ -183,15 +186,18 @@ function write_quotechar!(a, pos, quotechar)
183186
a[pos] = quotechar
184187
pos+1
185188
end
186-
189+
function write_quotechar!(a, pos, ::Nothing)
190+
pos
191+
end
187192

188193

189194
function _base!(a, pos, base::Integer, x::Integer, pad::Int, neg::Bool)
190195
(x >= 0) | (base < 0) || throw(DomainError(x, "For negative `x`, `base` must be negative."))
191196
2 <= abs(base) <= 62 || throw(DomainError(base, "base must satisfy 2 ≤ abs(base) ≤ 62"))
192197
b = (base % Int)::Int
193198
digits = abs(b) <= 36 ? Base.base36digits : Base.base62digits
194-
n = neg + ndigits(x, base=b, pad=pad)
199+
# pad = 0 makes issue when x == 0 (n will be 0)
200+
n = neg + ndigits(x, base=b)
195201
i = n
196202
@inbounds while i > neg
197203
if b > 0
@@ -222,7 +228,11 @@ function _op_for_row_join!(buffer, currentpos, y, f, delim, quotechar, idx, p)
222228
end
223229
end
224230
else
225-
quotecharval = UInt8(quotechar)
231+
if nonmissingtype(eltype(y)) <: AbstractString
232+
quotecharval = UInt8(quotechar)
233+
else
234+
quotecharval = nothing
235+
end
226236
if idx[]<p
227237
Threads.@threads for i in 1:length(y)
228238
currentpos[i] = write_quotechar!(view(buffer, :, i), currentpos[i], quotecharval)

0 commit comments

Comments
 (0)