Skip to content

Commit 29612b8

Browse files
committed
_is_scalar only check if the vector is the same size as input
1 parent 0a5364a commit 29612b8

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/dataset/modify.jl

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -312,27 +312,28 @@ function modify!(ds::AbstractDataset, @nospecialize(args...); threads::Bool = tr
312312
end
313313

314314
# we must take care of all possible types, because, fallback is slow
315-
_is_scalar(::T, sz) where T <: Number = true
316-
_is_scalar(::Missing, sz) = true
317-
_is_scalar(::T, sz) where T <: Tuple = true
318-
_is_scalar(::TimeType, sz) = true
319-
_is_scalar(::T, sz) where T <: AbstractString = true
315+
# _is_scalar(::T, sz) where T <: Number = true
316+
# _is_scalar(::Missing, sz) = true
317+
# _is_scalar(::T, sz) where T <: Tuple = true
318+
# _is_scalar(::TimeType, sz) = true
319+
# _is_scalar(::T, sz) where T <: AbstractString = true
320+
_is_scalar(x, sz) = true
320321
_is_scalar(x::T, sz) where T <: AbstractVector = length(x) != sz
321322

322-
# TODO can we memorise this and avoid calling it repeatedly in a sesssion
323-
_is_scalar_barrier(::Val{T}) where T = hasmethod(size, (T,))
324-
325-
function _is_scalar(_res::T, sz) where T
326-
resize_col = false
327-
if _is_scalar_barrier(Val(T))
328-
if size(_res) == () || size(_res,1) != sz
329-
resize_col = true
330-
end
331-
else
332-
resize_col = true
333-
end
334-
return resize_col
335-
end
323+
# # TODO can we memorise this and avoid calling it repeatedly in a sesssion
324+
# _is_scalar_barrier(::Val{T}) where T = hasmethod(size, (T,))
325+
#
326+
# function _is_scalar(_res::T, sz) where T
327+
# resize_col = false
328+
# if _is_scalar_barrier(Val(T))
329+
# if size(_res) == () || size(_res,1) != sz
330+
# resize_col = true
331+
# end
332+
# else
333+
# resize_col = true
334+
# end
335+
# return resize_col
336+
# end
336337

337338
function _resize_result!(ds, _res, newcol)
338339
resize_col = _is_scalar(_res, nrow(ds))

0 commit comments

Comments
 (0)