Functions
Built-in functions
Every Content
subclass has the following built-in functions:
Base.length
Base.size
(1-tuple oflength
)Base.firstindex
,Base.lastindex
(1-based or inherited from its index)Base.getindex
select byInt
(single item),UnitRange{Int}
(slice), andSymbol
(record field)Base.iterate
Base.:(==)
(equality defined by values: aListOffsetArray
and aListArray
may be considered the same)Base.push!
Base.append!
Base.show
Base.length
— FunctionBase.length(parameters::Parameters)
Base.length(layout::PrimitiveArray)
Base.length(layout::EmptyArray)
Base.length(layout::ListOffsetArray)
Length of a ListOffsetArray
.
Base.length(layout::ListArray)
Length of a ListArray
.
Base.length(layout::RegularArray)
Length of a RegularArray
.
Base.length(layout::RecordArray)
Base.length(layout::TupleArray)
Base.length(layout::IndexedArray)
Base.length(layout::IndexedOptionArray)
Base.length(layout::ByteMaskedArray)
Base.length(layout::BitMaskedArray)
Base.length(layout::UnmaskedArray)
Base.length(layout::UnionArray)
Base.size
— FunctionTreat instances of Content
as if they are one-dimensional arrays.
Base.firstindex
— FunctionBase.firstindex(layout::PrimitiveArray)
Base.firstindex(layout::EmptyArray)
Base.firstindex(layout::ListOffsetArray)
First index of a ListOffsetArray
offsets.
Base.firstindex(layout::ListArray)
First index of a ListArray
starts.
Base.firstindex(layout::RegularArray)
First index of a RegularArray
is always 1.
Base.firstindex(layout::RecordArray)
Base.firstindex(layout::TupleArray)
Base.firstindex(layout::IndexedArray)
Base.firstindex(layout::IndexedOptionArray)
Base.firstindex(layout::ByteMaskedArray)
Base.firstindex(layout::BitMaskedArray)
Base.firstindex(layout::UnmaskedArray)
Base.firstindex(layout::UnionArray)
Base.lastindex
— FunctionBase.lastindex(layout::PrimitiveArray)
Base.lastindex(layout::EmptyArray)
Base.lastindex(layout::ListOffsetArray)
Last index of a ListOffsetArray
offsets.
Base.lastindex(layout::ListArray)
Last index of a ListArray
starts.
Base.lastindex(layout::RegularArray)
Last index of a RegularArray
.
Base.lastindex(layout::RecordArray)
Base.lastindex(layout::TupleArray)
Base.lastindex(layout::IndexedArray)
Base.lastindex(layout::IndexedOptionArray)
Base.lastindex(layout::ByteMaskedArray)
Base.lastindex(layout::BitMaskedArray)
Base.lastindex(layout::UnmaskedArray)
Base.lastindex(layout::UnionArray)
Base.getindex
— FunctionBase.getindex(layout::PrimitiveArray, i::Int)
Base.getindex(layout::PrimitiveArray, r::UnitRange{Int})
Base.getindex(layout::EmptyArray, i::Int)
Base.getindex(layout::EmptyArray, r::UnitRange{Int})
Base.getindex(layout::ListOffsetArray, i::Int)
Base.getindex(layout::ListOffsetArray, r::UnitRange{Int})
Base.getindex(layout::ListOffsetArray, f::Symbol)
Base.getindex(layout::ListArray, i::Int)
Base.getindex(layout::ListArray, r::UnitRange{Int})
Base.getindex(layout::ListArray, f::Symbol)
Base.getindex(layout::RegularArray, i::Int)
Base.getindex(layout::RegularArray, r::UnitRange{Int})
Base.getindex(layout::RegularArray, f::Symbol)
Base.getindex(
layout::ListOffsetArray{INDEX,PrimitiveArray{UInt8,BUFFER,:char},:string},
i::Int,
) where {INDEX<:IndexBig,BUFFER<:AbstractVector{UInt8}}
Base.getindex(
layout::ListArray{INDEX,PrimitiveArray{UInt8,BUFFER,:char},:string},
i::Int,
) where {INDEX<:IndexBig,BUFFER<:AbstractVector{UInt8}}
Base.getindex(
layout::RegularArray{PrimitiveArray{UInt8,BUFFER,:char},:string},
i::Int,
) where {BUFFER<:AbstractVector{UInt8}}
Base.getindex(
layout::ListOffsetArray{INDEX,PrimitiveArray{UInt8,BUFFER,:byte},:bytestring},
i::Int,
) where {INDEX<:IndexBig,BUFFER<:AbstractVector{UInt8}}
Base.getindex(
layout::ListArray{INDEX,PrimitiveArray{UInt8,BUFFER,:byte},:bytestring},
i::Int,
) where {INDEX<:IndexBig,BUFFER<:AbstractVector{UInt8}}
Base.getindex(
layout::RegularArray{PrimitiveArray{UInt8,BUFFER,:byte},:bytestring},
i::Int,
) where {BUFFER<:AbstractVector{UInt8}}
Base.getindex(
layout::RecordArray{FIELDS,CONTENTS,BEHAVIOR},
i::Int,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}},BEHAVIOR}
Base.getindex(
layout::RecordArray{FIELDS,CONTENTS,BEHAVIOR},
r::UnitRange{Int},
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}},BEHAVIOR}
Base.getindex(
layout::RecordArray{FIELDS,CONTENTS,BEHAVIOR},
f::Symbol,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}},BEHAVIOR}
Base.getindex(
layout::Record{FIELDS,CONTENTS},
f::Symbol,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}}
Base.getindex(
layout::TupleArray{CONTENTS,BEHAVIOR},
i::Int,
) where {CONTENTS<:Base.Tuple{Vararg{Content}},BEHAVIOR}
Base.getindex(
layout::TupleArray{CONTENTS,BEHAVIOR},
r::UnitRange{Int},
) where {VALUES<:Content,CONTENTS<:Base.Tuple{VALUES},BEHAVIOR}
Base.getindex(
layout::SlotRecord{CONTENTS},
f::Int64,
) where {CONTENTS<:Base.Tuple{Vararg{Content}}}
Base.getindex(layout::IndexedArray, i::Int)
Base.getindex(layout::IndexedArray, r::UnitRange{Int})
Base.getindex(layout::IndexedArray, f::Symbol)
Base.getindex(layout::IndexedOptionArray, i::Int)
Base.getindex(layout::IndexedOptionArray, r::UnitRange{Int})
Base.getindex(layout::IndexedOptionArray, f::Symbol)
Base.getindex(layout::ByteMaskedArray, i::Int)
Base.getindex(layout::ByteMaskedArray, r::UnitRange{Int})
Base.getindex(layout::ByteMaskedArray, f::Symbol)
Base.getindex(layout::BitMaskedArray, i::Int)
Base.getindex(layout::BitMaskedArray, r::UnitRange{Int})
Base.getindex(layout::BitMaskedArray, f::Symbol)
Base.getindex(layout::UnmaskedArray, i::Int)
Base.getindex(layout::UnmaskedArray, r::UnitRange{Int})
Base.getindex(layout::UnmaskedArray, f::Symbol)
Base.getindex(layout::UnionArray, i::Int)
Base.getindex(layout::UnionArray, r::UnitRange{Int})
Base.getindex(layout::UnionArray, f::Symbol)
Base.iterate
— FunctionBase.iterate(layout::Content)
Enable the use of Julia's iteration protocol on instances of Content
type.
Examples
# Assuming Content is defined and an instance is created
for element in layout_instance
println(element)
end
Initialization: The iteration process starts by calling Base.iterate(layout)
with the collection layout as the only argument. This should return the first element and the initial state.
Base.iterate(layout::Content, state)
Iteration: The iteration continues by repeatedly calling Base.iterate(layout, state)
with the collection and the current state. This returns the next element and the next state until it returns nothing
, indicating the end of the iteration.
Parameters
layout::Content
: This specifies that the function operates on an instance of the type Content
.
state
: This represents the current state of the iteration, typically an index or position in the collection.
Base.eltype
— FunctionBase.eltype(layout::PrimitiveArray)
Base.eltype(layout::EmptyArray)
Base.eltype(layout::ListType)
Base.eltype(layout::IndexedArray)
Base.eltype(layout::IndexedOptionArray)
Base.eltype(layout::ByteMaskedArray)
Base.eltype(layout::BitMaskedArray)
Base.eltype(layout::UnmaskedArray)
Base.eltype(layout::UnionArray)
Base.:==
— FunctionBase.:(==)(layout1::Content, layout2::Content)
Two Content
objects are considered equal only if they have the same elements in the same order.
Base.:(==)(
layout1::RecordArray{FIELDS,CONTENTS1},
layout2::RecordArray{FIELDS,CONTENTS2},
) where {
FIELDS,
CONTENTS1<:Base.Tuple{Vararg{Content}},
CONTENTS2<:Base.Tuple{Vararg{Content}},
}
Base.:(==)(
layout1::Record{FIELDS,CONTENTS1},
layout2::Record{FIELDS,CONTENTS2},
) where {
FIELDS,
CONTENTS1<:Base.Tuple{Vararg{Content}},
CONTENTS2<:Base.Tuple{Vararg{Content}},
}
Base.:(==)(
layout1::TupleArray{CONTENTS1},
layout2::TupleArray{CONTENTS2},
) where {
N,
CONTENTS1<:Base.Tuple{Vararg{Content,N}},
CONTENTS2<:Base.Tuple{Vararg{Content,N}},
}
Base.:(==)(
layout1::SlotRecord{CONTENTS1},
layout2::SlotRecord{CONTENTS2},
) where {
N,
CONTENTS1<:Base.Tuple{Vararg{Content,N}},
CONTENTS2<:Base.Tuple{Vararg{Content,N}},
}
Base.push!
— FunctionBase.push!(layout::PrimitiveArray{ITEM}, input::ITEM) where {ITEM}
Push multiple ITEM
elements (from another collection) to an instance of PrimitiveArray
.
Base.push!(layout::PrimitiveArray{ITEM}, input::Number) where {ITEM}
Base.push!(layout::EmptyArray, input)
Base.push!(layout::ListType{BEHAVIOR}, input::String) where {BEHAVIOR}
Base.push!(layout::ListType, input::AbstractVector)
Base.push!(
layout::RecordArray{FIELDS,CONTENTS},
input::NamedTuple{FIELDS},
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}}
Base.push!(
layout::TupleArray{CONTENTS},
input::INPUT,
) where {N,CONTENTS<:Base.Tuple{Vararg{Content,N}},INPUT<:Base.Tuple{Vararg{Any,N}}}
Base.push!(layout::IndexedArray, input)
Base.push!(layout::IndexedOptionArray, input)
Base.push!(layout::ByteMaskedArray, input)
Base.push!(layout::BitMaskedArray, input)
Base.push!(layout::UnmaskedArray, input)
Base.push!(special::Specialization, input)
Base.push!(layout::UnionArray, input)
Base.append!
— FunctionBase.append!(layout::Content, input)
Append multiple elements (from another collection) to an instance of Content.
Base.append!(layout::OptionType, input)
Appending elements to an array of type OptionType
, handling missing values.
Base.append!(special::Specialization, input)
Base.show
— FunctionBase.show(io::IO, parameters::Parameters)
Base.show(
io::IO,
data::Union{Content,Record,Tuple};
limit_rows::Int = 1,
limit_cols::Int = 80,
)
Base.show(data::Union{Content,Record,Tuple}; limit_rows::Int = 1, limit_cols::Int = 80)
Base.keys
— FunctionBase.keys(parameters::Parameters)
Manipulating and checking structure
Every Content
subclass has the following functions for manipulating and checking structure:
AwkwardArray.parameters_of
gets all parametersAwkwardArray.has_parameter
returns true if a parameter existsAwkwardArray.get_parameter
returns a parameter or raises an errorAwkwardArray.with_parameter
returns a copy of this node with a specified parameterAwkwardArray.copy
shallow-copy of the array, allowing properties to be replacedAwkwardArray.is_valid
verifies that the structure adheres to Awkward Array's protocol
AwkwardArray.parameters_of
— Functionparameters_of(content::CONTENT) where {CONTENT<:Content}
Return a list of all parameters.
parameters_of(content::EmptyArray)
AwkwardArray.has_parameter
— Functionhas_parameter(parameters::Parameters, key::String)
has_parameter(content::CONTENT, key::String) where {CONTENT<:Content}
Return true if a parameter exists.
has_parameter(content::EmptyArray, key::String)
AwkwardArray.get_parameter
— Functionget_parameter(parameters::Parameters, key::String)
get_parameter(content::CONTENT, key::String) where {CONTENT<:Content}
Return a parameter or raises an error.
get_parameter(content::EmptyArray, key::String)
AwkwardArray.with_parameter
— Functionwith_parameter(parameters::Parameters, pair::Pair{String,String})
with_parameter(parameters::Parameters, pair::Pair{String,<:Any})
AwkwardArray.copy
— Functioncopy(
layout::PrimitiveArray{ITEM,BUFFER1,BEHAVIOR};
data::Union{Unset,BUFFER2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {ITEM,BUFFER1<:AbstractVector{ITEM},BUFFER2<:AbstractVector,BEHAVIOR}
copy(behavior::Union{Unset,Symbol} = Unset())
copy(
layout::ListOffsetArray{INDEX1,CONTENT1,BEHAVIOR};
offsets::Union{Unset,INDEX2} = Unset(),
content::Union{Unset,CONTENT2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {INDEX1<:IndexBig,INDEX2<:IndexBig,CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
Copy of a ListOffsetArray
.
copy(
layout::ListArray{INDEX1,CONTENT1,BEHAVIOR};
starts::Union{Unset,INDEX2} = Unset(),
stops::Union{Unset,INDEX2} = Unset(),
content::Union{Unset,CONTENT2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {INDEX1<:IndexBig,INDEX2<:IndexBig,CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
Copy of a ListArray
.
copy(
layout::RegularArray{CONTENT1,BEHAVIOR};
content::Union{Unset,CONTENT2} = Unset(),
size::Union{Unset,Int} = Unset(),
zeros_length::Union{Unset,Int} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
Copy of a RegularArray
.
copy(
layout::RecordArray{FIELDS1,CONTENTS1,BEHAVIOR};
contents::Union{Unset,NamedTuple{FIELDS2,CONTENTS2}} = Unset(),
length::Union{Unset,Int64} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {
FIELDS1,
FIELDS2,
CONTENTS1<:Base.Tuple{Vararg{Content}},
CONTENTS2<:Base.Tuple{Vararg{Content}},
BEHAVIOR,
}
copy(
layout::TupleArray{CONTENTS1,BEHAVIOR};
contents::Union{Unset,CONTENTS2} = Unset(),
length::Union{Unset,Int64} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {
CONTENTS1<:Base.Tuple{Vararg{Content}},
CONTENTS2<:Base.Tuple{Vararg{Content}},
BEHAVIOR,
}
copy(
layout::IndexedArray{INDEX1,CONTENT1,BEHAVIOR};
index::Union{Unset,INDEX2} = Unset(),
content::Union{Unset,CONTENT2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {INDEX1<:IndexBig,INDEX2<:IndexBig,CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
copy(
layout::IndexedOptionArray{INDEX1,CONTENT1,BEHAVIOR};
index::Union{Unset,INDEX2} = Unset(),
content::Union{Unset,CONTENT2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {
INDEX1<:IndexBigSigned,
INDEX2<:IndexBigSigned,
CONTENT1<:Content,
CONTENT2<:Content,
BEHAVIOR,
}
Copy of an IndexedOptionArray
, potentially with some modifications to its fields.
copy(
layout::ByteMaskedArray{INDEX1,CONTENT1,BEHAVIOR};
mask::Union{Unset,INDEX2} = Unset(),
content::Union{Unset,CONTENT2} = Unset(),
valid_when::Union{Unset,Bool} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {INDEX1<:IndexBool,INDEX2<:IndexBool,CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
copy(
layout::BitMaskedArray{CONTENT1,BEHAVIOR};
mask::Union{Unset,BitVector} = Unset(),
content::Union{Unset,CONTENT2} = Unset(),
valid_when::Union{Unset,Bool} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
copy(
layout::UnmaskedArray{CONTENT1,BEHAVIOR};
content::Union{Unset,CONTENT2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
) where {CONTENT1<:Content,CONTENT2<:Content,BEHAVIOR}
copy(
layout::UnionArray{TAGS1,INDEX1,CONTENTS1,BEHAVIOR};
tags::Union{Unset,TAGS2} = Unset(),
index::Union{Unset,INDEX2} = Unset(),
contents::Union{Unset,CONTENTS2} = Unset(),
parameters::Union{Unset,Parameters} = Unset(),
behavior::Union{Unset,Symbol} = Unset(),
)
AwkwardArray.is_valid
— Functionis_valid(layout::PrimitiveArray)
is_valid(layout::EmptyArray)
is_valid(layout::ListOffsetArray)
Check if a ListOffsetArray
is valid.
is_valid(layout::ListArray)
Check if a ListArray
is valid.
is_valid(layout::RegularArray)
Check if a RegularArray
is valid.
is_valid(layout::RecordArray)
is_valid(layout::TupleArray)
is_valid(layout::IndexedArray)
is_valid(layout::IndexedOptionArray)
is_valid(layout::ByteMaskedArray)
is_valid(layout::BitMaskedArray)
is_valid(layout::UnmaskedArray)
is_valid(layout::UnionArray)
Filling an array
Every Content
subclass has the following functions for filling an array:
AwkwardArray.end_list!
: closes off aListType
array (ListOffsetArray
,ListArray
, orRegularArray
) in the manner of Python's ak.ArrayBuilder (nobegin_list
is necessary)AwkwardArray.end_record!
closes off aRecordArray
AwkwardArray.end_tuple!
closes off aTupleArray
AwkwardArray.push_null!
pushes a missing value ontoOptionType
arrays (IndexedOptionArray
ByteMaskedArray
BitMaskedArray
orUnmaskedArray
)AwkwardArray.push_dummy!
pushes an unspecified value onto the array (used byByteMaskedArray
andBitMaskedArray
which need to have a placeholder in memory behind eachmissing
value)
AwkwardArray.end_list!
— Functionend_list!(layout::ListOffsetArray)
end_list!(layout::ListArray)
end_list!(layout::RegularArray)
end_list!(layout::IndexedArray)
end_list!(layout::IndexedOptionArray)
end_list!(layout::ByteMaskedArray)
end_list!(layout::BitMaskedArray)
end_list!(layout::UnmaskedArray)
end_list!(special::Specialization)
AwkwardArray.end_record!
— Functionend_record!(layout::RecordArray)
end_record!(layout::IndexedArray)
end_record!(layout::IndexedOptionArray)
end_record!(layout::ByteMaskedArray)
end_record!(layout::BitMaskedArray)
end_record!(layout::UnmaskedArray)
end_record!(special::Specialization)
AwkwardArray.end_tuple!
— Functionend_tuple!(layout::TupleArray)
end_tuple!(layout::IndexedArray)
end_tuple!(layout::IndexedOptionArray)
end_tuple!(layout::ByteMaskedArray)
end_tuple!(layout::BitMaskedArray)
end_tuple!(layout::UnmaskedArray)
end_tuple!(special::Specialization)
AwkwardArray.push_null!
— Functionpush_null!(layout::IndexedOptionArray)
push_null!(layout::ByteMaskedArray)
push_null!(layout::BitMaskedArray)
push_null!(
special::Specialization{ARRAY,TAGGED},
) where {ARRAY<:UnionArray,TAGGED<:OptionType}
AwkwardArray.push_dummy!
— Functionpush_dummy!(layout::PrimitiveArray{ITEM}) where {ITEM}
push_dummy!(layout::ListOffsetArray)
push_dummy!(layout::ListArray)
push_dummy!(layout::RegularArray)
push_dummy!(layout::RecordArray)
push_dummy!(layout::TupleArray)
push_dummy!(layout::IndexedArray)
push_dummy!(layout::IndexedOptionArray)
push_dummy!(layout::ByteMaskedArray)
push_dummy!(layout::BitMaskedArray)
push_dummy!(layout::UnmaskedArray)
push_dummy!(special::Specialization)
Selecting fields
RecordArray
and TupleArray
have the following for selecting fields (as opposed to rows):
AwkwardArray.slot
gets aRecordArray
orTupleArray
field, to avoid conflicts withBase.getindex
forTupleArrays
(both use integers to select a field)AwkwardArray.Record
scalar representation of an item from aRecordArray
AwkwardArray.SlotRecord
scalar representation of an item from aTupleArray
(note: not the same asBase.Tuple
)
AwkwardArray.slot
— Functionslot(
layout::RecordArray{FIELDS,CONTENTS,BEHAVIOR},
f::Symbol,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}},BEHAVIOR}
slot(
layout::TupleArray{CONTENTS,BEHAVIOR},
f::Int,
) where {CONTENTS<:Base.Tuple{Vararg{Content}},BEHAVIOR}
Specializations
UnionArray
has the following for dealing with specializations:
AwkwardArray.Specialization
selects aUnionArray
specialization forpush!
append!
etc.
Convertion
Finally, all Content
subclasses can be converted with the following:
AwkwardArray.layout_for
returns an appropriately-nestedContent
type for a given Julia type (DataType
)AwkwardArray.from_iter
converts Julia data into an Awkward ArrayAwkwardArray.to_vector
converts an Awkward Array into Julia dataAwkwardArray.from_buffers
constructs an Awkward Array from a Form (JSON), length, and buffers for zero-copy passing from PythonAwkwardArray.to_buffers
deconstructs an Awkward Array into a Form (JSON), length, and buffers for zero-copy passing to Python
AwkwardArray.layout_for
— Functionlayout_for(ItemType)
AwkwardArray.from_iter
— Functionfrom_iter(input)
AwkwardArray.to_vector
— Functionto_vector(layout::Content; view::Bool = false, na::Union{Missing,Nothing} = missing)
to_vector(
record::Record{FIELDS,CONTENTS};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}} = NamedTuple{FIELDS}
to_vector(
tuple::Tuple{CONTENTS};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {CONTENTS<:Base.Tuple{Vararg{Content}}}
to_vector(
layout::PrimitiveArray{ITEM},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {ITEM}
to_vector(
layout::EmptyArray,
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
)
to_vector(
layout::ListOffsetArray{INDEX,CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBig,CONTENT<:Content}
to_vector(
layout::ListArray{INDEX,CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBig,CONTENT<:Content}
to_vector(
layout::RegularArray{CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {CONTENT<:Content}
to_vector(
layout::ListOffsetArray{INDEX,PrimitiveArray{UInt8,BUFFER,:char},:string},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBig,BUFFER<:AbstractVector{UInt8}}
to_vector(
layout::ListArray{INDEX,PrimitiveArray{UInt8,BUFFER,:char},:string},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBig,BUFFER<:AbstractVector{UInt8}}
to_vector(
layout::RegularArray{PrimitiveArray{UInt8,BUFFER,:char},:string},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {BUFFER<:AbstractVector{UInt8}}
to_vector(
layout::RecordArray{FIELDS,CONTENTS},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}}
to_vector(
layout::TupleArray{CONTENTS},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {CONTENTS<:Base.Tuple{Vararg{Content}}}
to_vector(
layout::IndexedArray{INDEX,CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBig,CONTENT<:Content}
to_vector(
layout::IndexedOptionArray{INDEX,CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBig,CONTENT<:Content}
to_vector(
layout::ByteMaskedArray{INDEX,CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {INDEX<:IndexBool,CONTENT<:Content}
to_vector(
layout::BitMaskedArray{CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {CONTENT<:Content}
to_vector(
layout::UnmaskedArray{CONTENT},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {CONTENT<:Content}
to_vector(
layout::UnionArray{TAGS,INDEX,CONTENTS},
r::UnitRange{Int};
view::Bool = false,
na::Union{Missing,Nothing} = missing,
) where {TAGS<:Index8,INDEX<:IndexBig,CONTENTS<:Base.Tuple}
AwkwardArray.to_vector_or_scalar
— Functionto_vector_or_scalar(x::Content; view::Bool = false, na::Union{Missing,Nothing} = missing)
to_vector_or_scalar(x; view::Bool = false, na = missing)
AwkwardArray.from_buffers
— Functionfrom_buffers(
form::String,
length::Int,
containers::Dict{String,BUFFER};
buffer_key::BUFFER_KEY_FUNCTION = default_buffer_key,
) where {BUFFER<:AbstractVector{UInt8},BUFFER_KEY_FUNCTION<:Function}
from_buffers(
form::Dict{String,Any},
length::Int,
containers::Dict{String,BUFFER};
buffer_key::BUFFER_KEY_FUNCTION = default_buffer_key,
) where {BUFFER<:AbstractVector{UInt8},BUFFER_KEY_FUNCTION<:Function}
AwkwardArray.to_buffers
— Functionto_buffers(layout::Content)
Arrays of Stings
AwkwardArray.ByteStringOffsetArray
— FunctionByteStringOffsetArray(
offsets::INDEX,
data::AbstractVector{UInt8};
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
) where {INDEX<:IndexBig}
The function that constructs a specialized array type for handling byte strings with specific offsets.
offsets
: This is an array of indices (INDEX
) which determines where each string starts within the byte array.data
: This is a vector ofUInt8
(unsigned 8-bit integers), representing the raw bytes of the strings.parameters
: Optional parameters for configuring theListOffsetArray
.byte_parameters
: Optional parameters specifically for thePrimitiveArray
holding the byte data.INDEX<:
Ensures that offsets is a subtype ofIndexBig
, which typically implies a larger indexing type suitable for big data.
It is a ListType
with behavior
= :bytestring
.
ByteStringOffsetArray(;
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
)
A default constructor that initializes an empty ByteStringOffsetArray
.
AwkwardArray.ByteStringArray
— FunctionByteStringArray(
starts::INDEX,
stops::INDEX,
data::AbstractVector{UInt8};
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
) where {INDEX<:IndexBig}
The ByteStringArray
function constructs a specialized array type for handling byte strings, similar to ByteStringOffsetArray
, but it uses separate starts
and stops
indices rather than a single offsets
array.
ByteStringArray(;
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
)
A default constructor that initializes an empty ByteStringArray
.
AwkwardArray.ByteStringRegularArray
— FunctionByteStringRegularArray(
data::AbstractVector{UInt8},
size::Int;
zeros_length::Int = 0,
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
)
ByteStringRegularArray(
size::Int;
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
)
ByteStringRegularArray(;
parameters::Parameters = Parameters(),
byte_parameters::Parameters = Parameters(),
)
AwkwardArray.StringArray
— FunctionStringArray(
starts::INDEX,
stops::INDEX,
data::AbstractVector{UInt8};
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
) where {INDEX<:IndexBig}
StringArray(
starts::INDEX,
stops::INDEX,
data::String; # data provided as a String, rather than AbstractVector{UInt8}
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
) where {INDEX<:IndexBig}
StringArray(;
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
)
AwkwardArray.StringOffsetArray
— FunctionStringOffsetArray(
offsets::INDEX,
data::AbstractVector{UInt8};
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
) where {INDEX<:IndexBig}
StringOffsetArray(
offsets::INDEX,
data::String;
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
) where {INDEX<:IndexBig}
StringOffsetArray(; parameters = Parameters(), char_parameters = Parameters())
AwkwardArray.StringRegularArray
— FunctionStringRegularArray(
data::AbstractVector{UInt8},
size::Int;
zeros_length::Int = 0,
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
)
StringRegularArray(
data::String,
size::Int;
zeros_length::Int = 0,
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
)
StringRegularArray(
size::Int;
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
)
StringRegularArray(;
parameters::Parameters = Parameters(),
char_parameters::Parameters = Parameters(),
)
Utilities
AwkwardArray.isprimitive
— Functionisprimitive(t::Type)
Determine if a given type is one of the fundamental data types in Julia that are typically considered primitive. These include:
Integer
: Represents all integer types (e.g., Int64
, UInt8
). AbstractFloat
: Represents all floating-point types (e.g., Float64
, Float32
). Bool
: Represents boolean values (true
and false
). Char
: Represents character values.
AwkwardArray.default_buffer_key
— Functiondefault_buffer_key(form_key::String, attribute::String)
AwkwardArray.compatible
— Functioncompatible(parameters1::Parameters, parameters2::Parameters)
AwkwardArray.check_primitive_type
— Functioncheck_primitive_type(ITEM)
A utility that provides a string representation for various primitive types in Julia. It helps in identifying the type of an item
and mapping it to a human-readable format. This is useful in scenarios where type information needs to be logged, serialized, or displayed. If a type is not recognized, it defaults to returning unknown
.
Private functions
AwkwardArray._alternate
— Function_alternate(range::AbstractRange{Int64})
AwkwardArray._get_buffer
— Function_get_buffer(
form_key::Union{Nothing,String},
attribute::String,
buffer_key::BUFFER_KEY_FUNCTION,
containers::Dict{String,BUFFER},
) where {BUFFER<:AbstractVector{UInt8},BUFFER_KEY_FUNCTION<:Function}
AwkwardArray._get_index
— Function_get_index(
form_snippet::String,
length::Int64,
buffer::BUFFER,
) where {BUFFER<:AbstractVector{UInt8}}
AwkwardArray._horizontal
— Function_horizontal(data::Any, limit_cols::Int)
AwkwardArray._to_buffers!
— Function_to_buffers!(
layout::PrimitiveArray{ITEM,BUFFER},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {ITEM,BUFFER<:AbstractVector{ITEM}}
_to_buffers!(
layout::EmptyArray,
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
)
_to_buffers!(
layout::ListOffsetArray{INDEX,CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {INDEX<:IndexBig,CONTENT<:Content}
_to_buffers!(
layout::ListArray{INDEX,CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {INDEX<:IndexBig,CONTENT<:Content}
_to_buffers!(
layout::RegularArray{CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {CONTENT<:Content}
_to_buffers!(
layout::RecordArray{FIELDS,CONTENTS},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {FIELDS,CONTENTS<:Base.Tuple{Vararg{Content}}}
_to_buffers!(
layout::TupleArray{CONTENTS},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {CONTENTS<:Base.Tuple{Vararg{Content}}}
_to_buffers!(
layout::IndexedArray{INDEX,CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {INDEX<:IndexBig,CONTENT<:Content}
_to_buffers!(
layout::IndexedOptionArray{INDEX,CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {INDEX<:IndexBigSigned,CONTENT<:Content}
_to_buffers!(
layout::ByteMaskedArray{INDEX,CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {INDEX<:IndexBool,CONTENT<:Content}
_to_buffers!(
layout::BitMaskedArray{CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {CONTENT<:Content}
_to_buffers!(
layout::UnmaskedArray{CONTENT},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {CONTENT<:Content}
_to_buffers!(
layout::UnionArray{TAGS,INDEX,CONTENTS},
number::Vector{Int64},
containers::Dict{String,AbstractVector{UInt8}},
) where {TAGS<:Index8,INDEX<:IndexBig,CONTENTS<:Base.Tuple{Vararg{Content}}}
AwkwardArray._to_buffers_index
— Function_to_buffers_index(IndexType::DataType)
AwkwardArray._to_buffers_parameters
— Function_to_buffers_parameters(layout::CONTENT) where {BEHAVIOR,CONTENT<:Content{BEHAVIOR}}
AwkwardArray._vertical
— Function_vertical(data::Union{Content,Record,Tuple}, limit_rows::Int, limit_cols::Int)
Index
AwkwardArray.ByteStringArray
AwkwardArray.ByteStringOffsetArray
AwkwardArray.ByteStringRegularArray
AwkwardArray.StringArray
AwkwardArray.StringOffsetArray
AwkwardArray.StringRegularArray
AwkwardArray._alternate
AwkwardArray._get_buffer
AwkwardArray._get_index
AwkwardArray._horizontal
AwkwardArray._to_buffers!
AwkwardArray._to_buffers_index
AwkwardArray._to_buffers_parameters
AwkwardArray._vertical
AwkwardArray.check_primitive_type
AwkwardArray.compatible
AwkwardArray.copy
AwkwardArray.default_buffer_key
AwkwardArray.end_list!
AwkwardArray.end_record!
AwkwardArray.end_tuple!
AwkwardArray.from_buffers
AwkwardArray.from_iter
AwkwardArray.get_parameter
AwkwardArray.has_parameter
AwkwardArray.is_valid
AwkwardArray.isprimitive
AwkwardArray.layout_for
AwkwardArray.parameters_of
AwkwardArray.push_dummy!
AwkwardArray.push_null!
AwkwardArray.slot
AwkwardArray.to_buffers
AwkwardArray.to_vector
AwkwardArray.to_vector_or_scalar
AwkwardArray.with_parameter
Base.:==
Base.append!
Base.eltype
Base.firstindex
Base.getindex
Base.iterate
Base.keys
Base.lastindex
Base.length
Base.push!
Base.show
Base.size