Skip to content

Commit eb3f54c

Browse files
committed
bug fix
1 parent 14f2e00 commit eb3f54c

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/byrow/byrow.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,18 @@ function byrow(ds::AbstractDataset, f::Function, cols::MultiColumnIndex; threads
203203
length(colsidx) == 1 && return byrow(ds, f, colsidx[1]; threads = threads)
204204
threads ? hp_row_generic(ds, f, cols) : row_generic(ds, f, cols)
205205
end
206-
function byrow(ds::AbstractDataset, f::Function, col::ColumnIndex; threads = nrow(ds)>1000, forcemissing::Bool = true)
206+
function byrow(ds::AbstractDataset, f::Function, col::ColumnIndex; threads = nrow(ds)>1000, allowmissing::Bool = true)
207207
if threads
208208
T = Core.Compiler.return_type(f, Tuple{nonmissingtype(eltype(ds[!, col]))})
209-
if forcemissing
209+
if allowmissing
210210
res = Vector{Union{Missing, T}}(undef, nrow(ds))
211211
else
212212
res = Vector{T}(undef, nrow(ds))
213213
end
214214
_hp_map_a_function!(res, f, _columns(ds)[index(ds)[col]])
215215
else
216216
T = Core.Compiler.return_type(f, Tuple{nonmissingtype(eltype(ds[!, col]))})
217-
if forcemissing
217+
if allowmissing
218218
res = Vector{Union{Missing, T}}(undef, nrow(ds))
219219
else
220220
res = Vector{T}(undef, nrow(ds))

src/dataset/transpose.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ function flatten!(ds::Dataset,
782782
else
783783
push!(all_idxcols, _columns(ds)[col1])
784784
end
785-
lengths = byrow(Dataset(all_idxcols, [:x], copycols = false), _LENGTH, 1, threads = threads, forcemissing = false)
785+
lengths = byrow(Dataset(all_idxcols, [:x], copycols = false), _LENGTH, 1, threads = threads, allowmissing = false)
786786
if length(idxcols) > 1
787787
for col in 2:length(idxcols)
788788
if mapformats
@@ -827,6 +827,7 @@ function flatten!(ds::Dataset,
827827
deleteat!(_columns(ds), idxcols_sorted[col])
828828
insert!(_columns(ds), idxcols_sorted[col], _res)
829829
end
830+
removeformat!(ds, idxcols_sorted[col])
830831
end
831832
_reset_grouping_info!(ds)
832833
_modified(_attributes(ds))
@@ -848,7 +849,7 @@ function flatten(ds::AbstractDataset,
848849
else
849850
push!(all_idxcols, _columns(ds)[col1])
850851
end
851-
lengths = byrow(Dataset(all_idxcols, [:x], copycols = false), _LENGTH, 1, threads = threads, forcemissing = false)
852+
lengths = byrow(Dataset(all_idxcols, [:x], copycols = false), _LENGTH, 1, threads = threads, allowmissing = false)
852853
if length(idxcols) > 1
853854
for col in 2:length(idxcols)
854855
if mapformats

0 commit comments

Comments
 (0)