Class LongArray
- java.lang.Object
-
- org.apache.sysds.runtime.frame.data.columns.Array<Long>
-
- org.apache.sysds.runtime.frame.data.columns.LongArray
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sysds.runtime.frame.data.columns.Array
Array.ArrayIterator
-
-
Constructor Summary
Constructors Constructor Description LongArray(long[] data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<Types.ValueType,Boolean>
analyzeValueType(int maxCells)
Analyze the column to figure out if the value type can be refined to a better type.void
append(Long value)
Append a value of the same type of the Array.void
append(String value)
Append a string value to the current Array, this should in general be avoided, and appending larger blocks at a time should be preferred.Array<Long>
append(Array<Long> other)
Append other array, if the other array is fitting in current allocated size use that allocated size, otherwise allocate new array to combine the other with this.Array<Character>
changeTypeCharacter(Array<Character> retA, int l, int u)
Array<Long>
clone()
Overwrite of the java internal clone function for arrays, return a clone of underlying data that is mutable, (not immutable data.) Immutable data is dependent on the individual allocated arraysboolean
equals(Array<Long> other)
Equals operation on arrays.void
fill(Long value)
fill the entire array with specific value.void
fill(String value)
fill the entire array with specific value.long[]
get()
Get the underlying array out of the column Group, it is the responsibility of the caller to know what type it is.Long
get(int index)
Get the value at a given index.byte[]
getAsByteArray()
Return the current allocated Array as a byte[], this is used to serialize the allocated Arrays out to the PythonAPI.double
getAsDouble(int i)
Get the index's value.long
getExactSerializedSize()
Get the exact serialized size on disk of this array.ArrayFactory.FrameArrayType
getFrameArrayType()
Get the internal FrameArrayType, to specify the encoding of the Types, note there are more Frame Array Types than there is ValueTypes.long
getInMemorySize()
Get in memory size, not counting reference to this object.Types.ValueType
getValueType()
Get the current value type of this array.double
hashDouble(int idx)
Hash the given index of the array.boolean
isEmpty()
Get if this array is empty, aka filled with empty values.boolean
isNotEmpty(int i)
boolean
isShallowSerialize()
analyze if this array can be shallow serialized.static long
parseLong(String s)
boolean
possiblyContainsNaN()
void
readFields(DataInput in)
void
reset(int size)
Reset the Array and set to a different size.Array<Long>
select(boolean[] select, int nTrue)
Slice out the true indices in the select input and return the sub array.Array<Long>
select(int[] indices)
Slice out the specified indices and return the sub array.void
set(int index, double value)
Set index to given double value (cast to the correct type of this array)void
set(int rl, int ru, Array<Long> value)
Set range to given arrays valuevoid
set(int rl, int ru, Array<Long> value, int rlSrc)
Set range to given arrays value with an offset into other arrayvoid
set(int index, Long value)
Set index to the given value of same typevoid
set(int index, String value)
Set index to the given value of the string parsed.void
setFromOtherType(int rl, int ru, Array<?> value)
Set range to given arrays valuevoid
setFromOtherTypeNz(int rl, int ru, Array<?> value)
Set non default values in the range from the value array givenvoid
setNz(int rl, int ru, Array<Long> value)
Set non default values in the range from the value array givenArray<Long>
slice(int rl, int ru)
Slice out the sub range and return new array with the specified type.String
toString()
void
write(DataOutput out)
-
Methods inherited from class org.apache.sysds.runtime.frame.data.columns.Array
analyzeValueType, baseMemoryCost, changeType, changeType, changeType, changeType, changeTypeWithNulls, changeTypeWithNulls, changeTypeWithNulls, containsNull, equals, extractDouble, findEmpty, findEmptyInverse, getAsNaNDouble, getCache, getInternal, getIterator, getMinMaxLength, getNulls, getRecodeMap, minMax, minMax, setCache, setFromOtherTypeNz, setNz, size, statistics
-
-
-
-
Method Detail
-
get
public long[] get()
Description copied from class:Array
Get the underlying array out of the column Group, it is the responsibility of the caller to know what type it is. Also it is not guaranteed that the underlying data structure does not allocate an appropriate response to the caller. This in practice means that if called there is a possibility that the entire array is allocated again. So the method should only be used for debugging purposes not for performance.
-
get
public Long get(int index)
Description copied from class:Array
Get the value at a given index. This method returns objects that have a high overhead in allocation. Therefore it is not as efficient as using the vectorized operations specified in the object.
-
set
public void set(int index, Long value)
Description copied from class:Array
Set index to the given value of same type
-
set
public void set(int index, double value)
Description copied from class:Array
Set index to given double value (cast to the correct type of this array)
-
set
public void set(int index, String value)
Description copied from class:Array
Set index to the given value of the string parsed.
-
set
public void set(int rl, int ru, Array<Long> value)
Description copied from class:Array
Set range to given arrays value
-
setFromOtherType
public void setFromOtherType(int rl, int ru, Array<?> value)
Description copied from class:Array
Set range to given arrays value- Specified by:
setFromOtherType
in classArray<Long>
- Parameters:
rl
- row lowerru
- row upper (inclusive)value
- value array to take values from (other type)
-
set
public void set(int rl, int ru, Array<Long> value, int rlSrc)
Description copied from class:Array
Set range to given arrays value with an offset into other array
-
setNz
public void setNz(int rl, int ru, Array<Long> value)
Description copied from class:Array
Set non default values in the range from the value array given
-
setFromOtherTypeNz
public void setFromOtherTypeNz(int rl, int ru, Array<?> value)
Description copied from class:Array
Set non default values in the range from the value array given- Specified by:
setFromOtherTypeNz
in classArray<Long>
- Parameters:
rl
- row startru
- row end inclusivevalue
- value array of different type
-
append
public void append(String value)
Description copied from class:Array
Append a string value to the current Array, this should in general be avoided, and appending larger blocks at a time should be preferred.
-
append
public void append(Long value)
Description copied from class:Array
Append a value of the same type of the Array. This should in general be avoided, and appending larger blocks at a time should be preferred.
-
append
public Array<Long> append(Array<Long> other)
Description copied from class:Array
Append other array, if the other array is fitting in current allocated size use that allocated size, otherwise allocate new array to combine the other with this. This method should use the set range function, and should be preferred over the append single values.
-
write
public void write(DataOutput out) throws IOException
- Throws:
IOException
-
readFields
public void readFields(DataInput in) throws IOException
- Throws:
IOException
-
clone
public Array<Long> clone()
Description copied from class:Array
Overwrite of the java internal clone function for arrays, return a clone of underlying data that is mutable, (not immutable data.) Immutable data is dependent on the individual allocated arrays
-
slice
public Array<Long> slice(int rl, int ru)
Description copied from class:Array
Slice out the sub range and return new array with the specified type. If the conversion fails fallback to normal slice.
-
reset
public void reset(int size)
Description copied from class:Array
Reset the Array and set to a different size. This method is used to reuse an already allocated Array, without extra allocation. It should only be done in cases where the Array is no longer in use in any FrameBlocks.
-
getAsByteArray
public byte[] getAsByteArray()
Description copied from class:Array
Return the current allocated Array as a byte[], this is used to serialize the allocated Arrays out to the PythonAPI.- Specified by:
getAsByteArray
in classArray<Long>
- Returns:
- The array as bytes
-
getValueType
public Types.ValueType getValueType()
Description copied from class:Array
Get the current value type of this array.- Specified by:
getValueType
in classArray<Long>
- Returns:
- The current value type.
-
analyzeValueType
public Pair<Types.ValueType,Boolean> analyzeValueType(int maxCells)
Description copied from class:Array
Analyze the column to figure out if the value type can be refined to a better type. The return is in two parts, first the type it can be, second if it contains nulls.- Specified by:
analyzeValueType
in classArray<Long>
- Parameters:
maxCells
- maximum number of cells to analyze- Returns:
- A better or equivalent value type to represent the column, including null information.
-
getFrameArrayType
public ArrayFactory.FrameArrayType getFrameArrayType()
Description copied from class:Array
Get the internal FrameArrayType, to specify the encoding of the Types, note there are more Frame Array Types than there is ValueTypes.- Specified by:
getFrameArrayType
in classArray<Long>
- Returns:
- The FrameArrayType
-
getInMemorySize
public long getInMemorySize()
Description copied from class:Array
Get in memory size, not counting reference to this object.- Overrides:
getInMemorySize
in classArray<Long>
- Returns:
- the size in memory of this object.
-
getExactSerializedSize
public long getExactSerializedSize()
Description copied from class:Array
Get the exact serialized size on disk of this array.- Specified by:
getExactSerializedSize
in classArray<Long>
- Returns:
- The exact size on disk
-
changeTypeCharacter
public Array<Character> changeTypeCharacter(Array<Character> retA, int l, int u)
-
fill
public void fill(String value)
Description copied from class:Array
fill the entire array with specific value.
-
fill
public void fill(Long value)
Description copied from class:Array
fill the entire array with specific value.
-
getAsDouble
public double getAsDouble(int i)
Description copied from class:Array
Get the index's value. returns 0 in case of Null.- Specified by:
getAsDouble
in classArray<Long>
- Parameters:
i
- index to get value from- Returns:
- the value
-
parseLong
public static long parseLong(String s)
-
isShallowSerialize
public boolean isShallowSerialize()
Description copied from class:Array
analyze if this array can be shallow serialized. to allow caching without modification.- Specified by:
isShallowSerialize
in classArray<Long>
- Returns:
- boolean saying true if shallow serialization is available
-
isEmpty
public boolean isEmpty()
Description copied from class:Array
Get if this array is empty, aka filled with empty values.
-
select
public Array<Long> select(int[] indices)
Description copied from class:Array
Slice out the specified indices and return the sub array.
-
select
public Array<Long> select(boolean[] select, int nTrue)
Description copied from class:Array
Slice out the true indices in the select input and return the sub array.
-
isNotEmpty
public final boolean isNotEmpty(int i)
- Specified by:
isNotEmpty
in classArray<Long>
-
hashDouble
public double hashDouble(int idx)
Description copied from class:Array
Hash the given index of the array. It is allowed to return NaN on null elements.- Specified by:
hashDouble
in classArray<Long>
- Parameters:
idx
- The index to hash- Returns:
- The hash value of that index.
-
equals
public boolean equals(Array<Long> other)
Description copied from class:Array
Equals operation on arrays.
-
possiblyContainsNaN
public boolean possiblyContainsNaN()
- Specified by:
possiblyContainsNaN
in classArray<Long>
-
-