From 0f326da5c6782bd8569d1159bb84543a9aa39f1c Mon Sep 17 00:00:00 2001 From: msl Date: Tue, 18 Jun 2024 13:32:47 +0200 Subject: [PATCH 1/3] this fixes bugs in 1.12 --- src/InMemoryDatasets.jl | 3 ++- src/byrow/row_functions.jl | 14 +++++++------- src/sort/gatherby.jl | 4 ++-- src/stat/hp_stat.jl | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/InMemoryDatasets.jl b/src/InMemoryDatasets.jl index 9c6a276..69fb69a 100644 --- a/src/InMemoryDatasets.jl +++ b/src/InMemoryDatasets.jl @@ -120,7 +120,8 @@ export update! - +SMALLSIGNED = Union{Int16, Int32, Int8} +SMALLUNSIGNED = Union{UInt16, UInt32, UInt8} include("other/index.jl") diff --git a/src/byrow/row_functions.jl b/src/byrow/row_functions.jl index 9642a81..2d7df23 100644 --- a/src/byrow/row_functions.jl +++ b/src/byrow/row_functions.jl @@ -34,8 +34,8 @@ function row_sum(ds::AbstractDataset, f::Function, cols = names(ds, Union{Missi CT = mapreduce(eltype, promote_type, view(_columns(ds),colsidx)) T = Core.Compiler.return_type(f, Tuple{CT}) CT = our_nonmissingtype(T) - CT <: Base.SmallSigned ? CT = Int : nothing - CT <: Base.SmallUnsigned ? CT = UInt : nothing + CT <: SMALLSIGNED ? CT = Int : nothing + CT <: SMALLUNSIGNED ? CT = UInt : nothing CT <: Bool ? CT = Int : nothing T = Union{Missing, CT} init0 = _missings(T, nrow(ds)) @@ -69,8 +69,8 @@ function row_prod(ds::AbstractDataset, f::Function, cols = names(ds, Union{Missi CT = mapreduce(eltype, promote_type, view(_columns(ds),colsidx)) T = Core.Compiler.return_type(f, Tuple{CT}) CT = our_nonmissingtype(T) - CT <: Base.SmallSigned ? CT = Int : nothing - CT <: Base.SmallUnsigned ? CT = UInt : nothing + CT <: SMALLSIGNED ? CT = Int : nothing + CT <: SMALLUNSIGNED ? CT = UInt : nothing CT <: Bool ? CT = Int : nothing T = Union{Missing, CT} init0 = _missings(T, nrow(ds)) @@ -744,9 +744,9 @@ function row_cumsum!(ds::Dataset, cols = names(ds, Union{Missing, Number}); miss colsidx = index(ds)[cols] T = mapreduce(eltype, promote_type, view(_columns(ds),colsidx)) if T <: Union{Missing, INTEGERS} - T <: Union{Missing, Base.SmallSigned} - T = T <: Union{Missing, Base.SmallSigned, Bool} ? Union{Int, Missing} : T - T = T <: Union{Missing, Base.SmallUnsigned} ? Union{Missing, UInt} : T + T <: Union{Missing, SMALLSIGNED} + T = T <: Union{Missing, SMALLSIGNED, Bool} ? Union{Int, Missing} : T + T = T <: Union{Missing, SMALLUNSIGNED} ? Union{Missing, UInt} : T end for i in colsidx if eltype(ds[!, i]) >: Missing diff --git a/src/sort/gatherby.jl b/src/sort/gatherby.jl index 694ece8..c914b74 100644 --- a/src/sort/gatherby.jl +++ b/src/sort/gatherby.jl @@ -248,8 +248,8 @@ end function gatherby_mapreduce(gds::GatherBy, f, op, col::ColumnIndex, nt, init, ::Val{T}; promotetypes = false, threads = true) where T CT = T if promotetypes - T <: Base.SmallSigned ? CT = Int : nothing - T <: Base.SmallUnsigned ? CT = UInt : nothing + T <: SMALLSIGNED ? CT = Int : nothing + T <: SMALLUNSIGNED ? CT = UInt : nothing end res = allocatecol(Union{CT, Missing}, gds.lastvalid) fill!(res, init) diff --git a/src/stat/hp_stat.jl b/src/stat/hp_stat.jl index c88861c..ed5d6aa 100644 --- a/src/stat/hp_stat.jl +++ b/src/stat/hp_stat.jl @@ -42,8 +42,8 @@ function hp_sum(f, x::AbstractVector{T}) where {T} cz = div(n, nt) cz == 0 && return stat_sum(f, x) CT = Core.Compiler.return_type(f, Tuple{our_nonmissingtype(eltype(x))}) - CT <: Base.SmallSigned ? CT = Int : nothing - CT <: Base.SmallUnsigned ? CT = UInt : nothing + CT <: SMALLSIGNED ? CT = Int : nothing + CT <: SMALLUNSIGNED ? CT = UInt : nothing CT <: Bool ? CT = Int : nothing if T >: Missing CT = Union{Missing,CT} From b8ec21bf3744a5d6f38fae73f643efc957a86698 Mon Sep 17 00:00:00 2001 From: msl Date: Fri, 23 Aug 2024 19:51:42 +0200 Subject: [PATCH 2/3] bug fix --- src/dataset/modify.jl | 2 +- src/stat/non_hp_stat.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dataset/modify.jl b/src/dataset/modify.jl index 61ccec2..adcc20d 100644 --- a/src/dataset/modify.jl +++ b/src/dataset/modify.jl @@ -255,7 +255,7 @@ function normalize_modify!(outidx::Index, idx, @nospecialize(sel::Pair{<:ColumnIndex, <:Vector{<:Base.Callable}})) colsidx = outidx[sel.first] - normalize_modify!(outidx, idx, colsidx .=> sel.second[i]) + normalize_modify!(outidx, idx, colsidx .=> sel.second) return res end diff --git a/src/stat/non_hp_stat.jl b/src/stat/non_hp_stat.jl index e0feee1..d44e3d7 100644 --- a/src/stat/non_hp_stat.jl +++ b/src/stat/non_hp_stat.jl @@ -119,7 +119,7 @@ function rescale(x, minx, maxx, minval, maxval) -(-maxx * minval + minx * maxval) / (maxx - minx) + (-minval + maxval) * x / (maxx - minx) end rescale(::Missing, minx, maxx, minval, maxval) = missing -rescale(x::Vector, minx, maxx, minval, maxval) = rescale.(x, minx, maxx, minval, maxval) +rescale(x::AbstractVector, minx, maxx, minval, maxval) = rescale.(x, minx, maxx, minval, maxval) rescale(x, minx, maxx) = rescale(x, minx, maxx, 0.0, 1.0) """ From b02dc59da12a92f41114b8cbee94b677f15f584f Mon Sep 17 00:00:00 2001 From: sl-solution <79064058+sl-solution@users.noreply.github.com> Date: Sat, 31 Aug 2024 15:37:36 +0000 Subject: [PATCH 3/3] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9bb3e2e..5684a27 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "InMemoryDatasets" uuid = "5c01b14b-ab03-46ff-b164-14c663efdd9f" authors = ["sl-solution and contributors"] -version = "0.7.20" +version = "0.7.21" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"