Skip to content

Commit 70e3bb0

Browse files
author
Catalin Besleaga
committed
WL#15045 Expand the json client library for HeatWave[relocate,noclose]
Moved the files used to make the json_client_library to the sql-common folder. Extended json_dom-t.cc with an extra benchmark test. Change-Id: I7ff681918d479883699b60267b1037f2d0139f10
1 parent 5de6452 commit 70e3bb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+181
-129
lines changed

Doxyfile-ignored

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015, 2021, Oracle and/or its affiliates.
1+
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0,
@@ -137,6 +137,7 @@ plugin/group_replication/src/applier.cc:[0-9]+: warning:
137137
plugin/version_token/version_token.cc:[0-9]+: warning:
138138
sql-common/client.cc:[0-9]+: warning:
139139
sql-common/compression.cc:[0-9]+: warning:
140+
sql-common/json_dom.h:[0-9]+: warning:
140141
sql-common/net_serv.cc:[0-9]+: warning:
141142
sql/auth/partitioned_rwlock.h:[0-9]+: warning:
142143
sql/auth/sha2_password.cc:[0-9]+: warning:
@@ -151,7 +152,6 @@ sql/handler.h:[0-9]+: warning:
151152
sql/item.h:[0-9]+: warning:
152153
sql/item_func.h:[0-9]+: warning:
153154
sql/join_optimizer/explain_access_path.h:[0-9]+: warning:
154-
sql/json_dom.h:[0-9]+: warning:
155155
sql/key.cc:[0-9]+: warning:
156156
sql/log.cc:[0-9]+: warning:
157157
sql/log_event.h:[0-9]+: warning:

