@@ -1077,25 +1077,26 @@ function _fill_dict_and_add!(init0, dict, prehashed, n, p)
10771077 end
10781078end
10791079
1080- function row_nunique (ds:: AbstractDataset , f:: Function , cols = names (ds, Union{Missing, Number}); count_missing = true )
1081- colsidx = multiple_getindex (index (ds), cols)
1082- prehashed = Matrix {_Prehashed} (undef, size (ds,1 ), length (colsidx))
1083- allcols = view (_columns (ds),colsidx)
1084-
1085- for j in 1 : size (prehashed,2 )
1086- _fill_prehashed! (prehashed, allcols[j], f, size (ds,1 ), j)
1087- end
1088-
1089- init0 = zeros (Int32, size (ds,1 ))
1090- dict = Dict {_Prehashed, Nothing} ()
1091- _fill_dict_and_add! (init0, dict, prehashed, size (ds,1 ), length (colsidx))
1092- if count_missing
1093- return init0
1094- else
1095- return init0 .- row_any (ds, ismissing, cols)
1096- end
1097- end
1098- row_nunique (ds:: AbstractDataset , cols = names (ds, Union{Missing, Number}); count_missing = true ) = row_nunique (ds, identity, cols; count_missing = count_missing)
1080+ # This is not working - because we only the hash values and in many cases like 2.1 and 4611911198408756429 the hash is the same
1081+ # function row_nunique(ds::AbstractDataset, f::Function, cols = names(ds, Union{Missing, Number}); count_missing = true)
1082+ # colsidx = multiple_getindex(index(ds), cols)
1083+ # prehashed = Matrix{_Prehashed}(undef, size(ds,1), length(colsidx))
1084+ # allcols = view(_columns(ds),colsidx)
1085+
1086+ # for j in 1:size(prehashed,2)
1087+ # _fill_prehashed!(prehashed, allcols[j], f, size(ds,1), j)
1088+ # end
1089+
1090+ # init0 = zeros(Int32, size(ds,1))
1091+ # dict = Dict{_Prehashed, Nothing}()
1092+ # _fill_dict_and_add!(init0, dict, prehashed, size(ds,1), length(colsidx))
1093+ # if count_missing
1094+ # return init0
1095+ # else
1096+ # return init0 .- row_any(ds, ismissing, cols)
1097+ # end
1098+ # end
1099+ # row_nunique(ds::AbstractDataset, cols = names(ds, Union{Missing, Number}); count_missing = true) = row_nunique(ds, identity, cols; count_missing = count_missing)
10991100
11001101Base. @propagate_inbounds function _op_for_hash! (x, y, f, lo, hi)
11011102 @simd for i in lo: hi
0 commit comments