public class Dictionary extends ADictionary
Constructor and Description |
---|
Dictionary(double[] values) |
Modifier and Type | Method and Description |
---|---|
double |
aggregate(double init,
Builtin fn)
Aggregate all the contained values, useful in value only computations where the operation is iterating through
all values contained in the dictionary.
|
Dictionary |
apply(ScalarOperator op)
Applies the scalar operation on the dictionary.
|
Dictionary |
applyScalarOp(ScalarOperator op,
double newVal,
int numCols)
Applies the scalar operation on the dictionary.
|
Dictionary |
clone()
Returns a deep clone of the dictionary.
|
long |
getExactSizeOnDisk()
Calculate the space consumption if the dictionary is stored on disk.
|
long |
getInMemorySize()
Returns the memory usage of the dictionary.
|
int |
getNumberOfValues(int ncol)
Get the number of values given that the column group has n columns
|
double |
getValue(int i)
Get Specific value contained in the dictionary at index.
|
double[] |
getValues()
Get all the values contained in the dictionary as a linearized double array.
|
int |
getValuesLength()
returns the count of values contained in the dictionary.
|
int |
hasZeroTuple(int ncol)
Determines if the content has a zero tuple.
|
static Dictionary |
read(DataInput in) |
void |
write(DataOutput out)
Write the dictionary to a DataOutput.
|
aggregateCols, read
public double[] getValues()
ADictionary
getValues
in class ADictionary
public double getValue(int i)
ADictionary
getValue
in class ADictionary
i
- The index to extract the value frompublic long getInMemorySize()
ADictionary
getInMemorySize
in class ADictionary
public int hasZeroTuple(int ncol)
ADictionary
hasZeroTuple
in class ADictionary
ncol
- The number of columns in the dictionary.public double aggregate(double init, Builtin fn)
ADictionary
aggregate
in class ADictionary
init
- The initial Value, in cases such as Max value, this could be -infinityfn
- The Function to apply to valuespublic Dictionary apply(ScalarOperator op)
ADictionary
apply
in class ADictionary
op
- The operator to apply to the dictionary values.public Dictionary applyScalarOp(ScalarOperator op, double newVal, int numCols)
ADictionary
applyScalarOp
in class ADictionary
op
- The operator to apply to the dictionary values.newVal
- The value to append to the dictionary.numCols
- The number of columns stored in the dictionary.public Dictionary clone()
ADictionary
clone
in class ADictionary
public int getValuesLength()
ADictionary
getValuesLength
in class ADictionary
public static Dictionary read(DataInput in) throws IOException
IOException
public void write(DataOutput out) throws IOException
ADictionary
write
in class ADictionary
out
- the output sink to write the dictionary to.IOException
- if the sink fails.public long getExactSizeOnDisk()
ADictionary
getExactSizeOnDisk
in class ADictionary
public int getNumberOfValues(int ncol)
ADictionary
getNumberOfValues
in class ADictionary
ncol
- The number of Columns in the ColumnGroup.Copyright © 2020 The Apache Software Foundation. All rights reserved.