/** * @brief Overwrite the value at the specified position with the supplied * TypedValue. * @warning You must call prepareForPositionalWrites() BEFORE calling this * method. * @warning Do NOT use positional writes in combination with appends. * @warning It is intended that this and other positional write methods * should be called exactly once for each position (if this is * violated, NULLs may not be tracked properly). * * @param position The position of the value in this NativeColumnVector to * overwrite. * @param value A TypedValue to write into this NativeColumnVector. **/ inline void positionalWriteTypedValue(const std::size_t position, const TypedValue &value) { DCHECK_LT(position, actual_length_); DCHECK(value.isPlausibleInstanceOf(type_.getSignature())); if (null_bitmap_ && value.isNull()) { null_bitmap_->setBit(position, true); } else { DCHECK(!value.isNull()); value.copyInto(static_cast<char*>(values_) + (position * type_length_)); } }
/** * @brief Append a TypedValue to this NativeColumnVector. * * @param value A value to append to this NativeColumnVector. **/ inline void appendTypedValue(const TypedValue &value) { DCHECK_LT(actual_length_, reserved_length_); DCHECK(value.isPlausibleInstanceOf(type_.getSignature())); if (null_bitmap_ && value.isNull()) { null_bitmap_->setBit(actual_length_, true); } else { DCHECK(!value.isNull()); value.copyInto(static_cast<char*>(values_) + (actual_length_ * type_length_)); } ++actual_length_; }
/** * @brief Fill this entire ColumnVector with copies of value. * * @param value A value to fill this ColumnVector with. **/ inline void fillWithValue(const TypedValue &value) { DCHECK(value.isPlausibleInstanceOf(type_.getSignature())); if (value.isNull()) { fillWithNulls(); } else { if (null_bitmap_) { null_bitmap_->clear(); } for (std::size_t pos = 0; pos < reserved_length_; ++pos) { value.copyInto(static_cast<char*>(values_) + (pos * type_length_)); } actual_length_ = reserved_length_; } }