64 std::ostream &
print(std::ostream &out)
const;
68 std::ostream &out)
const {
69 out <<
"[Bulk_load_error_location_details: filename=" <<
filename
81 return obj.
print(out);
96 m_data_len = std::numeric_limits<size_t>::max();
102 assert(
m_data_len != std::numeric_limits<size_t>::max() ||
104 return m_data_len == std::numeric_limits<size_t>::max();
142 std::ostream &
print(std::ostream &out)
const;
169 sout << std::setfill(
'0') << std::setw(2) << std::hex
178 out <<
"[Column_text: this=" <<
static_cast<const void *
>(
this)
179 <<
", m_data_ptr=" <<
static_cast<const void *
>(
m_data_ptr)
190 return obj.
print(out);
236 sout << std::setfill(
'0') << std::setw(2) << std::hex
251template <
typename Column_type>
268 template <
typename F>
276 template <
typename F>
282 if (!cbk(
m_columns[row_offset + index], last_col)) {
309 Column_type &
get_column(
size_t row_offset,
size_t col_index) {
311 assert(row_offset + col_index <
m_columns.size());
312 return m_columns[row_offset + col_index];
319 Column_type &
get_col(
size_t row_index,
size_t col_index) {
332 const Column_type &
read_column(
size_t row_offset,
size_t col_index)
const {
334 assert(row_offset + col_index <
m_columns.size());
335 return m_columns[row_offset + col_index];
344 if (n_rows > std::numeric_limits<uint32_t>::max() ||
465 std::ostream &
print(std::ostream &out)
const;
498 return obj.
print(out);
590 m_error =
"JSON document has more nesting levels than supported";
593 m_error =
"Invalid JSON value is encountered";
596 const char *message [[maybe_unused]])
const {
598 m_error +=
" (Internal Error)";
633 size_t &next_index,
char *
buffer,
size_t &buffer_length,
648 size_t start_index,
size_t &consumed_length,
700 size_t num_threads));
739 Blob_context blob_ctx,
unsigned char *blobref,
size_t thread,
740 const
unsigned char *data,
size_t data_len));
constexpr size_t BLOB_REF_SIZE
The blob reference size.
Definition: bulk_data_service.h:52
void * Blob_context
Definition: bulk_data_service.h:49
std::ostream & operator<<(std::ostream &out, const Bulk_load_error_location_details &obj)
Overloading the global output operator to print objects of type Bulk_load_error_location_details.
Definition: bulk_data_service.h:79
Definition: bulk_data_service.h:564
const char * c_str() const
Definition: bulk_data_service.h:573
void KeyTooBig() const override
Called when a JSON object contains a member with a name that is longer than supported by the JSON bin...
Definition: bulk_data_service.h:581
std::string get_error() const
Definition: bulk_data_service.h:575
std::string m_error
Definition: bulk_data_service.h:578
void InternalError(const char *message) const override
Called when an internal error occurs.
Definition: bulk_data_service.h:595
void ValueTooBig() const override
Called when a JSON document is too big to be stored in the JSON binary format.
Definition: bulk_data_service.h:585
void TooDeep() const override
Called when a JSON document has more nesting levels than supported.
Definition: bulk_data_service.h:589
void InvalidJson() const override
Called when an invalid JSON value is encountered.
Definition: bulk_data_service.h:592
bool CheckStack() const override
Check if the stack is about to be exhausted, and report the error.
Definition: bulk_data_service.h:601
Error handler for the functions that serialize a JSON value in the JSON binary storage format.
Definition: json_error_handler.h:49
Implements the row and column memory management for parse and load operations.
Definition: bulk_data_service.h:252
bool set_num_rows(size_t n_rows)
Set the number of rows.
Definition: bulk_data_service.h:342
std::vector< Column_type > m_columns
All the columns.
Definition: bulk_data_service.h:373
size_t get_next_row_offset(size_t &offset) const
Get next row offset from current row offset.
Definition: bulk_data_service.h:300
Column_type & get_col(size_t col_offset)
Get column using the column offset.
Definition: bulk_data_service.h:326
bool process_columns(size_t row_index, F &&cbk)
Process all columns, invoking callback for each.
Definition: bulk_data_service.h:269
bool process_columns_by_offset(size_t row_offset, F &&cbk)
Definition: bulk_data_service.h:277
size_t get_num_cols() const
Definition: bulk_data_service.h:262
size_t m_num_rows
Number of rows.
Definition: bulk_data_service.h:376
size_t get_row_offset(size_t row_index) const
Get current row offset to access columns.
Definition: bulk_data_service.h:292
size_t get_num_rows() const
Definition: bulk_data_service.h:259
const Column_type & read_column(size_t row_offset, size_t col_index) const
Get constant column for reading using row offset and column index.
Definition: bulk_data_service.h:332
Column_type & get_col(size_t row_index, size_t col_index)
Get column using row index and column index.
Definition: bulk_data_service.h:319
Row_bunch(size_t n_cols)
Create a new row bunch.
Definition: bulk_data_service.h:256
static const size_t S_MAX_TOTAL_COLS
Limit allocation up to 600M columns.
Definition: bulk_data_service.h:369
size_t m_num_columns
Number of columns in each row.
Definition: bulk_data_service.h:379
Column_type & get_column(size_t row_offset, size_t col_index)
Get column using row offset and column index.
Definition: bulk_data_service.h:309
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
@ MYSQL_TYPE_VARCHAR
Definition: field_types.h:71
@ MYSQL_TYPE_LONG_BLOB
Definition: field_types.h:86
@ MYSQL_TYPE_BLOB
Definition: field_types.h:87
@ MYSQL_TYPE_JSON
Definition: field_types.h:80
@ MYSQL_TYPE_TINY_BLOB
Definition: field_types.h:84
@ MYSQL_TYPE_LONG
Definition: field_types.h:59
@ MYSQL_TYPE_GEOMETRY
Definition: field_types.h:90
@ MYSQL_TYPE_MEDIUM_BLOB
Definition: field_types.h:85
static uint16 key1[1001]
Definition: hp_test2.cc:50
void error(const char *format,...)
int mysql_format_from_raw(char *buffer, size_t buffer_length, const Row_meta &metadata, size_t start_index, size_t &consumed_length, Rows_mysql &sql_rows) noexcept
Definition: bulk_data_service.cc:1710
int mysql_format(THD *thd, const TABLE *table, const Rows_text &text_rows, size_t &next_index, char *buffer, size_t &buffer_length, const CHARSET_INFO *charset, const Row_meta &metadata, Rows_mysql &sql_rows, Bulk_load_error_location_details &error_details) noexcept
Definition: bulk_data_service.cc:1739
bool get_row_metadata(THD *, const TABLE *table, bool have_key, Row_meta &metadata) noexcept
Definition: bulk_data_service.cc:1964
int mysql_format_using_key(const Row_meta &metadata, const Rows_mysql &sql_keys, size_t key_offset, Rows_mysql &sql_rows, size_t sql_index) noexcept
Definition: bulk_data_service.cc:1689
bool is_killed(THD *thd) noexcept
Definition: bulk_data_service.cc:1791
bool open_blob(THD *thd, void *load_ctx, const TABLE *table, Blob_context &blob_ctx, unsigned char *blobref, size_t thread) noexcept
Definition: bulk_data_service.cc:2147
size_t get_se_memory_size(THD *thd, const TABLE *table) noexcept
Definition: bulk_data_service.cc:2255
bool write_blob(THD *thd, void *load_ctx, const TABLE *table, Blob_context blob_ctx, unsigned char *blobref, size_t thread, const unsigned char *data, size_t data_len) noexcept
Definition: bulk_data_service.cc:2157
bool close_blob(THD *thd, void *load_ctx, const TABLE *table, Blob_context blob_ctx, unsigned char *blobref, size_t thread) noexcept
Definition: bulk_data_service.cc:2165
bool is_table_supported(THD *thd, const TABLE *table) noexcept
Definition: bulk_data_service.cc:2259
Definition: bulk_data_service.h:561
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
const std::string charset("charset")
bool load(THD *, const dd::String_type &fname, dd::String_type *buf)
Read an sdi file from disk and store in a buffer.
Definition: sdi_file.cc:308
Definition: aligned_atomic.h:44
const char * begin(const char *const c)
Definition: base64.h:44
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2871
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
Callbacks for collecting time statistics.
Definition: bulk_data_service.h:606
std::function< void()> m_fn_begin
Definition: bulk_data_service.h:608
std::function< void()> m_fn_end
Definition: bulk_data_service.h:610
Definition: bulk_data_service.h:54
std::string filename
Definition: bulk_data_service.h:55
std::string m_table_name
Definition: bulk_data_service.h:61
size_t m_bytes
Definition: bulk_data_service.h:62
size_t row_number
Definition: bulk_data_service.h:56
std::string column_input_data
Definition: bulk_data_service.h:59
std::string column_name
Definition: bulk_data_service.h:57
std::string m_error_mesg
Definition: bulk_data_service.h:60
std::ostream & print(std::ostream &out) const
Definition: bulk_data_service.h:67
std::string column_type
Definition: bulk_data_service.h:58
Definition: m_ctype.h:421
Definition: bulk_data_service.h:193
uint64_t m_int_data
Column data in integer format.
Definition: bulk_data_service.h:207
std::string to_string() const
Definition: bulk_data_service.h:212
bool m_is_null
If column is NULL.
Definition: bulk_data_service.h:201
char * m_data_ptr
Column data.
Definition: bulk_data_service.h:204
int16_t m_type
Column Data Type.
Definition: bulk_data_service.h:195
uint16_t m_data_len
Column data length.
Definition: bulk_data_service.h:198
Definition: bulk_data_service.h:84
bool is_null() const
Check if the column is null, by checking special value for length.
Definition: bulk_data_service.h:101
bool is_ext_relaxed() const
Check if the column data is stored externally.
Definition: bulk_data_service.h:121
bool m_is_ext
If true, the column data is stored externally.
Definition: bulk_data_service.h:148
void set_null()
Mark the column to be null, by setting length to a special value.
Definition: bulk_data_service.h:94
std::ostream & print(std::ostream &out) const
Print this object into the given output stream.
Definition: bulk_data_service.h:177
const char * m_data_ptr
Column data.
Definition: bulk_data_service.h:86
void init()
Initialize the members.
Definition: bulk_data_service.h:133
void set_ext()
Mark that the column data has been stored externally.
Definition: bulk_data_service.h:127
bool is_ext() const
Check if the column data is stored externally.
Definition: bulk_data_service.h:112
size_t m_data_len
Column data length.
Definition: bulk_data_service.h:89
std::string to_string() const
Definition: bulk_data_service.h:151