You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by qu...@apache.org on 2022/10/07 21:40:49 UTC

[arrow-julia] branch main updated: Add ArgumentError for deleteat on ArrowVectrs; fixes #324 (#341)

This is an automated email from the ASF dual-hosted git repository.

quinnj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git


The following commit(s) were added to refs/heads/main by this push:
     new ef98cc8  Add ArgumentError for deleteat on ArrowVectrs; fixes #324 (#341)
ef98cc8 is described below

commit ef98cc80f2a4ac86a749058407e64a5b21aee4f1
Author: Jacob Quinn <qu...@gmail.com>
AuthorDate: Fri Oct 7 15:40:42 2022 -0600

    Add ArgumentError for deleteat on ArrowVectrs; fixes #324 (#341)
---
 src/arraytypes/arraytypes.jl | 1 +
 test/runtests.jl             | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/arraytypes/arraytypes.jl b/src/arraytypes/arraytypes.jl
index 88d38f8..32b9491 100644
--- a/src/arraytypes/arraytypes.jl
+++ b/src/arraytypes/arraytypes.jl
@@ -29,6 +29,7 @@ Base.similar(::Type{A}, dims::Dims) where {T, A <: ArrowVector{T}} = Vector{T}(u
 validitybitmap(x::ArrowVector) = x.validity
 nullcount(x::ArrowVector) = validitybitmap(x).nc
 getmetadata(x::ArrowVector) = x.metadata
+Base.deleteat!(x::T, inds) where {T <: ArrowVector} = throw(ArgumentError("`$T` does not support `deleteat!`; arrow data is by nature immutable"))
 
 function toarrowvector(x, i=1, de=Dict{Int64, Any}(), ded=DictEncoding[], meta=getmetadata(x); compression::Union{Nothing, Vector{LZ4FrameCompressor}, LZ4FrameCompressor, Vector{ZstdCompressor}, ZstdCompressor}=nothing, kw...)
     @debug 2 "converting top-level column to arrow format: col = $(typeof(x)), compression = $compression, kw = $(kw.data)"
diff --git a/test/runtests.jl b/test/runtests.jl
index dd79475..87e561e 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -533,6 +533,9 @@ end
 @test Arrow.Stream(UInt8[]) isa Arrow.Stream
 @test isempty(Tables.partitions(Arrow.Stream(UInt8[])))
 
+# https://github.com/apache/arrow-julia/issues/324
+@test_throws ArgumentError filter!(x -> x > 1, Arrow.toarrowvector([1, 2, 3]))
+
 end # @testset "misc"
 
 end