21 namespace data_conversion {
26 const bool error_tracking_enabled)
32 auto typed_data =
reinterpret_cast<const std::string_view*
>(data);
35 bool tracking_individual_strings_required =
false;
36 size_t first_error_index = 0;
37 for (
size_t i = 0; i < num_elements; ++i) {
39 tracking_individual_strings_required =
true;
40 first_error_index = i;
45 if (!tracking_individual_strings_required) {
46 for (
size_t i = 0; i < num_elements; ++i) {
50 auto metadata = encoder->
appendData(typed_data, 0, num_elements,
false);
53 std::vector<std::string_view> tracked_strings(num_elements);
54 for (
size_t i = first_error_index; i < num_elements; ++i) {
56 tracked_strings[i] = {};
59 tracked_strings[i] = typed_data[i];
68 for (
size_t i = 0; i < num_elements; ++i) {
70 throw std::runtime_error(
"String length of " +
72 " exceeds allowed maximum string length of " +
77 ->appendData(typed_data, 0, num_elements,
false);
StringViewToStringNoneEncoder(const Chunk_NS::Chunk &dst_chunk, const bool error_tracking_enabled)
StringNoneEncoder * getEncoder() const
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) override
const ColumnDescriptor * getColumnDesc() const
void encodeAndAppendData(const int8_t *data, const size_t num_elements) override
SQLTypeInfo dst_type_info_
An AbstractBuffer is a unit of data management for a data manager.
std::optional< std::vector< bool > > delete_buffer_
AbstractBuffer * getBuffer() const
const Chunk_NS::Chunk & dst_chunk_
Encoder * getEncoder() const
static constexpr size_t MAX_STRLEN
const bool error_tracking_enabled_