Skip to content

Commit

Permalink
Change big to BigInt calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins committed Jan 19, 2024
1 parent d45c99a commit cba6906
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/abstractdataframe/abstractdataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ function fillcombinations(df::AbstractDataFrame, indexcols;
end

# make sure we do not overflow in the target data frame size
target_rows = Int(prod(x -> big(length(x)), uniquevals))
target_rows = Int(prod(x -> BigInt(length(x)), uniquevals))
if iszero(target_rows)
@assert iszero(nrow(df))
cdf = copy(df)
Expand Down
3 changes: 1 addition & 2 deletions src/dataframe/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ function allcombinations(::Type{DataFrame}, pairs::Pair{Symbol, <:Any}...)
@assert length(colvalues) == length(colnames)
@assert all(x -> x isa AbstractVector, colvalues)

target_rows = Int(prod(x -> big(length(x)), colvalues))
target_rows = Int(prod(x -> BigInt(length(x)), colvalues))
out_df = DataFrame()
inner = 1
for (val, cname) in zip(colvalues, colnames)
Expand All @@ -1563,4 +1563,3 @@ function allcombinations(::Type{DataFrame}, pairs::Pair{Symbol, <:Any}...)
end

_try_select_no_copy(df::DataFrame, cols) = select(df, cols, copycols=false)

2 changes: 1 addition & 1 deletion src/groupeddataframe/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function refpool_and_array(x::AbstractArray)
else
minval, maxval = extrema(x)
end
ngroups = big(maxval) - big(minval) + 1
ngroups = BigInt(maxval) - BigInt(minval) + 1
# Threshold chosen with the same rationale as the row_group_slots! refpool method:
# refpool approach is faster but we should not allocate too much memory either
# We also have to avoid overflow, including with ngroups + 1 for missing values
Expand Down
4 changes: 2 additions & 2 deletions src/join/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function _innerjoin_unsorted_int(left::AbstractVector{<:Union{Integer, Missing}}
right::AbstractVector{<:Union{Integer, Missing}})
minv, maxv = extrema_missing(right)

val_range = big(maxv) - big(minv)
val_range = BigInt(maxv) - BigInt(minv)
if val_range > typemax(Int) - 3 || val_range ÷ 2 > max(64, length(right)) ||
minv < typemin(Int) + 2 || maxv > typemax(Int) - 3
return _innerjoin_unsorted(left, right)
Expand Down Expand Up @@ -648,7 +648,7 @@ function _semijoin_unsorted_int(left::AbstractVector{<:Union{Integer, Missing}},
right_shorter::Bool)
minv, maxv = extrema_missing(right)

val_range = big(maxv) - big(minv)
val_range = BigInt(maxv) - BigInt(minv)
if val_range > typemax(Int) - 3 || val_range ÷ 2 > max(64, length(right)) ||
minv < typemin(Int) + 2 || maxv > typemax(Int) - 3
return _semijoin_unsorted(left, right, seen_rows, right_shorter)
Expand Down

0 comments on commit cba6906

Please sign in to comment.