Class ArrayNoneEncoder

class ArrayNoneEncoder : public Encoder

Public Functions

ArrayNoneEncoder(AbstractBuffer *buffer)
size_t getNumElemsForBytesInsertData(const std::vector<ArrayDatum> *srcData, const int start_idx, const size_t numAppendElems, const size_t byteLimit, const bool replicating = false)
size_t getNumElemsForBytesEncodedDataAtIndices(const int8_t *index_data, const std::vector<size_t> &selected_idx, const size_t byte_limit)

Compute the maximum number of variable length encoded elements given a byte limit

NOTE: optional parameters above may be ignored by the implementation, but may or may not be required depending on the encoder type backing the implementation.

Return

the number of elements

Parameters
  • index_data: - (optional) index data for the encoded type

  • selected_idx: - which indices in the encoded data to consider

  • byte_limit: - byte limit that must be respected

std::shared_ptr<ChunkMetadata> appendData(int8_t *&src_data, const size_t num_elems_to_append, const SQLTypeInfo &ti, const bool replicating = false, const int64_t offset = -1)

Append data to the chunk buffer backing this encoder.

Parameters
  • src_data: Source data for the append

  • num_elems_to_append: Number of elements to append

  • ti: SQL Type Info for the column TODO(adb): used?

  • replicating: Pass one value and fill the chunk with it

  • offset: Write data starting at a given offset. Default is -1 which indicates an append, an offset of 0 rewrites the chunk up to num_elems_to_append.

std::shared_ptr<ChunkMetadata> appendEncodedDataAtIndices(const int8_t *index_data, int8_t *data, const std::vector<size_t> &selected_idx)

Append selected encoded data to the chunk buffer backing this encoder.

NOTE:

index_data must be non-null for varlen encoder types.
Return

updated chunk metadata for the chunk buffer backing this encoder

Parameters
  • index_data: - (optional) the index data of data to append

  • data: - the data to append

  • selected_idx: - which indices in the encoded data to append

std::shared_ptr<ChunkMetadata> appendEncodedData(const int8_t *index_data, int8_t *data, const size_t start_idx, const size_t num_elements)

Append encoded data to the chunk buffer backing this encoder.

NOTE:

index_data must be non-null for varlen encoder types.
Return

updated chunk metadata for the chunk buffer backing this encoder

Parameters
  • index_data: - (optional) the index data of data to append

  • data: - the data to append

  • start_idx: - the position to start encoding from in the data array

  • num_elements: - the number of elements to encode from the data array

std::shared_ptr<ChunkMetadata> appendData(const std::vector<ArrayDatum> *srcData, const int start_idx, const size_t numAppendElems, const bool replicating)
void getMetadata(const std::shared_ptr<ChunkMetadata> &chunkMetadata)
std::shared_ptr<ChunkMetadata> getMetadata(const SQLTypeInfo &ti)
void updateStats(const int64_t, const bool)
void updateStats(const double, const bool)
void updateStats(const int8_t *const src_data, const size_t num_elements)

Update statistics for data without appending.

Parameters
  • src_data: - the data with which to update statistics

  • num_elements: - the number of elements to scan in the data

void updateStats(const std::vector<std::string> *const src_data, const size_t start_idx, const size_t num_elements)

Update statistics for string data without appending.

Parameters
  • src_data: - the string data with which to update statistics

  • start_idx: - the offset into src_data to start the update

  • num_elements: - the number of elements to scan in the string data

void updateStats(const std::vector<ArrayDatum> *const src_data, const size_t start_idx, const size_t num_elements)

Update statistics for array data without appending.

Parameters
  • src_data: - the array data with which to update statistics

  • start_idx: - the offset into src_data to start the update

  • num_elements: - the number of elements to scan in the array data

void reduceStats(const Encoder&)
void writeMetadata(FILE *f)
void readMetadata(FILE *f)
void copyMetadata(const Encoder *copyFromEncoder)
AbstractBuffer *getIndexBuf() const
bool resetChunkStats(const ChunkStats&)

: Reset chunk level stats (min, max, nulls) using new values from the argument.

Return

: True if an update occurred and the chunk needs to be flushed. False otherwise. Default false if metadata update is unsupported. Only reset chunk stats if the incoming stats differ from the current stats.

void resetChunkStats()

Resets chunk metadata stats to their default values.

void setIndexBuffer(AbstractBuffer *buf)

Public Members

Datum elem_min
Datum elem_max
bool has_nulls
bool initialized

Public Static Attributes

constexpr size_t DEFAULT_NULL_PADDING_SIZE = {8}

Private Functions

void update_elem_stats(const ArrayDatum &array)
std::pair<ArrayOffsetT, ArrayOffsetT> getArrayOffsetsAtIndex(const int8_t *index_data, size_t index)
size_t getArrayDatumSizeAtIndex(const int8_t *index_data, size_t index)
ArrayDatum getArrayDatumAtIndex(const int8_t *index_data, int8_t *data, size_t index)

Private Members

std::mutex EncoderMutex_
AbstractBuffer *index_buf
ArrayOffsetT last_offset