22 namespace data_conversion {
24 template <
typename DataType,
typename MetadataType = DataType>
28 const bool error_tracking_enabled)
38 auto typed_data =
reinterpret_cast<const std::string_view*
>(data);
39 for (
size_t i = 0; i < num_elements; ++i) {
73 throw std::runtime_error(
"NULL value not allowed in NOT NULL column");
88 converted_value =
convert(typed_value);
94 }
catch (std::exception& except) {
102 return converted_value;
106 if constexpr (std::is_same<DataType, std::string_view>::value) {
116 CHECK(type_info.is_integer() || type_info.is_boolean() || type_info.is_fp() ||
117 type_info.is_decimal() || type_info.is_time_or_date());
124 switch (type_info.get_type()) {
void updateMetadataStats(const DataType &typed_value, const bool is_date_in_days=false)
const Chunk_NS::Chunk & dst_chunk_
std::optional< std::vector< bool > > & getDeleteBuffer()
DataType convertAndUpdateMetadata(const std::string_view &typed_value)
std::optional< DecimalOverflowValidator > decimal_overflow_validator_
const bool is_date_in_days_
const Chunk_NS::Chunk & getDstChunk() const
SQLTypeInfo dst_type_info_
DataType convert(const std::string_view &typed_value)
const ColumnDescriptor * getColumnDesc() const
An AbstractBuffer is a unit of data management for a data manager.
Datum StringToDatum(const std::string_view s, SQLTypeInfo &ti)
bool isNull(const DataType &typed_value)
std::optional< std::vector< bool > > delete_buffer_
StringViewToScalarEncoder(const Chunk_NS::Chunk &dst_chunk, const bool error_tracking_enabled)
AbstractBuffer * getBuffer() const
bool is_none_encoded_string() const
MetadataType MetadataType
virtual void append(int8_t *src, const size_t num_bytes, const MemoryLevel src_buffer_type=CPU_LEVEL, const int device_id=-1)=0
int64_t get_epoch_days_from_seconds(const int64_t seconds)
std::optional< DateDaysOverflowValidator > date_days_overflow_validator_
HOST DEVICE bool get_notnull() const
const bool error_tracking_enabled_
void encodeAndAppendData(const int8_t *data, const size_t num_elements) override