client/CMakeLists.txt

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ OPTION(WITH_JSON_BINLOG_LIBRARY
9999
IF(WITH_JSON_BINLOG_LIBRARY)
100100
UNSET(INSTALL_JSON_BINLOG_LIBRARY)
101101
INSTALL(FILES
102-
../sql/json_binary.h
103-
DESTINATION ${INSTALL_INCLUDEDIR}/sql
104-
COMPONENT Development
105-
)
106-
INSTALL(FILES
102+
../sql-common/json_binary.h
107103
../sql-common/json_error_handler.h
108104
DESTINATION ${INSTALL_INCLUDEDIR}/sql-common
109105
COMPONENT Development
@@ -131,10 +127,10 @@ ENDIF()
131127
# Always build it, but do not *use* it for mysqlbinlog unless
132128
# WITH_JSON_BINLOG_LIBRARY=ON
133129
ADD_SHARED_LIBRARY(json_binlog
134-
${CMAKE_SOURCE_DIR}/sql/json_binary.cc
135-
${CMAKE_SOURCE_DIR}/sql/json_dom.cc
136-
${CMAKE_SOURCE_DIR}/sql/json_path.cc
137-
${CMAKE_SOURCE_DIR}/sql/json_syntax_check.cc
130+
${CMAKE_SOURCE_DIR}/sql-common/json_binary.cc
131+
${CMAKE_SOURCE_DIR}/sql-common/json_dom.cc
132+
${CMAKE_SOURCE_DIR}/sql-common/json_path.cc
133+
${CMAKE_SOURCE_DIR}/sql-common/json_syntax_check.cc
138134
${CMAKE_SOURCE_DIR}/sql-common/sql_string.cc
139135

140136
COMPILE_DEFINITIONS DISABLE_PSI_MUTEX EXPORT_JSON_FUNCTIONS
@@ -147,10 +143,10 @@ ADD_SHARED_LIBRARY(json_binlog
147143
)
148144

149145
ADD_CONVENIENCE_LIBRARY(json_client_library
150-
${CMAKE_SOURCE_DIR}/sql/json_binary.cc
151-
${CMAKE_SOURCE_DIR}/sql/json_dom.cc
152-
${CMAKE_SOURCE_DIR}/sql/json_path.cc
153-
${CMAKE_SOURCE_DIR}/sql/json_syntax_check.cc
146+
${CMAKE_SOURCE_DIR}/sql-common/json_binary.cc
147+
${CMAKE_SOURCE_DIR}/sql-common/json_dom.cc
148+
${CMAKE_SOURCE_DIR}/sql-common/json_path.cc
149+
${CMAKE_SOURCE_DIR}/sql-common/json_syntax_check.cc
154150
${CMAKE_SOURCE_DIR}/sql-common/sql_string.cc
155151

156152
COMPILE_DEFINITIONS DISABLE_PSI_MUTEX

client/json_binlog_main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include <string>
3131

32-
#include "sql/json_binary.h"
32+
#include "sql-common/json_binary.h"
3333

3434
int main() {
3535
json_binary::Value value = json_binary::parse_binary(nullptr, 0);

client/json_client_library_main.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#include <iostream>
2929
#include <string>
3030

31-
#include "sql/json_dom.h"
32-
#include "sql/json_path.h"
31+
#include "sql-common/json_dom.h"
32+
#include "sql-common/json_path.h"
3333

3434
#include "sql_string.h"
3535

sql/json_binary.cc renamed to sql-common/json_binary.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,27 @@
2020
along with this program; if not, write to the Free Software
2121
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2222

23-
#include "sql/json_binary.h"
23+
#include "sql-common/json_binary.h"
2424

2525
#include <string.h>
26+
2627
#include <algorithm> // std::min
2728
#include <cassert>
2829
#include <map>
2930
#include <memory>
3031
#include <string>
3132
#include <utility>
32-
3333
#include "m_ctype.h"
34+
3435
#include "my_byteorder.h"
3536
#include "my_sys.h"
3637
#include "mysqld_error.h"
3738
#ifdef MYSQL_SERVER
3839
#include "sql/check_stack.h"
3940
#endif
40-
#include "sql/field.h" // Field_json
41-
#include "sql/json_dom.h" // Json_dom
42-
#include "sql/json_syntax_check.h"
41+
#include "sql-common/json_dom.h" // Json_dom
42+
#include "sql-common/json_syntax_check.h"
43+
#include "sql/field.h" // Field_json
4344
#include "sql/sql_class.h" // THD
4445
#include "sql/sql_const.h"
4546
#include "sql/system_variables.h"
File renamed without changes.

sql/json_dom.cc renamed to sql-common/json_dom.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
along with this program; if not, write to the Free Software
2121
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2222

23-
#include "sql/json_dom.h"
23+
#include "sql-common/json_dom.h"
2424

2525
#include <errno.h>
2626
#include <float.h>
@@ -43,29 +43,29 @@
4343

4444
#include "base64.h"
4545
#include "decimal.h"
46-
#include "json_binary.h"
4746
#include "m_ctype.h"
4847
#include "m_string.h" // my_gcvt, _dig_vec_lower
49-
#include "malloc_allocator.h"
5048
#include "my_byteorder.h"
5149
#include "my_compare.h"
5250
#include "my_dbug.h"
53-
#include "my_decimal.h"
5451
#include "my_double2ulonglong.h"
5552
#include "my_sys.h"
5653
#include "my_time.h"
5754
#include "mysql/components/services/bits/psi_bits.h"
5855
#include "mysql/service_mysql_alloc.h"
5956
#include "mysql_com.h"
6057
#include "mysqld_error.h" // ER_*
58+
#include "sql/malloc_allocator.h"
59+
#include "sql/my_decimal.h"
6160
#ifdef MYSQL_SERVER
6261
#include "sql/check_stack.h"
6362
#endif
63+
#include "sql-common/json_binary.h"
64+
#include "sql-common/json_path.h"
65+
#include "sql-common/json_syntax_check.h"
6466
#include "sql/current_thd.h" // current_thd
6567
#include "sql/derror.h" // ER_THD
6668
#include "sql/field.h"
67-
#include "sql/json_path.h"
68-
#include "sql/json_syntax_check.h"
6969
#include "sql/psi_memory_key.h" // key_memory_JSON
7070
#include "sql/sql_class.h" // THD
7171
#include "sql/sql_const.h" // STACK_MIN_SIZE

sql/json_dom.h renamed to sql-common/json_dom.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@
3737

3838
#include "field_types.h" // enum_field_types
3939
#include "my_compiler.h"
40+
4041
#include "my_inttypes.h"
4142
#include "my_time.h" // my_time_flags_t
4243
#include "mysql/mysql_lex_string.h"
43-
#include "mysql_time.h" // MYSQL_TIME
44-
#include "prealloced_array.h" // Prealloced_array
45-
#include "sql/json_binary.h" // json_binary::Value
46-
#include "sql/malloc_allocator.h" // Malloc_allocator
47-
#include "sql/my_decimal.h" // my_decimal
44+
#include "mysql_time.h" // MYSQL_TIME
45+
#include "prealloced_array.h" // Prealloced_array
46+
#include "sql-common/json_binary.h" // json_binary::Value
47+
#include "sql/malloc_allocator.h" // Malloc_allocator
48+
#include "sql/my_decimal.h" // my_decimal
4849

4950
class Field_json;
5051
class Json_array;
@@ -65,7 +66,7 @@ using Json_array_ptr = std::unique_ptr<Json_array>;
6566
using Json_object_ptr = std::unique_ptr<Json_object>;
6667

6768
/**
68-
@file sql/json_dom.h
69+
@file
6970
JSON DOM.
7071
7172
When a JSON value is retrieved from a column, a prior it exists in

sql/json_path.cc renamed to sql-common/json_path.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
attached to WL#7909.
2929
*/
3030

31-
#include "sql/json_path.h"
31+
#include "sql-common/json_path.h"
3232

3333
#include "my_rapidjson_size_t.h" // IWYU pragma: keep
3434

@@ -44,7 +44,7 @@
4444
#include "m_string.h"
4545

4646
#include "my_inttypes.h"
47-
#include "sql/json_dom.h"
47+
#include "sql-common/json_dom.h"
4848
#include "sql/psi_memory_key.h" // key_memory_JSON
4949
#include "sql/sql_const.h" // STRING_BUFFER_USUAL_SIZE
5050
#include "sql_string.h" // String
File renamed without changes.

sql/json_syntax_check.cc renamed to sql-common/json_syntax_check.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
along with this program; if not, write to the Free Software
2121
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2222

23-
#include "sql/json_syntax_check.h"
23+
#include "sql-common/json_syntax_check.h"
2424

2525
#include "my_rapidjson_size_t.h" // IWYU pragma: keep
2626

File renamed without changes.

sql/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,8 @@ SET(SQL_SHARED_SOURCES
433433
join_optimizer/overflow_bitset.cc
434434
join_optimizer/print_utils.cc
435435
join_optimizer/replace_item.cc
436-
json_binary.cc
437436
json_diff.cc
438-
json_dom.cc
439-
json_path.cc
440437
json_schema.cc
441-
json_syntax_check.cc
442438
key.cc
443439
key_spec.cc
444440
keycaches.cc
@@ -772,7 +768,11 @@ SET(SQL_SOURCE
772768
../sql-common/oci/ssl.cc
773769
../sql-common/sql_string.cc
774770
../sql-common/bind_params.cc
771+
../sql-common/json_binary.cc
772+
../sql-common/json_dom.cc
775773
../sql-common/json_error_handler.cc
774+
../sql-common/json_path.cc
775+
../sql-common/json_syntax_check.cc
776776
command_service.cc
777777
conn_handler/channel_info.cc
778778
conn_handler/connection_handler_per_thread.cc

sql/auth/acl_table_user.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
3636
#include <utility>
3737

3838
#include "my_alloc.h"
39+
#include "sql-common/json_dom.h"
3940
#include "sql/auth/acl_table_base.h"
4041
#include "sql/auth/partial_revokes.h"
4142
#include "sql/auth/sql_mfa.h" /* I_multi_factor_auth */
4243
#include "sql/auth/user_table.h"
43-
#include "sql/json_dom.h"
4444

4545
class ACL_USER;
4646
class RowIterator;

sql/auth/partial_revokes.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2828
#include "mysql/components/services/log_shared.h"
2929
#include "mysqld_error.h"
3030
#include "partial_revokes.h"
31+
#include "sql-common/json_dom.h"
3132
#include "sql/auth/auth_acls.h"
3233
#include "sql/auth/auth_common.h"
3334
#include "sql/auth/auth_internal.h"
3435
#include "sql/auth/sql_auth_cache.h"
35-
#include "sql/json_dom.h"
3636
#include "sql/mysqld.h"
3737
#include "sql/sql_class.h"
3838
#include "sql/sql_lex.h"

sql/auth/sql_mfa.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2021, Oracle and/or its affiliates.
1+
/* Copyright (c) 2021, 2022, Oracle and/or its affiliates.
22
This program is free software; you can redistribute it and/or modify
33
it under the terms of the GNU General Public License, version 2.0,
44
as published by the Free Software Foundation.
@@ -25,8 +25,8 @@
2525
#include <string>
2626
#include <vector>
2727

28+
#include "sql-common/json_dom.h" // Json_array
2829
#include "sql/auth/user_table.h"
29-
#include "sql/json_dom.h" // Json_array
3030
#include "sql/mem_root_allocator.h"
3131
#include "sql/sql_class.h"
3232
#include "sql/table.h"

sql/dd/impl/types/column_statistics_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "m_string.h" // STRING_WITH_LEN
3535

3636
#include "mysql_com.h"
37+
#include "sql-common/json_dom.h" // Json_*
3738
#include "sql/auth/sql_security_ctx.h"
3839
#include "sql/current_thd.h" // current_thd
3940
#include "sql/dd/impl/dictionary_impl.h" // Dictionary_impl
@@ -43,7 +44,6 @@
4344
#include "sql/dd/impl/tables/column_statistics.h" // Column_statistics
4445
#include "sql/dd/impl/transaction_impl.h" // Open_dictionary_tables_ctx
4546
#include "sql/histograms/histogram.h" // histograms::Histogram
46-
#include "sql/json_dom.h" // Json_*
4747
#include "template_utils.h"
4848

4949
namespace dd {

sql/field.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#include "my_double2ulonglong.h"
4949
#include "my_sqlcommand.h"
5050
#include "myisampack.h"
51+
#include "sql-common/json_binary.h" // json_binary::serialize
52+
#include "sql-common/json_dom.h" // Json_dom, Json_wrapper
5153
#include "sql/create_field.h"
5254
#include "sql/current_thd.h"
5355
#include "sql/dd/cache/dictionary_client.h"
@@ -62,9 +64,7 @@
6264
#include "sql/item_json_func.h" // ensure_utf8mb4
6365
#include "sql/item_timefunc.h" // Item_func_now_local
6466
#include "sql/join_optimizer/bit_utils.h"
65-
#include "sql/json_binary.h" // json_binary::serialize
66-
#include "sql/json_diff.h" // Json_diff_vector
67-
#include "sql/json_dom.h" // Json_dom, Json_wrapper
67+
#include "sql/json_diff.h" // Json_diff_vector
6868
#include "sql/key.h"
6969
#include "sql/log_event.h" // class Table_map_log_event
7070
#include "sql/my_decimal.h"

sql/filesort.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include "mysql_com.h"
7272
#include "mysqld_error.h"
7373
#include "priority_queue.h"
74+
#include "sql-common/json_dom.h" // Json_wrapper
7475
#include "sql/auth/sql_security_ctx.h"
7576
#include "sql/bounded_queue.h"
7677
#include "sql/cmp_varlen_keys.h"
@@ -84,7 +85,6 @@
8485
#include "sql/item_subselect.h"
8586
#include "sql/iterators/row_iterator.h"
8687
#include "sql/iterators/sorting_iterator.h"
87-
#include "sql/json_dom.h" // Json_wrapper
8888
#include "sql/key_spec.h"
8989
#include "sql/malloc_allocator.h"
9090
#include "sql/merge_many_buff.h"

sql/histograms/equi_height.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#include "my_dbug.h"
3838
#include "my_inttypes.h"
3939
#include "mysql_time.h"
40+
#include "sql-common/json_dom.h" // Json_*
4041
#include "sql/histograms/equi_height_bucket.h"
4142
#include "sql/histograms/value_map.h" // Value_map
42-
#include "sql/json_dom.h" // Json_*
4343
#include "sql/mem_root_allocator.h"
4444
#include "sql_string.h"
4545
#include "template_utils.h"

sql/histograms/equi_height_bucket.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2016, 2021, Oracle and/or its affiliates.
1+
/* Copyright (c) 2016, 2022, Oracle and/or its affiliates.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -42,8 +42,8 @@
4242
#include "my_inttypes.h"
4343
#include "my_time.h"
4444
#include "mysql_time.h"
45+
#include "sql-common/json_dom.h" // Json_*
4546
#include "sql/histograms/value_map.h" // Histogram_comparator
46-
#include "sql/json_dom.h" // Json_*
4747
#include "sql/my_decimal.h" // my_decimal_cmp
4848
#include "sql/sql_time.h" // calc_time_diff
4949
#include "template_utils.h"

sql/histograms/histogram.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
#include "mysql/service_mysql_alloc.h"
5050
#include "mysql_time.h"
5151
#include "mysqld_error.h"
52-
#include "scope_guard.h" // create_scope_guard
52+
#include "scope_guard.h" // create_scope_guard
53+
#include "sql-common/json_dom.h" // Json_*
5354
#include "sql/auth/auth_common.h"
5455
#include "sql/dd/cache/dictionary_client.h"
5556
#include "sql/dd/dd.h"
@@ -64,7 +65,6 @@
6465
#include "sql/histograms/singleton.h" // Singleton<T>
6566
#include "sql/histograms/value_map.h" // Value_map
6667
#include "sql/item.h"
67-
#include "sql/json_dom.h" // Json_*
6868
#include "sql/key.h"
6969
#include "sql/mdl.h" // MDL_request
7070
#include "sql/my_decimal.h"

sql/histograms/singleton.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include "my_dbug.h"
3737
#include "my_inttypes.h"
3838
#include "mysql_time.h"
39+
#include "sql-common/json_dom.h" // Json_*
3940
#include "sql/histograms/value_map.h" // Value_map
40-
#include "sql/json_dom.h" // Json_*
4141
#include "template_utils.h"
4242

4343
struct MEM_ROOT;

0 commit comments

Comments
 (0)