From 2740cbec7bb5a562501e2b93c32e51d0219d4f97 Mon Sep 17 00:00:00 2001 From: Leonid Fedorov <79837786+mariadb-LeonidFedorov@users.noreply.github.com> Date: Thu, 2 Oct 2025 14:44:51 +0400 Subject: [PATCH 01/19] fix(plugin,leak): One more memory leak in plugin (#3805) --- dbcon/mysql/ha_mcs_execplan_walks.cpp | 35 ++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/dbcon/mysql/ha_mcs_execplan_walks.cpp b/dbcon/mysql/ha_mcs_execplan_walks.cpp index 802f382c6..ab7aa071f 100644 --- a/dbcon/mysql/ha_mcs_execplan_walks.cpp +++ b/dbcon/mysql/ha_mcs_execplan_walks.cpp @@ -70,6 +70,31 @@ class RecursionCounter cal_impl_if::gp_walk_info* fgwip; }; +// RAII guard to automatically clean up work stacks on error. +// If a fatal parse error occurs, this ensures allocated objects +// are deleted when the guard goes out of scope, preventing memory leaks. +class CleanupGuard +{ + private: + CleanupGuard() = delete; + CleanupGuard(const CleanupGuard&) = delete; + CleanupGuard& operator=(const CleanupGuard&) = delete; + + public: + explicit CleanupGuard(cal_impl_if::gp_walk_info* gwip) : fgwip(gwip) + { + } + ~CleanupGuard() + { + if (fgwip->fatalParseError) + { + clearDeleteStacks(*fgwip); + } + } + + cal_impl_if::gp_walk_info* fgwip; +}; + bool isSecondArgumentConstItem(Item_func* ifp) { return (ifp->argument_count() == 2 && ifp->arguments()[1]->type() == Item::CONST_ITEM); @@ -89,6 +114,9 @@ void gp_walk(const Item* item, void* arg) cal_impl_if::gp_walk_info* gwip = static_cast(arg); idbassert(gwip); + // RAII guard: automatically cleans up work stacks on error when guard goes out of scope + CleanupGuard cleanup(gwip); + // Bailout... if (gwip->fatalParseError) return; @@ -815,12 +843,7 @@ void gp_walk(const Item* item, void* arg) } } - // Clean up allocated objects if a fatal parse error occurred - if (gwip->fatalParseError) - { - clearDeleteStacks(*gwip); - } - + // CleanupGuard will automatically clean up if fatalParseError is set return; } From f002c5abc14c859a48727c8539118d42d7a358f7 Mon Sep 17 00:00:00 2001 From: Leonid Fedorov Date: Thu, 2 Oct 2025 11:55:22 +0000 Subject: [PATCH 02/19] MCOL-5843: fix(extents): print corrent N/A for temporal extents --- datatypes/mcs_datatype.cpp | 27 ++++++++++++ datatypes/mcs_datatype.h | 10 +++-- .../mcs_calshowpartitions_empty_date.result | 42 +++++++++++++++++++ .../mcs_calshowpartitions_empty_date.test | 38 +++++++++++++++++ 4 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.result create mode 100644 mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.test diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index face4efdb..03b5f8e07 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -782,6 +783,32 @@ string TypeHandlerVarchar::formatPartitionInfo(const SystemCatalog::TypeAttribut return formatPartitionInfoSInt64(attr, pi); } +string TypeHandlerTemporal::formatPartitionInfo(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxInfo& pi) const +{ + ostringstreamL output; + // Check for empty/null partition + // For 4-byte temporal types (DATE), check int32 sentinels + // For 8-byte temporal types (DATETIME/TIMESTAMP), check int64 sentinels + bool isEmpty = false; + + if (attr.colWidth == 4) + { + isEmpty = pi.isEmptyOrNullSInt32(); + } + else + { + isEmpty = pi.isEmptyOrNullSInt64(); + } + + if (isEmpty) + output << setw(30) << "N/A" << setw(30) << "N/A"; + else + output << setw(30) << format(SimpleValueSInt64(pi.min), attr) << setw(30) + << format(SimpleValueSInt64(pi.max), attr); + return output.str(); +} + /****************************************************************************/ execplan::SimpleColumn* TypeHandlerSInt8::newSimpleColumn(const DatabaseQualifiedColumnName& name, diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index 509f0a5f6..b40174e62 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -745,6 +745,11 @@ class MinMaxInfo : greaterThan(mm.min, mm.max); } } + bool isEmptyOrNullSInt32() const + { + return min == std::numeric_limits::max() && max == std::numeric_limits::min(); + + } bool isEmptyOrNullSInt64() const { return min == std::numeric_limits::max() && max == std::numeric_limits::min(); @@ -2414,10 +2419,7 @@ class TypeHandlerTemporal : public TypeHandler { public: std::string formatPartitionInfo(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxInfo& i) const override - { - return formatPartitionInfoSInt64(attr, i); - } + const MinMaxInfo& i) const override; execplan::SimpleColumn* newSimpleColumn(const DatabaseQualifiedColumnName& name, SystemCatalog::TypeHolderStd& ct, const SimpleColumnParam& prm) const override; diff --git a/mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.result b/mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.result new file mode 100644 index 000000000..fe7afdec3 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.result @@ -0,0 +1,42 @@ +DROP DATABASE IF EXISTS test_empty_date; +CREATE DATABASE test_empty_date; +USE test_empty_date; +CREATE TABLE td (d DATE) ENGINE=ColumnStore; +SELECT calShowPartitions('td','d'); +calShowPartitions('td','d') +Part# Min Max Status + 0.0.1 N/A N/A Enabled +SELECT MIN(d) FROM td; +MIN(d) +NULL +SELECT calShowPartitions('td','d'); +calShowPartitions('td','d') +Part# Min Max Status + 0.0.1 N/A N/A Enabled +# Test with DATETIME as well +CREATE TABLE tdt (dt DATETIME) ENGINE=ColumnStore; +SELECT calShowPartitions('tdt','dt'); +calShowPartitions('tdt','dt') +Part# Min Max Status + 0.0.1 N/A N/A Enabled +SELECT MIN(dt) FROM tdt; +MIN(dt) +NULL +SELECT calShowPartitions('tdt','dt'); +calShowPartitions('tdt','dt') +Part# Min Max Status + 0.0.1 N/A N/A Enabled +# Test with TIMESTAMP +CREATE TABLE tts (ts TIMESTAMP) ENGINE=ColumnStore; +SELECT calShowPartitions('tts','ts'); +calShowPartitions('tts','ts') +Part# Min Max Status + 0.0.1 N/A N/A Enabled +SELECT MIN(ts) FROM tts; +MIN(ts) +NULL +SELECT calShowPartitions('tts','ts'); +calShowPartitions('tts','ts') +Part# Min Max Status + 0.0.1 N/A N/A Enabled +DROP DATABASE test_empty_date; diff --git a/mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.test b/mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.test new file mode 100644 index 000000000..f7c100b94 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcs_calshowpartitions_empty_date.test @@ -0,0 +1,38 @@ +--source ../include/have_columnstore.inc +--source ../include/functions.inc + +--disable_warnings +DROP DATABASE IF EXISTS test_empty_date; +--enable_warnings + +CREATE DATABASE test_empty_date; +USE test_empty_date; + +CREATE TABLE td (d DATE) ENGINE=ColumnStore; +--replace_regex / 0\.0\.. / 0.0.1 / +SELECT calShowPartitions('td','d'); +SELECT MIN(d) FROM td; +--replace_regex / 0\.0\.. / 0.0.1 / +SELECT calShowPartitions('td','d'); + +--echo # Test with DATETIME as well +CREATE TABLE tdt (dt DATETIME) ENGINE=ColumnStore; +--replace_regex / 0\.0\.. / 0.0.1 / +SELECT calShowPartitions('tdt','dt'); +SELECT MIN(dt) FROM tdt; +--replace_regex / 0\.0\.. / 0.0.1 / +SELECT calShowPartitions('tdt','dt'); + + +--echo # Test with TIMESTAMP +CREATE TABLE tts (ts TIMESTAMP) ENGINE=ColumnStore; +--replace_regex / 0\.0\.. / 0.0.1 / +SELECT calShowPartitions('tts','ts'); +SELECT MIN(ts) FROM tts; +--replace_regex / 0\.0\.. / 0.0.1 / +SELECT calShowPartitions('tts','ts'); + +DROP DATABASE test_empty_date; + +--source ../include/drop_functions.inc + From 6ab6694af5db721afa6c537a802e976f34db9d46 Mon Sep 17 00:00:00 2001 From: drrtuy Date: Fri, 3 Oct 2025 10:54:51 +0100 Subject: [PATCH 03/19] chore(): Bump VERSION up to 25.10.0-1 --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 1c93ec7ee..b20ede550 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -COLUMNSTORE_VERSION_MAJOR=23 +COLUMNSTORE_VERSION_MAJOR=25 COLUMNSTORE_VERSION_MINOR=10 -COLUMNSTORE_VERSION_PATCH=6 +COLUMNSTORE_VERSION_PATCH=0 COLUMNSTORE_VERSION_RELEASE=1 From 7842d8ab4b40c48c75f4847c5bbfa5e11b25ef03 Mon Sep 17 00:00:00 2001 From: drrtuy Date: Mon, 6 Oct 2025 12:01:50 +0100 Subject: [PATCH 04/19] chore(tests): disabled an unstable test to pass MTR @Jenkins for ES 11.8. --- mysql-test/columnstore/basic/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/columnstore/basic/disabled.def b/mysql-test/columnstore/basic/disabled.def index 5b647b179..ab1903bf2 100644 --- a/mysql-test/columnstore/basic/disabled.def +++ b/mysql-test/columnstore/basic/disabled.def @@ -1,4 +1,5 @@ mcs80_set_operations : BUG#MCOL-4273 2020-08-27 susil.behera@mariadb.com +mcs82_update_join: unstable MCOL-6201 2025-10-06 roman.nozdrin@mariadb.com mcs211_idbExtentId_function : 2021-07-12 david.halla@mariadb.com mcs212_idbExtentMax_function : 2020-11-30 bharath.bokka@mariadb.com mcs213_idbExtentMin_function : 2020-11-30 bharath.bokka@mariadb.com From 99392ed87fa565bc92439edaa0593d39b8bc76ca Mon Sep 17 00:00:00 2001 From: drrtuy Date: Tue, 7 Oct 2025 12:31:23 +0100 Subject: [PATCH 05/19] fix(cmapi,systemd): pre-save locks cleanup has been moved into mcs-savebrm.py (#3794) --- cmapi/cmapi_server/process_dispatchers/systemd.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmapi/cmapi_server/process_dispatchers/systemd.py b/cmapi/cmapi_server/process_dispatchers/systemd.py index 8f5184e58..1c68b0556 100644 --- a/cmapi/cmapi_server/process_dispatchers/systemd.py +++ b/cmapi/cmapi_server/process_dispatchers/systemd.py @@ -165,11 +165,6 @@ class SystemdDispatcher(BaseDispatcher): """ service_name = service if service_name == 'mcs-workernode': - # Run pre-stop lock reset before saving BRM - # These stale locks can occur if the controllernode couldn't stop correctly - # and they cause mcs-savebrm.py to hang - release_shmem_locks(logging.getLogger(__name__)) - service_name = f'{service_name}@1.service {service_name}@2.service' cls._workernode_enable(False, use_sudo) From 3cf57927793438d2c804b696f7f2665d744499e6 Mon Sep 17 00:00:00 2001 From: Aleksei Antipovskii Date: Thu, 9 Oct 2025 14:17:17 +0200 Subject: [PATCH 06/19] fix(build): fix compilation issue with 11.08-server --- dbcon/mysql/ha_mcs_sysvars.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/dbcon/mysql/ha_mcs_sysvars.cpp b/dbcon/mysql/ha_mcs_sysvars.cpp index 09d5bb57a..d8b754f1a 100644 --- a/dbcon/mysql/ha_mcs_sysvars.cpp +++ b/dbcon/mysql/ha_mcs_sysvars.cpp @@ -21,6 +21,23 @@ #include "ha_mcs_sysvars.h" #include "mcsconfig.h" +#if MYSQL_VERSION_ID >= 110800 +#define DEFINE_TYPELIB(A) { \ + array_elements(A) - 1, \ + #A, \ + A, \ + nullptr, \ + nullptr \ + } +#else +#define DEFINE_TYPELIB(A) { \ + array_elements(A) - 1, \ + #A, \ + A, \ + nullptr \ + } +#endif + const char* mcs_compression_type_names[] = {"SNAPPY", // 0 "SNAPPY", // 1 "SNAPPY", // 2 @@ -29,9 +46,7 @@ const char* mcs_compression_type_names[] = {"SNAPPY", // 0 #endif NullS}; -static TYPELIB mcs_compression_type_names_lib = {array_elements(mcs_compression_type_names) - 1, - "mcs_compression_type_names", mcs_compression_type_names, - NULL}; +static TYPELIB mcs_compression_type_names_lib = DEFINE_TYPELIB(mcs_compression_type_names); // compression type static MYSQL_THDVAR_ENUM(compression_type, PLUGIN_VAR_RQCMDARG, @@ -63,9 +78,7 @@ static MYSQL_THDVAR_ULONGLONG(original_option_bits, PLUGIN_VAR_NOSYSVAR | PLUGIN const char* mcs_select_handler_mode_values[] = {"OFF", "ON", "AUTO", NullS}; -static TYPELIB mcs_select_handler_mode_values_lib = {array_elements(mcs_select_handler_mode_values) - 1, - "mcs_select_handler_mode_values", - mcs_select_handler_mode_values, NULL}; +static TYPELIB mcs_select_handler_mode_values_lib = DEFINE_TYPELIB(mcs_select_handler_mode_values); static MYSQL_THDVAR_ENUM(select_handler, PLUGIN_VAR_RQCMDARG, "Set the MCS select_handler to Disabled, Enabled, or Automatic", @@ -178,9 +191,8 @@ static MYSQL_THDVAR_ULONG(import_for_batchinsert_enclosed_by, PLUGIN_VAR_RQCMDAR const char* mcs_use_import_for_batchinsert_mode_values[] = {"OFF", "ON", "ALWAYS", NullS}; -static TYPELIB mcs_use_import_for_batchinsert_mode_values_lib = { - array_elements(mcs_use_import_for_batchinsert_mode_values) - 1, - "mcs_use_import_for_batchinsert_mode_values", mcs_use_import_for_batchinsert_mode_values, NULL}; +static TYPELIB mcs_use_import_for_batchinsert_mode_values_lib = + DEFINE_TYPELIB(mcs_use_import_for_batchinsert_mode_values); static MYSQL_THDVAR_ENUM(use_import_for_batchinsert, PLUGIN_VAR_RQCMDARG, "LOAD DATA INFILE and INSERT..SELECT will use cpimport internally", @@ -694,3 +706,5 @@ bool get_innodb_queries_uses_mcs() { return SYSVAR(innodb_queries_use_mcs); } + +#undef DEFINE_TYPELIB \ No newline at end of file From 0eeb86fc202c3712fd78f1057a4f032b5a122894 Mon Sep 17 00:00:00 2001 From: julienfritsch44 Date: Fri, 10 Oct 2025 14:38:13 +0200 Subject: [PATCH 07/19] chore(docs): Update QueryAccelerator.md (#3811) Small changes --- docs/QueryAccelerator.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/QueryAccelerator.md b/docs/QueryAccelerator.md index 877acd5fb..b69c7c1e9 100644 --- a/docs/QueryAccelerator.md +++ b/docs/QueryAccelerator.md @@ -1,11 +1,11 @@ -# What is Query Accelarator +# What is Query Accelerator -Query Accelarator is a feature that allows MariaDB to use ColumnStore to execute queries that are otherwise executed by InnoDB. +Query Accelerator is a feature that allows MariaDB to use ColumnStore to execute queries that are otherwise executed by InnoDB. Under the hood Columnstore: - receives a query - searches for applicable Engine Independent statistics for InnoDB table index column - applies RBO rule to transform its InnoDB tables into a number of UNIONs over non-overlapping ranges of a suitable InnoDB table index -- retrives the data in parallel from MariaDB and runs it using Columnstore runtime +- retrieves the data in parallel from MariaDB and runs it using Columnstore runtime # How to enable Query Accelerator @@ -26,11 +26,11 @@ analyze table persistent for columns () indexes(); - `columnstore_unstable_optimizer`: enables unstable optimizer that is required for Query Accelerator RBO rule - `columnstore_select_handler`: enables/disables ColumnStore processing for InnoDB tables -- `columnstore_query_accel_parallel_factor` : controls the number of parallel ranges to be used for Query Accelerator +- `columnstore_query_accel_parallel_factor`: controls the number of parallel ranges to be used for Query Accelerator Watch out `max_connections`. If you set `columnstore_query_accel_parallel_factor` to a high value, you may need to increase `max_connections` to avoid connection pool exhaustion. -# How to verify QA is being used -There are two ways to verify QA is being used: +# How to verify Query Accelerator is being used +There are two ways to verify Query Accelerator is being used: 1. Use `select mcs_get_plan('rules')` to get a list of the rules that were applied to the query. 2. Look for patterns like `derived table - $added_sub_#db_name_#table_name_X` in the optimized plan using `select mcs_get_plan('optimized')`. From 5c834ac7cd5478d4df939a655121470412e4081d Mon Sep 17 00:00:00 2001 From: Sergey Zefirov <72864488+mariadb-SergeyZefirov@users.noreply.github.com> Date: Wed, 15 Oct 2025 16:54:35 +0300 Subject: [PATCH 08/19] fix(CEJ, segfault): MCOL-6198 - segfault during crossengine join * fix(CEJ, segfault): MCOL-6198 - segfault during crossengine join The patch moves joiners' initialization to a place after all possible allocations of smallSideRGs vector so pointer to it's data does not change anymore. This makes crash to cease. An appropriate test is added to bugfixes suite. * Change to test * Another dangling pointer * A change to test * A change to test --- ...MCOL-6198-segfault-crossengine-join.result | 17 + .../MCOL-6198-segfault-crossengine-join.test | 1234 +++++++++++++++++ .../primproc/batchprimitiveprocessor.cpp | 50 +- 3 files changed, 1290 insertions(+), 11 deletions(-) create mode 100644 mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result create mode 100644 mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test diff --git a/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result new file mode 100644 index 000000000..21aff1c26 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result @@ -0,0 +1,17 @@ +DROP DATABASE IF EXISTS MCOL_6198; +CREATE DATABASE MCOL_6198; +SELECT +v.c36 AS hst, +m.p6 AS g, +COALESCE(g0.eg_id,'MARIA') AS g01, +COALESCE(g1.eg_id,'MARIA') AS g02, +SUM(v.c758 * m.p42 / 100 + v.c759 * m.p42 / 100 + v.c760 * m.p42 / 100) AS sval +FROM +c AS v +JOIN p m on (v.c4 = m.a4) +LEFT OUTER JOIN group_g01 AS g0 ON g0.key_id=m.p6 +LEFT OUTER JOIN group_g02 AS g1 ON g1.key_id=m.p6 +WHERE +1=1 +GROUP BY c36,p6,g01,g02; +DROP DATABASE MCOL_6198; diff --git a/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test new file mode 100644 index 000000000..8d65b07cc --- /dev/null +++ b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test @@ -0,0 +1,1234 @@ +# Note this test check a completion of query, nothing else. +# Thus, almost all of logging and most of warnings are disabled. +-- source ../include/have_columnstore.inc +-- source include/have_innodb.inc + +--disable_warnings +DROP DATABASE IF EXISTS MCOL_6198; +CREATE DATABASE MCOL_6198; +--disable_query_log +--disable_result_log +USE MCOL_6198; +# +# Enable cross engine join +# Configure user and password in Columnstore.xml file +# +if (!$MASTER_MYPORT) +{ + # Running with --extern + let $MASTER_MYPORT=`SELECT @@port`; +} + +--exec $MCS_MCSSETCONFIG CrossEngineSupport User 'cejuser' +--exec $MCS_MCSSETCONFIG CrossEngineSupport Password 'Vagrant1|0000001' +--exec $MCS_MCSSETCONFIG CrossEngineSupport Port $MASTER_MYPORT +# +# Create corresponding in the server +# +CREATE USER IF NOT EXISTS'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001'; +GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost'; +FLUSH PRIVILEGES; +CREATE TABLE IF NOT EXISTS `p` ( + `a1` int(11) DEFAULT NULL, + `a2` varchar(8) DEFAULT NULL, + `a3` int(11) DEFAULT NULL, + `a4` decimal(22,0) DEFAULT NULL, + `a5` varchar(50) DEFAULT NULL, + `a6` int(11) DEFAULT NULL, + `a7` int(11) DEFAULT NULL, + `p1` int(11) DEFAULT NULL, + `p2` int(11) DEFAULT NULL, + `p3` int(11) DEFAULT NULL, + `p4` int(11) DEFAULT NULL, + `p5` int(11) DEFAULT NULL, + `p6` int(11) DEFAULT NULL, + `p7` int(11) DEFAULT NULL, + `p8` int(11) DEFAULT NULL, + `p9` int(11) DEFAULT NULL, + `p10` int(11) DEFAULT NULL, + `p11` int(11) DEFAULT NULL, + `p12` int(11) DEFAULT NULL, + `p13` int(11) DEFAULT NULL, + `p14` int(11) DEFAULT NULL, + `p15` int(11) DEFAULT NULL, + `p16` int(11) DEFAULT NULL, + `p17` int(11) DEFAULT NULL, + `p18` int(11) DEFAULT NULL, + `p19` int(11) DEFAULT NULL, + `p20` int(11) DEFAULT NULL, + `p21` int(11) DEFAULT NULL, + `p22` int(11) DEFAULT NULL, + `p23` int(11) DEFAULT NULL, + `p24` int(11) DEFAULT NULL, + `p25` int(11) DEFAULT NULL, + `p26` int(11) DEFAULT NULL, + `p27` int(11) DEFAULT NULL, + `p28` int(11) DEFAULT NULL, + `p29` int(11) DEFAULT NULL, + `p30` int(11) DEFAULT NULL, + `p31` int(11) DEFAULT NULL, + `p32` int(11) DEFAULT NULL, + `p33` int(11) DEFAULT NULL, + `p34` int(11) DEFAULT NULL, + `p35` int(11) DEFAULT NULL, + `p36` int(11) DEFAULT NULL, + `p37` int(11) DEFAULT NULL, + `p38` int(11) DEFAULT NULL, + `p39` int(11) DEFAULT NULL, + `p40` int(11) DEFAULT NULL, + `p41` int(11) DEFAULT NULL, + `p42` int(11) DEFAULT NULL, + `p43` int(11) DEFAULT NULL, + `p44` int(11) DEFAULT NULL +) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; + +CREATE TABLE IF NOT EXISTS `c` ( + `c1` tinyint(3) unsigned DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` tinyint(3) unsigned DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + `c17` int(11) DEFAULT NULL, + `c18` int(11) DEFAULT NULL, + `c19` int(11) DEFAULT NULL, + `c20` int(11) DEFAULT NULL, + `c21` int(11) DEFAULT NULL, + `c22` int(10) unsigned DEFAULT NULL, + `c23` int(11) DEFAULT NULL, + `c24` int(11) DEFAULT NULL, + `c25` int(11) DEFAULT NULL, + `c26` smallint(5) unsigned DEFAULT NULL, + `c27` decimal(10,3) DEFAULT NULL, + `c28` int(11) DEFAULT NULL, + `c29` int(11) DEFAULT NULL, + `c30` int(11) DEFAULT NULL, + `c31` int(11) DEFAULT NULL, + `c32` int(11) DEFAULT NULL, + `c33` tinyint(3) unsigned DEFAULT NULL, + `c34` int(10) unsigned DEFAULT NULL, + `c35` int(11) DEFAULT NULL, + `c36` int(10) unsigned DEFAULT NULL, + `c37` int(11) DEFAULT NULL, + `c38` int(11) DEFAULT NULL, + `c39` int(11) DEFAULT NULL, + `c40` int(11) DEFAULT NULL, + `c41` int(11) DEFAULT NULL, + `c42` int(11) DEFAULT NULL, + `c43` tinyint(3) unsigned DEFAULT NULL, + `c44` smallint(5) unsigned DEFAULT NULL, + `c45` int(10) unsigned DEFAULT NULL, + `c46` int(11) DEFAULT NULL, + `c47` tinyint(3) unsigned DEFAULT NULL, + `c48` tinyint(3) unsigned DEFAULT NULL, + `c49` smallint(5) unsigned DEFAULT NULL, + `c50` tinyint(3) unsigned DEFAULT NULL, + `c51` tinyint(3) unsigned DEFAULT NULL, + `c52` smallint(6) DEFAULT NULL, + `c53` int(11) DEFAULT NULL, + `c54` int(11) DEFAULT NULL, + `c55` int(11) DEFAULT NULL, + `c56` int(11) DEFAULT NULL, + `c57` int(11) DEFAULT NULL, + `c58` int(11) DEFAULT NULL, + `c59` int(11) DEFAULT NULL, + `c60` int(11) DEFAULT NULL, + `c61` int(11) DEFAULT NULL, + `c62` int(11) DEFAULT NULL, + `c63` int(11) DEFAULT NULL, + `c64` int(10) unsigned DEFAULT NULL, + `c65` tinyint(3) unsigned DEFAULT NULL, + `c66` smallint(6) DEFAULT NULL, + `c67` int(11) DEFAULT NULL, + `c68` int(11) DEFAULT NULL, + `c69` int(11) DEFAULT NULL, + `c70` smallint(5) unsigned DEFAULT NULL, + `c71` smallint(5) unsigned DEFAULT NULL, + `c72` int(11) DEFAULT NULL, + `c73` int(11) DEFAULT NULL, + `c74` int(11) DEFAULT NULL, + `c75` int(11) DEFAULT NULL, + `c76` int(11) DEFAULT NULL, + `c77` int(11) DEFAULT NULL, + `c78` int(11) DEFAULT NULL, + `c79` int(11) DEFAULT NULL, + `c80` int(11) DEFAULT NULL, + `c81` int(11) DEFAULT NULL, + `c82` int(11) DEFAULT NULL, + `c83` int(11) DEFAULT NULL, + `c84` int(11) DEFAULT NULL, + `c85` int(11) DEFAULT NULL, + `c86` int(11) DEFAULT NULL, + `c87` int(11) DEFAULT NULL, + `c88` int(11) DEFAULT NULL, + `c89` int(11) DEFAULT NULL, + `c90` int(11) DEFAULT NULL, + `c91` decimal(12,2) DEFAULT NULL, + `c92` int(11) DEFAULT NULL, + `c93` int(11) DEFAULT NULL, + `c94` int(11) DEFAULT NULL, + `c95` int(11) DEFAULT NULL, + `c96` int(11) DEFAULT NULL, + `c97` int(11) DEFAULT NULL, + `c98` int(11) DEFAULT NULL, + `c99` int(11) DEFAULT NULL, + `c100` int(11) DEFAULT NULL, + `c101` int(11) DEFAULT NULL, + `c102` int(11) DEFAULT NULL, + `c103` int(11) DEFAULT NULL, + `c104` int(11) DEFAULT NULL, + `c105` int(11) DEFAULT NULL, + `c106` int(11) DEFAULT NULL, + `c107` int(11) DEFAULT NULL, + `c108` int(11) DEFAULT NULL, + `c109` int(11) DEFAULT NULL, + `c110` int(11) DEFAULT NULL, + `c111` int(11) DEFAULT NULL, + `c112` int(11) DEFAULT NULL, + `c113` int(11) DEFAULT NULL, + `c114` int(11) DEFAULT NULL, + `c115` int(11) DEFAULT NULL, + `c116` int(11) DEFAULT NULL, + `c117` int(11) DEFAULT NULL, + `c118` int(11) DEFAULT NULL, + `c119` int(11) DEFAULT NULL, + `c120` decimal(12,2) DEFAULT NULL, + `c121` int(11) DEFAULT NULL, + `c122` int(11) DEFAULT NULL, + `c123` int(11) DEFAULT NULL, + `c124` int(11) DEFAULT NULL, + `c125` int(11) DEFAULT NULL, + `c126` int(11) DEFAULT NULL, + `c127` int(11) DEFAULT NULL, + `c128` int(11) DEFAULT NULL, + `c129` int(11) DEFAULT NULL, + `c130` int(11) DEFAULT NULL, + `c131` int(11) DEFAULT NULL, + `c132` int(11) DEFAULT NULL, + `c133` int(11) DEFAULT NULL, + `c134` int(11) DEFAULT NULL, + `c135` int(11) DEFAULT NULL, + `c136` int(11) DEFAULT NULL, + `c137` int(11) DEFAULT NULL, + `c138` int(11) DEFAULT NULL, + `c139` decimal(12,2) DEFAULT NULL, + `c140` int(11) DEFAULT NULL, + `c141` int(11) DEFAULT NULL, + `c142` int(11) DEFAULT NULL, + `c143` int(11) DEFAULT NULL, + `c144` int(11) DEFAULT NULL, + `c145` int(11) DEFAULT NULL, + `c146` int(11) DEFAULT NULL, + `c147` int(11) DEFAULT NULL, + `c148` int(11) DEFAULT NULL, + `c149` int(11) DEFAULT NULL, + `c150` int(11) DEFAULT NULL, + `c151` int(11) DEFAULT NULL, + `c152` int(11) DEFAULT NULL, + `c153` int(11) DEFAULT NULL, + `c154` int(11) DEFAULT NULL, + `c155` int(11) DEFAULT NULL, + `c156` int(11) DEFAULT NULL, + `c157` int(11) DEFAULT NULL, + `c158` decimal(12,2) DEFAULT NULL, + `c159` int(11) DEFAULT NULL, + `c160` int(11) DEFAULT NULL, + `c161` int(11) DEFAULT NULL, + `c162` int(11) DEFAULT NULL, + `c163` int(11) DEFAULT NULL, + `c164` int(11) DEFAULT NULL, + `c165` int(11) DEFAULT NULL, + `c166` int(11) DEFAULT NULL, + `c167` int(11) DEFAULT NULL, + `c168` int(11) DEFAULT NULL, + `c169` int(11) DEFAULT NULL, + `c170` int(11) DEFAULT NULL, + `c171` int(11) DEFAULT NULL, + `c172` int(11) DEFAULT NULL, + `c173` int(11) DEFAULT NULL, + `c174` int(11) DEFAULT NULL, + `c175` int(11) DEFAULT NULL, + `c176` int(11) DEFAULT NULL, + `c177` decimal(12,2) DEFAULT NULL, + `c178` int(11) DEFAULT NULL, + `c179` int(11) DEFAULT NULL, + `c180` int(11) DEFAULT NULL, + `c181` int(11) DEFAULT NULL, + `c182` int(11) DEFAULT NULL, + `c183` int(11) DEFAULT NULL, + `c184` int(11) DEFAULT NULL, + `c185` int(11) DEFAULT NULL, + `c186` int(11) DEFAULT NULL, + `c187` int(11) DEFAULT NULL, + `c188` int(11) DEFAULT NULL, + `c189` int(11) DEFAULT NULL, + `c190` int(11) DEFAULT NULL, + `c191` int(11) DEFAULT NULL, + `c192` int(11) DEFAULT NULL, + `c193` int(11) DEFAULT NULL, + `c194` int(11) DEFAULT NULL, + `c195` int(11) DEFAULT NULL, + `c196` decimal(12,2) DEFAULT NULL, + `c197` int(11) DEFAULT NULL, + `c198` int(11) DEFAULT NULL, + `c199` int(11) DEFAULT NULL, + `c200` int(11) DEFAULT NULL, + `c201` int(11) DEFAULT NULL, + `c202` int(11) DEFAULT NULL, + `c203` int(11) DEFAULT NULL, + `c204` int(11) DEFAULT NULL, + `c205` int(11) DEFAULT NULL, + `c206` int(11) DEFAULT NULL, + `c207` int(11) DEFAULT NULL, + `c208` int(11) DEFAULT NULL, + `c209` int(11) DEFAULT NULL, + `c210` int(11) DEFAULT NULL, + `c211` int(11) DEFAULT NULL, + `c212` int(11) DEFAULT NULL, + `c213` int(11) DEFAULT NULL, + `c214` int(11) DEFAULT NULL, + `c215` decimal(12,2) DEFAULT NULL, + `c216` int(11) DEFAULT NULL, + `c217` int(11) DEFAULT NULL, + `c218` int(11) DEFAULT NULL, + `c219` int(11) DEFAULT NULL, + `c220` int(11) DEFAULT NULL, + `c221` int(11) DEFAULT NULL, + `c222` int(11) DEFAULT NULL, + `c223` int(11) DEFAULT NULL, + `c224` int(11) DEFAULT NULL, + `c225` int(11) DEFAULT NULL, + `c226` int(11) DEFAULT NULL, + `c227` int(11) DEFAULT NULL, + `c228` int(11) DEFAULT NULL, + `c229` int(11) DEFAULT NULL, + `c230` int(11) DEFAULT NULL, + `c231` int(11) DEFAULT NULL, + `c232` int(11) DEFAULT NULL, + `c233` int(11) DEFAULT NULL, + `c234` decimal(12,2) DEFAULT NULL, + `c235` int(11) DEFAULT NULL, + `c236` int(11) DEFAULT NULL, + `c237` int(11) DEFAULT NULL, + `c238` int(11) DEFAULT NULL, + `c239` int(11) DEFAULT NULL, + `c240` int(11) DEFAULT NULL, + `c241` int(11) DEFAULT NULL, + `c242` int(11) DEFAULT NULL, + `c243` int(11) DEFAULT NULL, + `c244` int(11) DEFAULT NULL, + `c245` int(11) DEFAULT NULL, + `c246` int(11) DEFAULT NULL, + `c247` int(11) DEFAULT NULL, + `c248` int(11) DEFAULT NULL, + `c249` int(11) DEFAULT NULL, + `c250` int(11) DEFAULT NULL, + `c251` int(11) DEFAULT NULL, + `c252` int(11) DEFAULT NULL, + `c253` int(11) DEFAULT NULL, + `c254` int(11) DEFAULT NULL, + `c255` int(11) DEFAULT NULL, + `c256` int(11) DEFAULT NULL, + `c257` int(11) DEFAULT NULL, + `c258` int(11) DEFAULT NULL, + `c259` int(11) DEFAULT NULL, + `c260` int(11) DEFAULT NULL, + `c261` decimal(12,2) DEFAULT NULL, + `c262` int(11) DEFAULT NULL, + `c263` int(11) DEFAULT NULL, + `c264` int(11) DEFAULT NULL, + `c265` int(11) DEFAULT NULL, + `c266` int(11) DEFAULT NULL, + `c267` int(11) DEFAULT NULL, + `c268` int(11) DEFAULT NULL, + `c269` int(11) DEFAULT NULL, + `c270` int(11) DEFAULT NULL, + `c271` int(11) DEFAULT NULL, + `c272` decimal(12,2) DEFAULT NULL, + `c273` int(11) DEFAULT NULL, + `c274` int(11) DEFAULT NULL, + `c275` int(11) DEFAULT NULL, + `c276` int(11) DEFAULT NULL, + `c277` int(11) DEFAULT NULL, + `c278` int(11) DEFAULT NULL, + `c279` int(11) DEFAULT NULL, + `c280` int(11) DEFAULT NULL, + `c281` decimal(12,2) DEFAULT NULL, + `c282` int(11) DEFAULT NULL, + `c283` int(11) DEFAULT NULL, + `c284` int(11) DEFAULT NULL, + `c285` int(11) DEFAULT NULL, + `c286` int(11) DEFAULT NULL, + `c287` int(11) DEFAULT NULL, + `c288` int(11) DEFAULT NULL, + `c289` int(11) DEFAULT NULL, + `c290` int(11) DEFAULT NULL, + `c291` int(11) DEFAULT NULL, + `c292` int(11) DEFAULT NULL, + `c293` int(11) DEFAULT NULL, + `c294` int(11) DEFAULT NULL, + `c295` int(11) DEFAULT NULL, + `c296` int(11) DEFAULT NULL, + `c297` int(11) DEFAULT NULL, + `c298` int(11) DEFAULT NULL, + `c299` int(11) DEFAULT NULL, + `c300` decimal(12,2) DEFAULT NULL, + `c301` int(11) DEFAULT NULL, + `c302` int(11) DEFAULT NULL, + `c303` int(11) DEFAULT NULL, + `c304` int(11) DEFAULT NULL, + `c305` int(11) DEFAULT NULL, + `c306` int(11) DEFAULT NULL, + `c307` int(11) DEFAULT NULL, + `c308` int(11) DEFAULT NULL, + `c309` int(11) DEFAULT NULL, + `c310` int(11) DEFAULT NULL, + `c311` int(11) DEFAULT NULL, + `c312` int(11) DEFAULT NULL, + `c313` int(11) DEFAULT NULL, + `c314` int(11) DEFAULT NULL, + `c315` int(11) DEFAULT NULL, + `c316` int(11) DEFAULT NULL, + `c317` int(11) DEFAULT NULL, + `c318` int(11) DEFAULT NULL, + `c319` int(11) DEFAULT NULL, + `c320` int(11) DEFAULT NULL, + `c321` int(11) DEFAULT NULL, + `c322` int(11) DEFAULT NULL, + `c323` int(11) DEFAULT NULL, + `c324` int(11) DEFAULT NULL, + `c325` int(11) DEFAULT NULL, + `c326` int(11) DEFAULT NULL, + `c327` int(11) DEFAULT NULL, + `c328` int(11) DEFAULT NULL, + `c329` decimal(12,2) DEFAULT NULL, + `c330` int(11) DEFAULT NULL, + `c331` int(11) DEFAULT NULL, + `c332` int(11) DEFAULT NULL, + `c333` int(11) DEFAULT NULL, + `c334` int(11) DEFAULT NULL, + `c335` int(11) DEFAULT NULL, + `c336` int(11) DEFAULT NULL, + `c337` int(11) DEFAULT NULL, + `c338` int(11) DEFAULT NULL, + `c339` int(11) DEFAULT NULL, + `c340` int(11) DEFAULT NULL, + `c341` int(11) DEFAULT NULL, + `c342` int(11) DEFAULT NULL, + `c343` int(11) DEFAULT NULL, + `c344` int(11) DEFAULT NULL, + `c345` int(11) DEFAULT NULL, + `c346` int(11) DEFAULT NULL, + `c347` int(11) DEFAULT NULL, + `c348` decimal(12,2) DEFAULT NULL, + `c349` int(11) DEFAULT NULL, + `c350` int(11) DEFAULT NULL, + `c351` int(11) DEFAULT NULL, + `c352` int(11) DEFAULT NULL, + `c353` int(11) DEFAULT NULL, + `c354` int(11) DEFAULT NULL, + `c355` int(11) DEFAULT NULL, + `c356` int(11) DEFAULT NULL, + `c357` int(11) DEFAULT NULL, + `c358` int(11) DEFAULT NULL, + `c359` int(11) DEFAULT NULL, + `c360` int(11) DEFAULT NULL, + `c361` int(11) DEFAULT NULL, + `c362` int(11) DEFAULT NULL, + `c363` int(11) DEFAULT NULL, + `c364` int(11) DEFAULT NULL, + `c365` int(11) DEFAULT NULL, + `c366` int(11) DEFAULT NULL, + `c367` decimal(12,2) DEFAULT NULL, + `c368` int(11) DEFAULT NULL, + `c369` int(11) DEFAULT NULL, + `c370` int(11) DEFAULT NULL, + `c371` int(11) DEFAULT NULL, + `c372` int(11) DEFAULT NULL, + `c373` int(11) DEFAULT NULL, + `c374` int(11) DEFAULT NULL, + `c375` int(11) DEFAULT NULL, + `c376` int(11) DEFAULT NULL, + `c377` int(11) DEFAULT NULL, + `c378` int(11) DEFAULT NULL, + `c379` int(11) DEFAULT NULL, + `c380` int(11) DEFAULT NULL, + `c381` int(11) DEFAULT NULL, + `c382` int(11) DEFAULT NULL, + `c383` int(11) DEFAULT NULL, + `c384` int(11) DEFAULT NULL, + `c385` int(11) DEFAULT NULL, + `c386` decimal(12,2) DEFAULT NULL, + `c387` int(11) DEFAULT NULL, + `c388` int(11) DEFAULT NULL, + `c389` int(11) DEFAULT NULL, + `c390` int(11) DEFAULT NULL, + `c391` int(11) DEFAULT NULL, + `c392` int(11) DEFAULT NULL, + `c393` int(11) DEFAULT NULL, + `c394` int(11) DEFAULT NULL, + `c395` int(11) DEFAULT NULL, + `c396` int(11) DEFAULT NULL, + `c397` int(11) DEFAULT NULL, + `c398` int(11) DEFAULT NULL, + `c399` int(11) DEFAULT NULL, + `c400` int(11) DEFAULT NULL, + `c401` int(11) DEFAULT NULL, + `c402` int(11) DEFAULT NULL, + `c403` int(11) DEFAULT NULL, + `c404` int(11) DEFAULT NULL, + `c405` decimal(12,2) DEFAULT NULL, + `c406` int(11) DEFAULT NULL, + `c407` int(11) DEFAULT NULL, + `c408` int(11) DEFAULT NULL, + `c409` int(11) DEFAULT NULL, + `c410` int(11) DEFAULT NULL, + `c411` int(11) DEFAULT NULL, + `c412` int(11) DEFAULT NULL, + `c413` int(11) DEFAULT NULL, + `c414` int(11) DEFAULT NULL, + `c415` int(11) DEFAULT NULL, + `c416` int(11) DEFAULT NULL, + `c417` int(11) DEFAULT NULL, + `c418` int(11) DEFAULT NULL, + `c419` int(11) DEFAULT NULL, + `c420` int(11) DEFAULT NULL, + `c421` int(11) DEFAULT NULL, + `c422` int(11) DEFAULT NULL, + `c423` int(11) DEFAULT NULL, + `c424` decimal(12,2) DEFAULT NULL, + `c425` int(11) DEFAULT NULL, + `c426` int(11) DEFAULT NULL, + `c427` int(11) DEFAULT NULL, + `c428` int(11) DEFAULT NULL, + `c429` int(11) DEFAULT NULL, + `c430` int(11) DEFAULT NULL, + `c431` int(11) DEFAULT NULL, + `c432` int(11) DEFAULT NULL, + `c433` int(11) DEFAULT NULL, + `c434` int(11) DEFAULT NULL, + `c435` int(11) DEFAULT NULL, + `c436` int(11) DEFAULT NULL, + `c437` int(11) DEFAULT NULL, + `c438` int(11) DEFAULT NULL, + `c439` int(11) DEFAULT NULL, + `c440` int(11) DEFAULT NULL, + `c441` int(11) DEFAULT NULL, + `c442` int(11) DEFAULT NULL, + `c443` decimal(12,2) DEFAULT NULL, + `c444` int(11) DEFAULT NULL, + `c445` int(11) DEFAULT NULL, + `c446` int(11) DEFAULT NULL, + `c447` int(11) DEFAULT NULL, + `c448` int(11) DEFAULT NULL, + `c449` int(11) DEFAULT NULL, + `c450` int(11) DEFAULT NULL, + `c451` int(11) DEFAULT NULL, + `c452` int(11) DEFAULT NULL, + `c453` int(11) DEFAULT NULL, + `c454` int(11) DEFAULT NULL, + `c455` int(11) DEFAULT NULL, + `c456` int(11) DEFAULT NULL, + `c457` int(11) DEFAULT NULL, + `c458` int(11) DEFAULT NULL, + `c459` int(11) DEFAULT NULL, + `c460` int(11) DEFAULT NULL, + `c461` int(11) DEFAULT NULL, + `c462` int(11) DEFAULT NULL, + `c463` int(11) DEFAULT NULL, + `c464` int(11) DEFAULT NULL, + `c465` int(11) DEFAULT NULL, + `c466` int(11) DEFAULT NULL, + `c467` int(11) DEFAULT NULL, + `c468` int(11) DEFAULT NULL, + `c469` int(11) DEFAULT NULL, + `c470` decimal(12,2) DEFAULT NULL, + `c471` int(11) DEFAULT NULL, + `c472` int(11) DEFAULT NULL, + `c473` int(11) DEFAULT NULL, + `c474` int(11) DEFAULT NULL, + `c475` int(11) DEFAULT NULL, + `c476` int(11) DEFAULT NULL, + `c477` int(11) DEFAULT NULL, + `c478` int(11) DEFAULT NULL, + `c479` int(11) DEFAULT NULL, + `c480` int(11) DEFAULT NULL, + `c481` decimal(12,2) DEFAULT NULL, + `c482` int(11) DEFAULT NULL, + `c483` int(11) DEFAULT NULL, + `c484` int(11) DEFAULT NULL, + `c485` int(11) DEFAULT NULL, + `c486` int(11) DEFAULT NULL, + `c487` int(11) DEFAULT NULL, + `c488` int(11) DEFAULT NULL, + `c489` int(11) DEFAULT NULL, + `c490` decimal(12,2) DEFAULT NULL, + `c491` int(11) DEFAULT NULL, + `c492` int(11) DEFAULT NULL, + `c493` int(11) DEFAULT NULL, + `c494` int(11) DEFAULT NULL, + `c495` int(11) DEFAULT NULL, + `c496` int(11) DEFAULT NULL, + `c497` int(11) DEFAULT NULL, + `c498` int(11) DEFAULT NULL, + `c499` int(11) DEFAULT NULL, + `c500` int(11) DEFAULT NULL, + `c501` int(11) DEFAULT NULL, + `c502` int(11) DEFAULT NULL, + `c503` int(11) DEFAULT NULL, + `c504` int(11) DEFAULT NULL, + `c505` int(11) DEFAULT NULL, + `c506` int(11) DEFAULT NULL, + `c507` int(11) DEFAULT NULL, + `c508` int(11) DEFAULT NULL, + `c509` decimal(12,2) DEFAULT NULL, + `c510` int(11) DEFAULT NULL, + `c511` int(11) DEFAULT NULL, + `c512` int(11) DEFAULT NULL, + `c513` int(11) DEFAULT NULL, + `c514` int(11) DEFAULT NULL, + `c515` int(11) DEFAULT NULL, + `c516` int(11) DEFAULT NULL, + `c517` int(11) DEFAULT NULL, + `c518` int(11) DEFAULT NULL, + `c519` int(11) DEFAULT NULL, + `c520` int(11) DEFAULT NULL, + `c521` int(11) DEFAULT NULL, + `c522` int(11) DEFAULT NULL, + `c523` int(11) DEFAULT NULL, + `c524` int(11) DEFAULT NULL, + `c525` int(11) DEFAULT NULL, + `c526` int(11) DEFAULT NULL, + `c527` int(11) DEFAULT NULL, + `c528` int(11) DEFAULT NULL, + `c529` int(11) DEFAULT NULL, + `c530` int(11) DEFAULT NULL, + `c531` int(11) DEFAULT NULL, + `c532` int(11) DEFAULT NULL, + `c533` int(11) DEFAULT NULL, + `c534` int(11) DEFAULT NULL, + `c535` int(11) DEFAULT NULL, + `c536` int(11) DEFAULT NULL, + `c537` int(11) DEFAULT NULL, + `c538` decimal(12,2) DEFAULT NULL, + `c539` int(11) DEFAULT NULL, + `c540` int(11) DEFAULT NULL, + `c541` int(11) DEFAULT NULL, + `c542` int(11) DEFAULT NULL, + `c543` int(11) DEFAULT NULL, + `c544` int(11) DEFAULT NULL, + `c545` int(11) DEFAULT NULL, + `c546` int(11) DEFAULT NULL, + `c547` int(11) DEFAULT NULL, + `c548` int(11) DEFAULT NULL, + `c549` int(11) DEFAULT NULL, + `c550` int(11) DEFAULT NULL, + `c551` int(11) DEFAULT NULL, + `c552` int(11) DEFAULT NULL, + `c553` int(11) DEFAULT NULL, + `c554` int(11) DEFAULT NULL, + `c555` int(11) DEFAULT NULL, + `c556` int(11) DEFAULT NULL, + `c557` decimal(12,2) DEFAULT NULL, + `c558` int(11) DEFAULT NULL, + `c559` int(11) DEFAULT NULL, + `c560` int(11) DEFAULT NULL, + `c561` int(11) DEFAULT NULL, + `c562` int(11) DEFAULT NULL, + `c563` int(11) DEFAULT NULL, + `c564` int(11) DEFAULT NULL, + `c565` int(11) DEFAULT NULL, + `c566` int(11) DEFAULT NULL, + `c567` int(11) DEFAULT NULL, + `c568` int(11) DEFAULT NULL, + `c569` int(11) DEFAULT NULL, + `c570` int(11) DEFAULT NULL, + `c571` int(11) DEFAULT NULL, + `c572` int(11) DEFAULT NULL, + `c573` int(11) DEFAULT NULL, + `c574` int(11) DEFAULT NULL, + `c575` int(11) DEFAULT NULL, + `c576` decimal(12,2) DEFAULT NULL, + `c577` int(11) DEFAULT NULL, + `c578` int(11) DEFAULT NULL, + `c579` int(11) DEFAULT NULL, + `c580` int(11) DEFAULT NULL, + `c581` int(11) DEFAULT NULL, + `c582` int(11) DEFAULT NULL, + `c583` int(11) DEFAULT NULL, + `c584` int(11) DEFAULT NULL, + `c585` int(11) DEFAULT NULL, + `c586` int(11) DEFAULT NULL, + `c587` int(11) DEFAULT NULL, + `c588` int(11) DEFAULT NULL, + `c589` int(11) DEFAULT NULL, + `c590` int(11) DEFAULT NULL, + `c591` int(11) DEFAULT NULL, + `c592` int(11) DEFAULT NULL, + `c593` int(11) DEFAULT NULL, + `c594` int(11) DEFAULT NULL, + `c595` decimal(12,2) DEFAULT NULL, + `c596` int(11) DEFAULT NULL, + `c597` int(11) DEFAULT NULL, + `c598` int(11) DEFAULT NULL, + `c599` int(11) DEFAULT NULL, + `c600` int(11) DEFAULT NULL, + `c601` int(11) DEFAULT NULL, + `c602` int(11) DEFAULT NULL, + `c603` int(11) DEFAULT NULL, + `c604` int(11) DEFAULT NULL, + `c605` int(11) DEFAULT NULL, + `c606` int(11) DEFAULT NULL, + `c607` int(11) DEFAULT NULL, + `c608` int(11) DEFAULT NULL, + `c609` int(11) DEFAULT NULL, + `c610` int(11) DEFAULT NULL, + `c611` int(11) DEFAULT NULL, + `c612` int(11) DEFAULT NULL, + `c613` int(11) DEFAULT NULL, + `c614` decimal(12,2) DEFAULT NULL, + `c615` int(11) DEFAULT NULL, + `c616` int(11) DEFAULT NULL, + `c617` int(11) DEFAULT NULL, + `c618` int(11) DEFAULT NULL, + `c619` int(11) DEFAULT NULL, + `c620` int(11) DEFAULT NULL, + `c621` int(11) DEFAULT NULL, + `c622` int(11) DEFAULT NULL, + `c623` int(11) DEFAULT NULL, + `c624` int(11) DEFAULT NULL, + `c625` int(11) DEFAULT NULL, + `c626` int(11) DEFAULT NULL, + `c627` int(11) DEFAULT NULL, + `c628` int(11) DEFAULT NULL, + `c629` int(11) DEFAULT NULL, + `c630` int(11) DEFAULT NULL, + `c631` int(11) DEFAULT NULL, + `c632` int(11) DEFAULT NULL, + `c633` decimal(12,2) DEFAULT NULL, + `c634` int(11) DEFAULT NULL, + `c635` int(11) DEFAULT NULL, + `c636` int(11) DEFAULT NULL, + `c637` int(11) DEFAULT NULL, + `c638` int(11) DEFAULT NULL, + `c639` int(11) DEFAULT NULL, + `c640` int(11) DEFAULT NULL, + `c641` int(11) DEFAULT NULL, + `c642` int(11) DEFAULT NULL, + `c643` int(11) DEFAULT NULL, + `c644` int(11) DEFAULT NULL, + `c645` int(11) DEFAULT NULL, + `c646` int(11) DEFAULT NULL, + `c647` int(11) DEFAULT NULL, + `c648` int(11) DEFAULT NULL, + `c649` int(11) DEFAULT NULL, + `c650` int(11) DEFAULT NULL, + `c651` int(11) DEFAULT NULL, + `c652` decimal(12,2) DEFAULT NULL, + `c653` int(11) DEFAULT NULL, + `c654` int(11) DEFAULT NULL, + `c655` int(11) DEFAULT NULL, + `c656` int(11) DEFAULT NULL, + `c657` int(11) DEFAULT NULL, + `c658` int(11) DEFAULT NULL, + `c659` int(11) DEFAULT NULL, + `c660` int(11) DEFAULT NULL, + `c661` int(11) DEFAULT NULL, + `c662` int(11) DEFAULT NULL, + `c663` int(11) DEFAULT NULL, + `c664` int(11) DEFAULT NULL, + `c665` int(11) DEFAULT NULL, + `c666` int(11) DEFAULT NULL, + `c667` int(11) DEFAULT NULL, + `c668` int(11) DEFAULT NULL, + `c669` int(11) DEFAULT NULL, + `c670` int(11) DEFAULT NULL, + `c671` int(11) DEFAULT NULL, + `c672` int(11) DEFAULT NULL, + `c673` int(11) DEFAULT NULL, + `c674` int(11) DEFAULT NULL, + `c675` int(11) DEFAULT NULL, + `c676` int(11) DEFAULT NULL, + `c677` int(11) DEFAULT NULL, + `c678` int(11) DEFAULT NULL, + `c679` decimal(12,2) DEFAULT NULL, + `c680` int(11) DEFAULT NULL, + `c681` int(11) DEFAULT NULL, + `c682` int(11) DEFAULT NULL, + `c683` int(11) DEFAULT NULL, + `c684` int(11) DEFAULT NULL, + `c685` int(11) DEFAULT NULL, + `c686` int(11) DEFAULT NULL, + `c687` int(11) DEFAULT NULL, + `c688` int(11) DEFAULT NULL, + `c689` int(11) DEFAULT NULL, + `c690` decimal(12,2) DEFAULT NULL, + `c691` int(11) DEFAULT NULL, + `c692` int(11) DEFAULT NULL, + `c693` int(11) DEFAULT NULL, + `c694` int(11) DEFAULT NULL, + `c695` int(11) DEFAULT NULL, + `c696` int(11) DEFAULT NULL, + `c697` int(11) DEFAULT NULL, + `c698` int(11) DEFAULT NULL, + `c699` decimal(12,2) DEFAULT NULL, + `c700` int(11) DEFAULT NULL, + `c701` int(11) DEFAULT NULL, + `c702` int(11) DEFAULT NULL, + `c703` int(11) DEFAULT NULL, + `c704` int(11) DEFAULT NULL, + `c705` int(11) DEFAULT NULL, + `c706` int(11) DEFAULT NULL, + `c707` int(11) DEFAULT NULL, + `c708` int(11) DEFAULT NULL, + `c709` int(11) DEFAULT NULL, + `c710` int(11) DEFAULT NULL, + `c711` int(11) DEFAULT NULL, + `c712` int(11) DEFAULT NULL, + `c713` int(11) DEFAULT NULL, + `c714` int(11) DEFAULT NULL, + `c715` int(11) DEFAULT NULL, + `c716` int(11) DEFAULT NULL, + `c717` int(11) DEFAULT NULL, + `c718` decimal(12,2) DEFAULT NULL, + `c719` int(11) DEFAULT NULL, + `c720` int(11) DEFAULT NULL, + `c721` int(11) DEFAULT NULL, + `c722` int(11) DEFAULT NULL, + `c723` int(11) DEFAULT NULL, + `c724` int(11) DEFAULT NULL, + `c725` int(11) DEFAULT NULL, + `c726` int(11) DEFAULT NULL, + `c727` int(11) DEFAULT NULL, + `c728` int(11) DEFAULT NULL, + `c729` int(11) DEFAULT NULL, + `c730` int(11) DEFAULT NULL, + `c731` int(11) DEFAULT NULL, + `c732` int(11) DEFAULT NULL, + `c733` int(11) DEFAULT NULL, + `c734` int(11) DEFAULT NULL, + `c735` int(11) DEFAULT NULL, + `c736` int(11) DEFAULT NULL, + `c737` int(11) DEFAULT NULL, + `c738` int(11) DEFAULT NULL, + `c739` int(11) DEFAULT NULL, + `c740` int(11) DEFAULT NULL, + `c741` int(11) DEFAULT NULL, + `c742` int(11) DEFAULT NULL, + `c743` int(11) DEFAULT NULL, + `c744` int(11) DEFAULT NULL, + `c745` int(11) DEFAULT NULL, + `c746` int(11) DEFAULT NULL, + `c747` decimal(12,2) DEFAULT NULL, + `c748` int(11) DEFAULT NULL, + `c749` int(11) DEFAULT NULL, + `c750` int(11) DEFAULT NULL, + `c751` int(11) DEFAULT NULL, + `c752` int(11) DEFAULT NULL, + `c753` int(11) DEFAULT NULL, + `c754` int(11) DEFAULT NULL, + `c755` int(11) DEFAULT NULL, + `c756` int(11) DEFAULT NULL, + `c757` int(11) DEFAULT NULL, + `c758` int(11) DEFAULT NULL, + `c759` int(11) DEFAULT NULL, + `c760` int(11) DEFAULT NULL, + `c761` int(11) DEFAULT NULL, + `c762` int(11) DEFAULT NULL, + `c763` int(11) DEFAULT NULL, + `c764` int(11) DEFAULT NULL, + `c765` int(11) DEFAULT NULL, + `c766` decimal(12,2) DEFAULT NULL, + `c767` int(11) DEFAULT NULL, + `c768` int(11) DEFAULT NULL, + `c769` int(11) DEFAULT NULL, + `c770` int(11) DEFAULT NULL, + `c771` int(11) DEFAULT NULL, + `c772` int(11) DEFAULT NULL, + `c773` int(11) DEFAULT NULL, + `c774` int(11) DEFAULT NULL, + `c775` int(11) DEFAULT NULL, + `c776` int(11) DEFAULT NULL, + `c777` int(11) DEFAULT NULL, + `c778` int(11) DEFAULT NULL, + `c779` int(11) DEFAULT NULL, + `c780` int(11) DEFAULT NULL, + `c781` int(11) DEFAULT NULL, + `c782` int(11) DEFAULT NULL, + `c783` int(11) DEFAULT NULL, + `c784` int(11) DEFAULT NULL, + `c785` decimal(12,2) DEFAULT NULL, + `c786` int(11) DEFAULT NULL, + `c787` int(11) DEFAULT NULL, + `c788` int(11) DEFAULT NULL, + `c789` int(11) DEFAULT NULL, + `c790` int(11) DEFAULT NULL, + `c791` int(11) DEFAULT NULL, + `c792` int(11) DEFAULT NULL, + `c793` int(11) DEFAULT NULL, + `c794` int(11) DEFAULT NULL, + `c795` int(11) DEFAULT NULL, + `c796` int(11) DEFAULT NULL, + `c797` int(11) DEFAULT NULL, + `c798` int(11) DEFAULT NULL, + `c799` int(11) DEFAULT NULL, + `c800` int(11) DEFAULT NULL, + `c801` int(11) DEFAULT NULL, + `c802` int(11) DEFAULT NULL, + `c803` int(11) DEFAULT NULL, + `c804` decimal(12,2) DEFAULT NULL, + `c805` int(11) DEFAULT NULL, + `c806` int(11) DEFAULT NULL, + `c807` int(11) DEFAULT NULL, + `c808` int(11) DEFAULT NULL, + `c809` int(11) DEFAULT NULL, + `c810` int(11) DEFAULT NULL, + `c811` int(11) DEFAULT NULL, + `c812` int(11) DEFAULT NULL, + `c813` decimal(12,2) DEFAULT NULL, + `c814` int(11) DEFAULT NULL, + `c815` int(11) DEFAULT NULL, + `c816` int(11) DEFAULT NULL, + `c817` int(11) DEFAULT NULL, + `c818` int(11) DEFAULT NULL, + `c819` int(11) DEFAULT NULL, + `c820` int(11) DEFAULT NULL, + `c821` int(11) DEFAULT NULL, + `c822` int(11) DEFAULT NULL, + `c823` int(11) DEFAULT NULL, + `c824` int(11) DEFAULT NULL, + `c825` int(11) DEFAULT NULL, + `c826` int(11) DEFAULT NULL, + `c827` int(11) DEFAULT NULL, + `c828` int(11) DEFAULT NULL, + `c829` int(11) DEFAULT NULL, + `c830` int(11) DEFAULT NULL, + `c831` int(11) DEFAULT NULL, + `c832` decimal(12,2) DEFAULT NULL, + `c833` int(11) DEFAULT NULL, + `c834` int(11) DEFAULT NULL, + `c835` int(11) DEFAULT NULL, + `c836` int(11) DEFAULT NULL, + `c837` int(11) DEFAULT NULL, + `c838` int(11) DEFAULT NULL, + `c839` int(11) DEFAULT NULL, + `c840` int(11) DEFAULT NULL, + `c841` int(11) DEFAULT NULL, + `c842` int(11) DEFAULT NULL, + `c843` int(11) DEFAULT NULL, + `c844` int(11) DEFAULT NULL, + `c845` int(11) DEFAULT NULL, + `c846` int(11) DEFAULT NULL, + `c847` int(11) DEFAULT NULL, + `c848` int(11) DEFAULT NULL, + `c849` int(11) DEFAULT NULL, + `c850` int(11) DEFAULT NULL, + `c851` decimal(12,2) DEFAULT NULL, + `c852` int(11) DEFAULT NULL, + `c853` int(11) DEFAULT NULL, + `c854` int(11) DEFAULT NULL, + `c855` int(11) DEFAULT NULL, + `c856` int(11) DEFAULT NULL, + `c857` int(11) DEFAULT NULL, + `c858` int(11) DEFAULT NULL, + `c859` int(11) DEFAULT NULL, + `c860` int(11) DEFAULT NULL, + `c861` int(11) DEFAULT NULL, + `c862` int(11) DEFAULT NULL, + `c863` int(11) DEFAULT NULL, + `c864` int(11) DEFAULT NULL, + `c865` int(11) DEFAULT NULL, + `c866` int(11) DEFAULT NULL, + `c867` int(11) DEFAULT NULL, + `c868` int(11) DEFAULT NULL, + `c869` int(11) DEFAULT NULL, + `c870` decimal(12,2) DEFAULT NULL, + `c871` int(11) DEFAULT NULL, + `c872` int(11) DEFAULT NULL, + `c873` int(11) DEFAULT NULL, + `c874` int(11) DEFAULT NULL, + `c875` int(11) DEFAULT NULL, + `c876` int(11) DEFAULT NULL, + `c877` int(11) DEFAULT NULL, + `c878` int(11) DEFAULT NULL, + `c879` int(11) DEFAULT NULL, + `c880` int(11) DEFAULT NULL, + `c881` int(11) DEFAULT NULL, + `c882` int(11) DEFAULT NULL, + `c883` int(11) DEFAULT NULL, + `c884` int(11) DEFAULT NULL, + `c885` int(11) DEFAULT NULL, + `c886` int(11) DEFAULT NULL, + `c887` int(11) DEFAULT NULL, + `c888` int(11) DEFAULT NULL, + `c889` decimal(12,2) DEFAULT NULL, + `c890` int(11) DEFAULT NULL, + `c891` int(11) DEFAULT NULL, + `c892` int(11) DEFAULT NULL, + `c893` int(11) DEFAULT NULL, + `c894` int(11) DEFAULT NULL, + `c895` int(11) DEFAULT NULL, + `c896` int(11) DEFAULT NULL, + `c897` int(11) DEFAULT NULL, + `c898` int(11) DEFAULT NULL, + `c899` int(11) DEFAULT NULL, + `c900` int(11) DEFAULT NULL, + `c901` int(11) DEFAULT NULL, + `c902` int(11) DEFAULT NULL, + `c903` int(11) DEFAULT NULL, + `c904` int(11) DEFAULT NULL, + `c905` int(11) DEFAULT NULL, + `c906` int(11) DEFAULT NULL, + `c907` int(11) DEFAULT NULL, + `c908` decimal(12,2) DEFAULT NULL, + `c909` decimal(25,17) DEFAULT NULL, + `c910` int(10) unsigned DEFAULT NULL, + `c911` int(11) DEFAULT NULL, + `c912` int(11) DEFAULT NULL, + `c913` int(11) DEFAULT NULL, + `c914` int(11) DEFAULT NULL, + `c915` int(11) DEFAULT NULL, + `c916` smallint(5) unsigned DEFAULT NULL, + `c917` smallint(5) unsigned DEFAULT NULL, + `c918` smallint(5) unsigned DEFAULT NULL, + `c919` smallint(5) unsigned DEFAULT NULL, + `c920` smallint(5) unsigned DEFAULT NULL, + `c921` int(10) unsigned DEFAULT NULL, + `c922` int(11) DEFAULT NULL, + `c923` decimal(10,3) DEFAULT NULL, + `c924` decimal(13,4) DEFAULT NULL, + `c925` tinyint(3) unsigned DEFAULT NULL, + `c926` tinyint(3) unsigned DEFAULT NULL +) ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; + +--delimiter ==STOP== +CREATE or replace PROCEDURE `filltablecol`( + IN `databasenamer` VARCHAR(50), + IN `tablenamer` VARCHAR(50), + IN `amountrows` INT +) +LANGUAGE SQL +NOT DETERMINISTIC +MODIFIES SQL DATA +SQL SECURITY DEFINER +COMMENT 'written by Richard Stracke MariaDB 2025' +BEGIN + DECLARE done, ai_flag,enumcount INT DEFAULT FALSE; + DECLARE ischemaname,itablename,icolumnname,idatatype,icharmax,icoltype,iextra VARCHAR(500); + DECLARE iNUMERIC_PRECISION,iNUMERIC_SCALE INT; + DECLARE psql MEDIUMTEXT; + DECLARE p1 MEDIUMTEXT; + DECLARE p2 MEDIUMTEXT; + DECLARE pcols MEDIUMTEXT; + + DECLARE cur CURSOR FOR SELECT table_schema,TABLE_NAME,COLUMN_NAME,DATA_type,character_maximum_length,extra,NUMERIC_PRECISION,NUMERIC_SCALE,(LENGTH(column_type) - LENGTH(REPLACE(column_type, ',', ''))) +1 FROM information_schema.`columns` WHERE table_schema = databasenamer and TABLE_NAME = tablenamer; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + set psql = CONCAT("INSERT INTO ",databasenamer,".",tablenamer, " ( " ); + SET psql = CONCAT(psql,"with recursive series as (") ; + SET p1 = "select "; + SET p2 = "select "; + SET pcols = ""; + SET ai_flag = 0; + + set session max_recursive_iterations = amountrows +1; + + OPEN cur; + + user_loop: LOOP + + FETCH cur INTO ischemaname,itablename,icolumnname,idatatype,icharmax,iextra,iNUMERIC_PRECISION,iNUMERIC_SCALE,enumcount; + IF done THEN + LEAVE user_loop; + END IF; + + if idatatype = "tinyint" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * 125)) as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * 125)) as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + if idatatype = "smallint" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * 125)) as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * 125)) as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + + + if idatatype = "enum" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * ",enumcount," )) as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * ",enumcount," )) as ", icolumnname,"," ); + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + if idatatype = "bigint" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * 50000)) as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * 50000)) as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + + if idatatype = "date" OR idatatype = "datetime" OR idatatype = "timestamp" then + + SET p1 = CONCAT (p1, "subdate(NOW() ,INTERVAL (FLOOR(1 + (RAND() * 15)) ) DAY) as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "subdate(NOW() ,INTERVAL (FLOOR(1 + (RAND() * 15)) ) DAY) as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + + if idatatype = "int" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * 50000)) as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * 50000)) as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + if idatatype = "double" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * 50000))/100 as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * 50000))/100 as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + if idatatype = "decimal" then + + SET p1 = CONCAT (p1, "FLOOR(1 + (RAND() * 50000))/100 as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "FLOOR(1 + (RAND() * 50000))/100 as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + + END if; + + + if idatatype = "varchar" OR idatatype = "char" then + + SET p1 = CONCAT (p1, "LEFT(MD5(RAND()),",icharmax,") as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "LEFT(MD5(RAND()),",icharmax,") as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + END if; + + + + if idatatype = "mediumblob" OR idatatype = "text" then + + SET p1 = CONCAT (p1, "LPAD('Database',1000,'MariadB') as ", icolumnname,"," ); + SET p2 = CONCAT (p2, "LPAD('Database',1000,'MariadB') as ", icolumnname,"," ); + + SET pcols = CONCAT(pcols,icolumnname,","); + + END if; + + + + if iextra = "auto_increment" then + + SET p1 = CONCAT (p1, "1 as ", icolumnname,"," ); + SET p2 = CONCAT (p2," ", icolumnname, " +1 as ", icolumnname,"," ); + + SET ai_flag = 1; + + SET pcols = CONCAT(pcols,icolumnname,","); + + END if; + + + + + END LOOP; + + SET p1 = CONCAT (p1, "1 as mariadbid " ); + SET p2 = CONCAT (p2,"mariadbid +1 as mariadbid " ); + SET pcols = LEFT(pcols,LENGTH(pcols)-1); + + + #SELECT psql,p1,p2,pcols; + SET psql = CONCAT(psql,p1, " union all " ,p2); + SET psql = concat(psql, " from series where mariadbid < ",amountrows," )"); + SET psql = concat(psql, " select ",pcols, " from series);"); + CLOSE cur; + + +PREPARE stmt FROM psql; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +END +==STOP== +--delimiter ; + +call filltablecol("MCOL_6198","c",100000); +call filltablecol("MCOL_6198","c",100000); + +call filltablecol("MCOL_6198","p",100000); +call filltablecol("MCOL_6198","p",100000); +call filltablecol("MCOL_6198","p",100000); +call filltablecol("MCOL_6198","p",100000); + + +CREATE TABLE group_g01(key_id BIGINT, eg_id VARCHAR(40)) ENGINE=innoDB; +INSERT INTO group_g01 VALUES (1,'$46'); +CREATE TABLE group_g02(key_id BIGINT, eg_id VARCHAR(40)) ENGINE=innoDB; +INSERT INTO group_g02 VALUES (1,'$45'); + +# We are not interested in results per se, we are looking for sccessful query completion. +--enable_query_log +SELECT + v.c36 AS hst, + m.p6 AS g, + COALESCE(g0.eg_id,'MARIA') AS g01, + COALESCE(g1.eg_id,'MARIA') AS g02, + SUM(v.c758 * m.p42 / 100 + v.c759 * m.p42 / 100 + v.c760 * m.p42 / 100) AS sval +FROM + c AS v + JOIN p m on (v.c4 = m.a4) + LEFT OUTER JOIN group_g01 AS g0 ON g0.key_id=m.p6 + LEFT OUTER JOIN group_g02 AS g1 ON g1.key_id=m.p6 +WHERE + 1=1 +GROUP BY c36,p6,g01,g02; + +--disable_query_log +DROP USER 'cejuser'@'localhost'; +--enable_query_log +--enable_result_log +--enable_warnings + +DROP DATABASE MCOL_6198; diff --git a/primitives/primproc/batchprimitiveprocessor.cpp b/primitives/primproc/batchprimitiveprocessor.cpp index 58480e537..a8e277623 100644 --- a/primitives/primproc/batchprimitiveprocessor.cpp +++ b/primitives/primproc/batchprimitiveprocessor.cpp @@ -72,6 +72,24 @@ using namespace logging; using namespace utils; using namespace joblist; +#define idblog(x) \ + do \ + { \ + { \ + std::ostringstream os; \ + \ + os << __FILE__ << "@" << __LINE__ << ": \'" << x << "\'"; \ + std::cerr << os.str() << std::endl; \ + logging::MessageLog logger((logging::LoggingID())); \ + logging::Message message; \ + logging::Message::Args args; \ + \ + args.add(os.str()); \ + message.format(args); \ + logger.logErrorMessage(message); \ + } \ + } while (0) + namespace primitiveprocessor { #ifdef PRIMPROC_STOPWATCH @@ -386,15 +404,6 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs) smallSideRGRecvd = true; } - for (uint j = 0; j < processorThreads; ++j) - { - auto tlHasher = TupleJoiner::TypelessDataHasher(&outputRG, &tlLargeSideKeyColumns[i], - mSmallSideKeyColumnsPtr, mSmallSideRGPtr); - auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i], - mSmallSideKeyColumnsPtr, mSmallSideRGPtr); - tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator, - utils::STLPoolAllocator(resourceManager))); - } } } @@ -408,6 +417,7 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs) { deserializeVector(bs, smallSideRGs); idbassert(smallSideRGs.size() == joinerCount); + mSmallSideRGPtr = mSmallSideRGPtr ? &smallSideRGs[0] : nullptr; smallSideRowLengths.reset(new uint32_t[joinerCount]); smallSideRowData.reset(new RGData[joinerCount]); smallNullRowData.reset(new RGData[joinerCount]); @@ -438,6 +448,24 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs) bs >> largeSideRG; bs >> joinedRG; } + + for (i = 0; i < joinerCount; i++) + { + if (!typelessJoin[i]) + { + continue; + } + for (uint j = 0; j < processorThreads; ++j) + { + auto tlHasher = TupleJoiner::TypelessDataHasher(&outputRG, &tlLargeSideKeyColumns[i], + mSmallSideKeyColumnsPtr, mSmallSideRGPtr); + auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i], + mSmallSideKeyColumnsPtr, mSmallSideRGPtr); + tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator, + utils::STLPoolAllocator(resourceManager))); + } + } + } pthread_mutex_unlock(&objLock); @@ -2412,8 +2440,7 @@ SBPP BatchPrimitiveProcessor::duplicate() bpp->hasJoinFEFilters = hasJoinFEFilters; bpp->hasSmallOuterJoin = hasSmallOuterJoin; bpp->mJOINHasSkewedKeyColumn = mJOINHasSkewedKeyColumn; - bpp->mSmallSideRGPtr = mSmallSideRGPtr; - bpp->mSmallSideKeyColumnsPtr = mSmallSideKeyColumnsPtr; + bpp->mSmallSideKeyColumnsPtr = &(*bpp->tlSmallSideKeyColumns); if (!getTupleJoinRowGroupData && mJOINHasSkewedKeyColumn) { idbassert(!smallSideRGs.empty()); @@ -2440,6 +2467,7 @@ SBPP BatchPrimitiveProcessor::duplicate() bpp->smallNullPointers = smallNullPointers; bpp->joinedRG = joinedRG; } + bpp->mSmallSideRGPtr = &bpp->smallSideRGs[0]; #ifdef __FreeBSD__ pthread_mutex_unlock(&bpp->objLock); From bb631dcffbdfebf757291f85ed8babe3db8564ed Mon Sep 17 00:00:00 2001 From: Serguey Zefirov Date: Thu, 2 Oct 2025 10:39:58 +0000 Subject: [PATCH 09/19] feat(JSON,data_type): MCOL-6197 - support for JSON type This patch does exactly this, it implements support for JSON in DDL. Right now we use server's check for JSON validity on INSERT. We do not implement JSON validity check during updates, it is postponed for later work. --- datatypes/mcs_datatype.cpp | 1 + dbcon/ddlpackage/ddl.l | 1 + dbcon/ddlpackage/ddl.y | 30 ++++++++++++++----- dbcon/ddlpackage/ddlpkg.h | 6 +++- dbcon/ddlpackage/serialize.cpp | 1 + dbcon/ddlpackageproc/ddlpackageprocessor.cpp | 11 +++++-- dbcon/mysql/ha_mcs_ddl.cpp | 25 ++++++++++++---- .../columnstore/basic/r/JSON-type.result | 16 ++++++++++ .../basic/r/mcs59_nonscalar_datatypes.result | 2 -- .../basic/r/mcs9_create_table_negative.result | 2 -- mysql-test/columnstore/basic/t/JSON-type.test | 17 +++++++++++ .../basic/t/mcs59_nonscalar_datatypes.test | 2 -- .../basic/t/mcs9_create_table_negative.test | 2 -- writeengine/server/we_ddlcommon.h | 3 +- 14 files changed, 95 insertions(+), 24 deletions(-) create mode 100644 mysql-test/columnstore/basic/r/JSON-type.result create mode 100644 mysql-test/columnstore/basic/t/JSON-type.test diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index 03b5f8e07..7045ab44e 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -428,6 +428,7 @@ const TypeHandler* TypeHandler::find_by_ddltype(const ddlpackage::ColumnType& ct case ddlpackage::DDL_CLOB: return &mcs_type_handler_clob; case ddlpackage::DDL_BLOB: return &mcs_type_handler_blob; case ddlpackage::DDL_TEXT: return &mcs_type_handler_text; + case ddlpackage::DDL_JSON: return &mcs_type_handler_text; case ddlpackage::DDL_UNSIGNED_TINYINT: return &mcs_type_handler_uint8; case ddlpackage::DDL_UNSIGNED_SMALLINT: return &mcs_type_handler_uint16; diff --git a/dbcon/ddlpackage/ddl.l b/dbcon/ddlpackage/ddl.l index 5404542f0..24b7f586a 100644 --- a/dbcon/ddlpackage/ddl.l +++ b/dbcon/ddlpackage/ddl.l @@ -134,6 +134,7 @@ INDEX {return INDEX;} INITIALLY {return INITIALLY;} INT {return IDB_INT;} INTEGER {return INTEGER;} +JSON { return JSON; } KEY {return KEY;} MATCH {return MATCH;} MAX_ROWS {return MAX_ROWS;} diff --git a/dbcon/ddlpackage/ddl.y b/dbcon/ddlpackage/ddl.y index 46d31bad8..16e09b1be 100644 --- a/dbcon/ddlpackage/ddl.y +++ b/dbcon/ddlpackage/ddl.y @@ -56,7 +56,7 @@ int ddllex(YYSTYPE* ddllval, void* yyscanner); void ddlerror(struct pass_to_bison* x, char const *s); char* copy_string(const char *str); -void fix_column_length_and_charset(SchemaObject* elem, const CHARSET_INFO* def_cs, myf utf8_flag) +void postprocess_column_information(SchemaObject* elem, const CHARSET_INFO* def_cs, myf utf8_flag) { auto* column = dynamic_cast(elem); @@ -104,6 +104,17 @@ void fix_column_length_and_charset(SchemaObject* elem, const CHARSET_INFO* def_c else column->fType->fLength = 16777215; } + if (column->fType->fType == DDL_JSON) + { + CHARSET_INFO* cs = &my_charset_utf8mb4_bin; + + column->fType->fCharset = cs->cs_name.str; + column->fType->fCollate = cs->coll_name.str; + column->fType->fCharsetNum = cs->number; + + column->fType->fLength = 16777215; + column->fConstraints.push_back(new ColumnConstraintDef(DDL_VALIDATE_JSON)); + } } %} @@ -155,7 +166,7 @@ CHARACTER CHECK CLOB COLUMN BOOL BOOLEAN COLUMNS COMMENT CONSTRAINT CONSTRAINTS CREATE CURRENT_USER DATETIME DEC DECIMAL DEFAULT DEFERRABLE DEFERRED IDB_DELETE DROP ENGINE -FOREIGN FULL IMMEDIATE INDEX INITIALLY IDB_INT INTEGER KEY LONGBLOB LONGTEXT +FOREIGN FULL IMMEDIATE INDEX INITIALLY IDB_INT INTEGER JSON KEY LONGBLOB LONGTEXT MATCH MAX_ROWS MEDIUMBLOB MEDIUMTEXT MEDIUMINT MIN_ROWS MODIFY NO NOT NULL_TOK NUMBER NUMERIC ON PARTIAL PRECISION PRIMARY REFERENCES RENAME RESTRICT SET SMALLINT TABLE TEXT TINYBLOB TINYTEXT @@ -355,7 +366,7 @@ create_table_statement: { for (auto* elem : *$6) { - fix_column_length_and_charset(elem, x->default_table_charset, x->utf8_flag); + postprocess_column_information(elem, x->default_table_charset, x->utf8_flag); } $$ = new CreateTableStatement(new TableDef($4, $6, $8)); } @@ -719,17 +730,17 @@ ata_add_column: /* See the documentation for SchemaObject for an explanation of why we are using * dynamic_cast here. */ - ADD column_def { fix_column_length_and_charset($2, x->default_table_charset, x->utf8_flag); $$ = new AtaAddColumn(dynamic_cast($2));} - | ADD COLUMN column_def { fix_column_length_and_charset($3, x->default_table_charset, x->utf8_flag); $$ = new AtaAddColumn(dynamic_cast($3));} + ADD column_def { postprocess_column_information($2, x->default_table_charset, x->utf8_flag); $$ = new AtaAddColumn(dynamic_cast($2));} + | ADD COLUMN column_def { postprocess_column_information($3, x->default_table_charset, x->utf8_flag); $$ = new AtaAddColumn(dynamic_cast($3));} | ADD '(' table_element_list ')' { for (auto* elem : *$3) { - fix_column_length_and_charset(elem, x->default_table_charset, x->utf8_flag); + postprocess_column_information(elem, x->default_table_charset, x->utf8_flag); } $$ = new AtaAddColumns($3); } | ADD COLUMN '(' table_element_list ')' { for (auto* elem : *$4) { - fix_column_length_and_charset(elem, x->default_table_charset, x->utf8_flag); + postprocess_column_information(elem, x->default_table_charset, x->utf8_flag); } $$ = new AtaAddColumns($4); } @@ -1067,6 +1078,11 @@ text_type: $$ = new ColumnType(DDL_TEXT); $$->fLength = 16777215; } + | JSON + { + $$ = new ColumnType(DDL_JSON); + $$->fLength = 16777215; + } ; numeric_type: diff --git a/dbcon/ddlpackage/ddlpkg.h b/dbcon/ddlpackage/ddlpkg.h index be98572f6..e6ec6bb4c 100644 --- a/dbcon/ddlpackage/ddlpkg.h +++ b/dbcon/ddlpackage/ddlpkg.h @@ -160,6 +160,7 @@ enum DDL_CONSTRAINTS DDL_REFERENCES, DDL_NOT_NULL, DDL_AUTO_INCREMENT, + DDL_VALIDATE_JSON, DDL_INVALID_CONSTRAINT }; /** @brief @@ -170,7 +171,8 @@ const std::string ConstraintString[] = {"primary", "unique", "references", "not_null", - "auto_increment" + "auto_increment", + "validate_json", ""}; /** @brief Datatype List @@ -210,6 +212,7 @@ enum DDL_DATATYPES DDL_TEXT, DDL_TIME, DDL_TIMESTAMP, + DDL_JSON, DDL_INVALID_DATATYPE }; @@ -956,6 +959,7 @@ struct ColumnType /** @brief Is the TEXT column has explicit defined length, ie TEXT(1717) */ bool fExplicitLength; + }; /** @brief A column constraint definition. diff --git a/dbcon/ddlpackage/serialize.cpp b/dbcon/ddlpackage/serialize.cpp index 6dff88362..622ee91c1 100644 --- a/dbcon/ddlpackage/serialize.cpp +++ b/dbcon/ddlpackage/serialize.cpp @@ -1167,6 +1167,7 @@ int ColumnType::serialize(ByteStream& bytestream) messageqcpp::ByteStream::octbyte nextVal = fNextvalue; messageqcpp::ByteStream::quadbyte charsetNum = fCharsetNum; + // write column types bytestream << ftype; bytestream << length; diff --git a/dbcon/ddlpackageproc/ddlpackageprocessor.cpp b/dbcon/ddlpackageproc/ddlpackageprocessor.cpp index 7dc815de0..ef37fa3fa 100644 --- a/dbcon/ddlpackageproc/ddlpackageprocessor.cpp +++ b/dbcon/ddlpackageproc/ddlpackageprocessor.cpp @@ -195,9 +195,10 @@ execplan::CalpontSystemCatalog::ColDataType DDLPackageProcessor::convertDataType case ddlpackage::DDL_BLOB: colDataType = CalpontSystemCatalog::BLOB; break; - case ddlpackage::DDL_TEXT: colDataType = CalpontSystemCatalog::TEXT; break; + case ddlpackage::DDL_TEXT: + case ddlpackage::DDL_JSON: colDataType = CalpontSystemCatalog::TEXT; break; - default: throw runtime_error("Unsupported datatype!"); + default: throw runtime_error("Unsupported DDL datatype!"); } return colDataType; @@ -228,6 +229,8 @@ std::string DDLPackageProcessor::buildTableConstraintName(const int oid, ddlpack case ddlpackage::DDL_NOT_NULL: prefix = "nk_"; break; + case ddlpackage::DDL_VALIDATE_JSON: prefix = "jk_"; break; + default: throw runtime_error("Unsupported constraint type!"); break; } @@ -261,6 +264,8 @@ std::string DDLPackageProcessor::buildColumnConstraintName(const std::string& sc case ddlpackage::DDL_NOT_NULL: prefix = "nk_"; break; + case ddlpackage::DDL_VALIDATE_JSON: prefix = "jk_"; break; + default: throw runtime_error("Unsupported constraint type!"); break; } @@ -288,6 +293,8 @@ char DDLPackageProcessor::getConstraintCode(ddlpackage::DDL_CONSTRAINTS type) case ddlpackage::DDL_NOT_NULL: constraint_type = 'n'; break; + case ddlpackage::DDL_VALIDATE_JSON: constraint_type = 'j'; break; + default: constraint_type = '0'; break; } diff --git a/dbcon/mysql/ha_mcs_ddl.cpp b/dbcon/mysql/ha_mcs_ddl.cpp index 703fee1e5..94bbd596e 100644 --- a/dbcon/mysql/ha_mcs_ddl.cpp +++ b/dbcon/mysql/ha_mcs_ddl.cpp @@ -125,7 +125,7 @@ CalpontSystemCatalog::ColDataType convertDataType(const ddlpackage::ColumnType& const datatypes::TypeHandler* h = datatypes::TypeHandler::find_by_ddltype(ct); if (!h) { - throw runtime_error("Unsupported datatype!"); + throw runtime_error("Unsupported datatype to convert from!"); return CalpontSystemCatalog::UNDEFINED; } return h->code(); @@ -822,10 +822,11 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta if (createTable->fTableDef->fColumns[i]->fConstraints.size() > 0) { - // support default value and NOT NULL constraint + // support default value, JSON validation and NOT NULL constraint for (uint32_t j = 0; j < createTable->fTableDef->fColumns[i]->fConstraints.size(); j++) { - if (createTable->fTableDef->fColumns[i]->fConstraints[j]->fConstraintType != DDL_NOT_NULL) + auto ctype = createTable->fTableDef->fColumns[i]->fConstraints[j]->fConstraintType; + if (ctype != DDL_NOT_NULL && ctype != DDL_VALIDATE_JSON) { rc = 1; thd->get_stmt_da()->set_overwrite_status(true); @@ -1226,7 +1227,8 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta // support default value and NOT NULL constraint for (uint32_t j = 0; j < addColumnPtr->fColumnDef->fConstraints.size(); j++) { - if (addColumnPtr->fColumnDef->fConstraints[j]->fConstraintType != DDL_NOT_NULL) + auto ctype = addColumnPtr->fColumnDef->fConstraints[j]->fConstraintType; + if (ctype != DDL_NOT_NULL && ctype != DDL_VALIDATE_JSON) { rc = 1; thd->get_stmt_da()->set_overwrite_status(true); @@ -1359,6 +1361,7 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta } // For TIMESTAMP, if no constraint is given, default to NOT NULL + // XXX: see same code conditionally enabled for specific MariaDB version. if (addColumnPtr->fColumnDef->fType->fType == ddlpackage::DDL_TIMESTAMP && addColumnPtr->fColumnDef->fConstraints.empty()) { @@ -1611,7 +1614,8 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta //@Bug 5274. support default value and NOT NULL constraint for (uint32_t j = 0; j < addColumnsPtr->fColumns[0]->fConstraints.size(); j++) { - if (addColumnsPtr->fColumns[0]->fConstraints[j]->fConstraintType != DDL_NOT_NULL) + auto ctype = addColumnsPtr->fColumns[0]->fConstraints[j]->fConstraintType; + if (ctype != DDL_NOT_NULL && ctype != DDL_VALIDATE_JSON) { rc = 1; thd->get_stmt_da()->set_overwrite_status(true); @@ -1744,6 +1748,7 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta } // For TIMESTAMP, if no constraint is given, default to NOT NULL + // XXX: please see conditional to MariaDB version enablement of similar code. if (addColumnsPtr->fColumns[0]->fType->fType == ddlpackage::DDL_TIMESTAMP && addColumnsPtr->fColumns[0]->fConstraints.empty()) { @@ -2073,6 +2078,16 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta return rc; } } + else if (renameColumnsPtr->fConstraints[j]->fConstraintType == DDL_VALIDATE_JSON) + { + rc = 1; + thd->get_stmt_da()->set_overwrite_status(true); + thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, + (IDBErrorInfo::instance()->errorMsg(ERR_CONSTRAINTS)).c_str()); + ci->alterTableState = cal_connection_info::NOT_ALTER; + ci->isAlter = false; + return rc; + } else { rc = 1; diff --git a/mysql-test/columnstore/basic/r/JSON-type.result b/mysql-test/columnstore/basic/r/JSON-type.result new file mode 100644 index 000000000..faee378b3 --- /dev/null +++ b/mysql-test/columnstore/basic/r/JSON-type.result @@ -0,0 +1,16 @@ +DROP DATABASE IF EXISTS JSON_type; +CREATE DATABASE JSON_type; +USE JSON_type; +CREATE TABLE tj(j JSON) ENGINE=COLUMNSTORE; +INSERT INTO tj(j) VALUES ('()'); +ERROR 23000: CONSTRAINT `tj.j` failed for `JSON_type`.`tj` +INSERT INTO tj(j) VALUES ('[]'), ('{}'), ('"a"'); +SELECT * FROM tj WHERE j = '"A"'; +j +SELECT * FROM tj WHERE j = '"a"'; +j +"a" +INSERT INTO tj(j) VALUES ('{"a":"b", "b":"a"}'); +SELECT * FROM tj WHERE j = '{"b":"a","a":"b"}'; +j +DROP DATABASE JSON_type; diff --git a/mysql-test/columnstore/basic/r/mcs59_nonscalar_datatypes.result b/mysql-test/columnstore/basic/r/mcs59_nonscalar_datatypes.result index d98562ac2..9cc0502bb 100644 --- a/mysql-test/columnstore/basic/r/mcs59_nonscalar_datatypes.result +++ b/mysql-test/columnstore/basic/r/mcs59_nonscalar_datatypes.result @@ -5,6 +5,4 @@ CREATE TABLE t_enum(col ENUM('min','max','avg'))ENGINE=Columnstore; ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. CREATE TABLE t_set(col SET('x','y','z'))ENGINE=Columnstore; ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. -CREATE TABLE t_json(col JSON)ENGINE=Columnstore; -ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. DROP DATABASE mcs59_db; diff --git a/mysql-test/columnstore/basic/r/mcs9_create_table_negative.result b/mysql-test/columnstore/basic/r/mcs9_create_table_negative.result index ee1fe7a3e..dabfabb8e 100644 --- a/mysql-test/columnstore/basic/r/mcs9_create_table_negative.result +++ b/mysql-test/columnstore/basic/r/mcs9_create_table_negative.result @@ -7,8 +7,6 @@ CREATE TABLE t2(t2_binary BINARY(3))ENGINE=Columnstore; ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. CREATE TABLE t3(t3_set SET('a','b'))ENGINE=Columnstore; ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. -CREATE TABLE t4(t4_json JSON)ENGINE=Columnstore; -ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. CREATE TABLE $table(col1 INT)ENGINE=columnstore; ERROR 42000: The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. CREATE TABLE abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm(col1 VARCHAR(90))ENGINE=Columnstore; diff --git a/mysql-test/columnstore/basic/t/JSON-type.test b/mysql-test/columnstore/basic/t/JSON-type.test new file mode 100644 index 000000000..2b96897c7 --- /dev/null +++ b/mysql-test/columnstore/basic/t/JSON-type.test @@ -0,0 +1,17 @@ +--disable_warnings +DROP DATABASE IF EXISTS JSON_type; +--enable_warnings +CREATE DATABASE JSON_type; +USE JSON_type; +CREATE TABLE tj(j JSON) ENGINE=COLUMNSTORE; +--error 4025 +INSERT INTO tj(j) VALUES ('()'); # invalid +INSERT INTO tj(j) VALUES ('[]'), ('{}'), ('"a"'); # valid +SELECT * FROM tj WHERE j = '"A"'; # empty set. +SELECT * FROM tj WHERE j = '"a"'; # single row. +INSERT INTO tj(j) VALUES ('{"a":"b", "b":"a"}'); +SELECT * FROM tj WHERE j = '{"b":"a","a":"b"}'; # empty set, comparison is not structural. +# UPDATE is not tested because it does not work. +#UPDATE tj SET j = CONCAT(j,'()'); +DROP DATABASE JSON_type; + diff --git a/mysql-test/columnstore/basic/t/mcs59_nonscalar_datatypes.test b/mysql-test/columnstore/basic/t/mcs59_nonscalar_datatypes.test index 8bb528edd..0c086a44d 100644 --- a/mysql-test/columnstore/basic/t/mcs59_nonscalar_datatypes.test +++ b/mysql-test/columnstore/basic/t/mcs59_nonscalar_datatypes.test @@ -15,8 +15,6 @@ USE mcs59_db; CREATE TABLE t_enum(col ENUM('min','max','avg'))ENGINE=Columnstore; --error ER_CHECK_NOT_IMPLEMENTED CREATE TABLE t_set(col SET('x','y','z'))ENGINE=Columnstore; ---error ER_CHECK_NOT_IMPLEMENTED -CREATE TABLE t_json(col JSON)ENGINE=Columnstore; # Clean UP DROP DATABASE mcs59_db; diff --git a/mysql-test/columnstore/basic/t/mcs9_create_table_negative.test b/mysql-test/columnstore/basic/t/mcs9_create_table_negative.test index 0717c3861..76537ed09 100644 --- a/mysql-test/columnstore/basic/t/mcs9_create_table_negative.test +++ b/mysql-test/columnstore/basic/t/mcs9_create_table_negative.test @@ -17,8 +17,6 @@ CREATE TABLE t1(t1_enum ENUM('one','two','three'))ENGINE=Columnstore; CREATE TABLE t2(t2_binary BINARY(3))ENGINE=Columnstore; --error 1178 CREATE TABLE t3(t3_set SET('a','b'))ENGINE=Columnstore; ---error 1178 -CREATE TABLE t4(t4_json JSON)ENGINE=Columnstore; # with unsupported table name --error 1178 diff --git a/writeengine/server/we_ddlcommon.h b/writeengine/server/we_ddlcommon.h index c3091dab3..82829ba38 100644 --- a/writeengine/server/we_ddlcommon.h +++ b/writeengine/server/we_ddlcommon.h @@ -178,7 +178,8 @@ inline int convertDataType(int dataType) case ddlpackage::DDL_BLOB: calpontDataType = execplan::CalpontSystemCatalog::BLOB; break; - case ddlpackage::DDL_TEXT: calpontDataType = execplan::CalpontSystemCatalog::TEXT; break; + case ddlpackage::DDL_TEXT: + case ddlpackage::DDL_JSON: calpontDataType = execplan::CalpontSystemCatalog::TEXT; break; case ddlpackage::DDL_UNSIGNED_TINYINT: calpontDataType = execplan::CalpontSystemCatalog::UTINYINT; break; From 18a4f0124256911d5ae490be286374428b5458a1 Mon Sep 17 00:00:00 2001 From: "Akhmad O." <96055449+AestheticAkhmad@users.noreply.github.com> Date: Fri, 17 Oct 2025 18:32:03 +0200 Subject: [PATCH 10/19] fix(funcexp): MCOL-4623 Add support for additional types to SEC_TO_TIME() (#3731) --- .../columnstore/bugfixes/mcol_4623.result | 34 ++++++++++++++ .../columnstore/bugfixes/mcol_4623.test | 45 +++++++++++++++++++ utils/funcexp/func_sec_to_time.cpp | 44 +++++++++++++++++- 3 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 mysql-test/columnstore/bugfixes/mcol_4623.result create mode 100644 mysql-test/columnstore/bugfixes/mcol_4623.test diff --git a/mysql-test/columnstore/bugfixes/mcol_4623.result b/mysql-test/columnstore/bugfixes/mcol_4623.result new file mode 100644 index 000000000..811492282 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol_4623.result @@ -0,0 +1,34 @@ +DROP DATABASE IF EXISTS mcol_4623; +CREATE DATABASE mcol_4623; +USE mcol_4623; +CREATE TABLE t1 (a DOUBLE UNSIGNED) Engine=ColumnStore; +INSERT INTO t1 VALUES (1000); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +SEC_TO_TIME(a) +00:16:40.000000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('17:31:27'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +SEC_TO_TIME(a) +17:31:27 +DROP TABLE t1; +CREATE TABLE t1 (a DATE) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('2023-07-23'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +SEC_TO_TIME(a) +838:59:59 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('2009-03-17 14:30:45'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +SEC_TO_TIME(a) +838:59:59 +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('2017-01-01 04:30:45'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +SEC_TO_TIME(a) +838:59:59 +DROP TABLE t1; +DROP DATABASE mcol_4623; diff --git a/mysql-test/columnstore/bugfixes/mcol_4623.test b/mysql-test/columnstore/bugfixes/mcol_4623.test new file mode 100644 index 000000000..9e1a879c8 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol_4623.test @@ -0,0 +1,45 @@ +-- source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS mcol_4623; +--enable_warnings +CREATE DATABASE mcol_4623; +USE mcol_4623; + +CREATE TABLE t1 (a DOUBLE UNSIGNED) Engine=ColumnStore; +INSERT INTO t1 VALUES (1000); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +--disable_warnings +DROP TABLE t1; +--enable_warnings + +CREATE TABLE t1 (a TIME) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('17:31:27'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +--disable_warnings +DROP TABLE t1; +--enable_warnings + +CREATE TABLE t1 (a DATE) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('2023-07-23'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +--disable_warnings +DROP TABLE t1; +--enable_warnings + +CREATE TABLE t1 (a DATETIME) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('2009-03-17 14:30:45'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +--disable_warnings +DROP TABLE t1; +--enable_warnings + +CREATE TABLE t1 (a TIMESTAMP) ENGINE=ColumnStore; +INSERT INTO t1 VALUES ('2017-01-01 04:30:45'); +SELECT SEC_TO_TIME(a) FROM t1 ORDER BY 1; +--disable_warnings +DROP TABLE t1; +--enable_warnings + +--disable_warnings +DROP DATABASE mcol_4623; +--enable_warnings diff --git a/utils/funcexp/func_sec_to_time.cpp b/utils/funcexp/func_sec_to_time.cpp index d9e2932f1..6bb67a071 100644 --- a/utils/funcexp/func_sec_to_time.cpp +++ b/utils/funcexp/func_sec_to_time.cpp @@ -67,33 +67,73 @@ string Func_sec_to_time::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& case execplan::CalpontSystemCatalog::USMALLINT: { val = parm[0]->data()->getIntVal(row, isNull); + break; } - break; case execplan::CalpontSystemCatalog::DOUBLE: + case execplan::CalpontSystemCatalog::UDOUBLE: { datatypes::TDouble d(parm[0]->data()->getDoubleVal(row, isNull)); val = d.toMCSSInt64Round(); break; } + case execplan::CalpontSystemCatalog::FLOAT: + case execplan::CalpontSystemCatalog::UFLOAT: { datatypes::TDouble d(parm[0]->data()->getFloatVal(row, isNull)); val = d.toMCSSInt64Round(); + break; + } + + case execplan::CalpontSystemCatalog::LONGDOUBLE: + { + datatypes::TLongDouble d(parm[0]->data()->getLongDoubleVal(row, isNull)); + val = d.toMCSSInt64Round(); + break; } - break; case execplan::CalpontSystemCatalog::DECIMAL: case execplan::CalpontSystemCatalog::UDECIMAL: + { val = parm[0]->data()->getDecimalVal(row, isNull).toSInt64Round(); break; + } case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::TEXT: { val = parm[0]->data()->getIntVal(row, isNull); + break; + } + case execplan::CalpontSystemCatalog::TIME: + { + int64_t timeVal = parm[0]->data()->getTimeIntVal(row, isNull); + uint32_t hour = (uint32_t)((timeVal >> 40) & 0xfff); + uint32_t minute = (uint32_t)((timeVal >> 32) & 0xff); + uint32_t second = (uint32_t)((timeVal >> 24) & 0xff); + val = (int64_t)(hour * 3600 + minute * 60 + second); + break; + } + + case execplan::CalpontSystemCatalog::DATE: + case execplan::CalpontSystemCatalog::DATETIME: + case execplan::CalpontSystemCatalog::TIMESTAMP: + { + return "838:59:59"; + break; + } + + case execplan::CalpontSystemCatalog::BLOB: + case execplan::CalpontSystemCatalog::CLOB: + case execplan::CalpontSystemCatalog::VARBINARY: + case execplan::CalpontSystemCatalog::STRINT: + case execplan::CalpontSystemCatalog::NUM_OF_COL_DATA_TYPE: + case execplan::CalpontSystemCatalog::UNDEFINED: + { + val = parm[0]->data()->getIntVal(row, isNull); break; } From 3d08646c05f8dbebe387a1ed37720ad160938174 Mon Sep 17 00:00:00 2001 From: drrtuy Date: Mon, 20 Oct 2025 18:49:09 +0000 Subject: [PATCH 11/19] chore(): QA is available in enterprise builds. --- cmake/compiler_flags.cmake | 8 ++++++++ dbcon/mysql/ha_mcs.cpp | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index b88e1eb2f..dd701bb69 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -95,6 +95,14 @@ set(GNU_FLAGS # suppressed warnings set(ASAN_FLAGS -U_FORTIFY_SOURCE -fsanitize=address -fsanitize-address-use-after-scope -fPIC) # } end Sanitizers +# Check if built with enterprise configuration +if(MYSQL_SERVER_SUFFIX STREQUAL "-enterprise") + message(STATUS "ColumnStore: Compiling with ENTERPRISE features enabled") + my_check_and_set_compiler_flag("-DCOLUMNSTORE_COMPILED_WITH_ENTERPRISE") +else() + message(STATUS "ColumnStore: Compiling with COMMUNITY features") +endif() + # configured by cmake/configureEngine.cmake { if(MASK_LONGDOUBLE) my_check_and_set_compiler_flag("-DMASK_LONGDOUBLE") diff --git a/dbcon/mysql/ha_mcs.cpp b/dbcon/mysql/ha_mcs.cpp index c340cc7f4..2891a00c6 100644 --- a/dbcon/mysql/ha_mcs.cpp +++ b/dbcon/mysql/ha_mcs.cpp @@ -77,6 +77,15 @@ pthread_mutex_t mcs_mutex; #endif #define DEBUG_RETURN return +bool isEnterprise() +{ +#ifdef COLUMNSTORE_COMPILED_WITH_ENTERPRISE + return true; +#else + return false; +#endif +} + /** @brief Function we use in the creation of our hash to get key. @@ -1866,7 +1875,7 @@ static int columnstore_init_func(void* p) mcs_hton->create_unit = create_columnstore_unit_handler; mcs_hton->db_type = DB_TYPE_AUTOASSIGN; - if (get_innodb_queries_uses_mcs()) + if (isEnterprise() && get_innodb_queries_uses_mcs()) { std::cerr << "Columnstore: innodb_queries_uses_mcs is set, redirecting all InnoDB queries to Columnstore." << std::endl; From 22454e6eef5ba17c573f7602203e997c9331748d Mon Sep 17 00:00:00 2001 From: drrtuy Date: Mon, 20 Oct 2025 18:50:41 +0000 Subject: [PATCH 12/19] chore(): Bump VERSION up to 25.10.1-1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b20ede550..c89f2840a 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ COLUMNSTORE_VERSION_MAJOR=25 COLUMNSTORE_VERSION_MINOR=10 -COLUMNSTORE_VERSION_PATCH=0 +COLUMNSTORE_VERSION_PATCH=1 COLUMNSTORE_VERSION_RELEASE=1 From 45fecde90279280f1e61d0f3b77440104f90d05d Mon Sep 17 00:00:00 2001 From: Kristina Pavlova Date: Tue, 21 Oct 2025 16:03:54 +0300 Subject: [PATCH 13/19] fix(plugin): MCOL 5675 - fix error message for null-safe equal (#3754) --- dbcon/mysql/ha_mcs_execplan.cpp | 6 ++++++ .../columnstore/basic/r/mcol-5675.result | 10 ++++++++++ .../r/mcs111_comparison_operators.result | 2 +- mysql-test/columnstore/basic/t/mcol-5675.test | 19 +++++++++++++++++++ .../basic/t/mcs111_comparison_operators.test | 1 + 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 mysql-test/columnstore/basic/r/mcol-5675.result create mode 100644 mysql-test/columnstore/basic/t/mcol-5675.test diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 01ab0e52c..76ef89cc0 100644 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -1692,6 +1692,12 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip) { // Convert "a <=> b" to (a = b OR (a IS NULL AND b IS NULL))" idbassert(gwip->rcWorkStack.size() >= 2); + if(std::strcmp(ifp->func_name(), "<=>") == 0) + { + gwip->fatalParseError= true; + gwip->parseErrorText = "<=> (null-safe equal) is not supported in Columnstore"; + return false; + } ReturnedColumn* rhs = gwip->rcWorkStack.top(); gwip->rcWorkStack.pop(); ReturnedColumn* lhs = gwip->rcWorkStack.top(); diff --git a/mysql-test/columnstore/basic/r/mcol-5675.result b/mysql-test/columnstore/basic/r/mcol-5675.result new file mode 100644 index 000000000..a5c6fffc1 --- /dev/null +++ b/mysql-test/columnstore/basic/r/mcol-5675.result @@ -0,0 +1,10 @@ +DROP DATABASE IF EXISTS test_mcol5675; +CREATE DATABASE test_mcol5675; +USE test_mcol5675; +CREATE TABLE person (name varchar(100) NOT NULL, surname varchar(100) DEFAULT NULL ) +ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ; +insert into person (name, surname) values ('Warren', NULL), ('Charlie', 'Peterson'); +SELECT * FROM person WHERE surname <=> 1; +ERROR HY000: Internal error: <=> (null-safe equal) is not supported in Columnstore +DROP TABLE person; +DROP DATABASE test_mcol5675; diff --git a/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result b/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result index 25cd86f98..62f54a00d 100644 --- a/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result +++ b/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result @@ -62,7 +62,7 @@ t1_INT t1_DECIMAL 103 1234.56990 9913 98765.43210 SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <=> t1_DECIMAL ORDER BY 1; -t1_INT t1_DECIMAL +ERROR HY000: Internal error: <=> (null-safe equal) is not supported in Columnstore SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <> t1_DECIMAL ORDER BY 1; t1_INT t1_DECIMAL -7299 111.99000 diff --git a/mysql-test/columnstore/basic/t/mcol-5675.test b/mysql-test/columnstore/basic/t/mcol-5675.test new file mode 100644 index 000000000..406be6791 --- /dev/null +++ b/mysql-test/columnstore/basic/t/mcol-5675.test @@ -0,0 +1,19 @@ +--disable_warnings +DROP DATABASE IF EXISTS test_mcol5675; +--enable_warnings + +CREATE DATABASE test_mcol5675; +USE test_mcol5675; + +CREATE TABLE person (name varchar(100) NOT NULL, surname varchar(100) DEFAULT NULL ) + ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ; + +insert into person (name, surname) values ('Warren', NULL), ('Charlie', 'Peterson'); + +--error 1815 +SELECT * FROM person WHERE surname <=> 1; + +DROP TABLE person; + +#clear +DROP DATABASE test_mcol5675; \ No newline at end of file diff --git a/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test b/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test index 59ecfe3c4..ea6e3d257 100644 --- a/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test +++ b/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test @@ -50,6 +50,7 @@ SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT != t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT = t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT >= t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <= t1_DECIMAL ORDER BY 1; +--error 1815 SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <=> t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <> t1_DECIMAL ORDER BY 1; From f280382a3d5f8a625fb7425dbb044e9617eb8e1a Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 22 Oct 2025 00:46:45 +0300 Subject: [PATCH 14/19] add 11.4 and 11.8 Jammy builds for nightly Burza --- .drone.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 34791515d..0cdf275ed 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -17,7 +17,7 @@ local platforms = { }; local extra_servers_platforms = { - [current_branch]: ["rockylinux:9", "debian:13", "ubuntu:24.04"], + [current_branch]: ["rockylinux:9", "debian:13", "ubuntu:24.04", "ubuntu:22.04"], }; //local archs = ["amd64", "arm64"]; From 11d5815e79a5071c00cc201e82d69235c9095748 Mon Sep 17 00:00:00 2001 From: "aleksei.bukhalov" Date: Mon, 20 Oct 2025 14:00:34 +0200 Subject: [PATCH 15/19] fix(mtr): lowercase database name --- .../columnstore/basic/r/JSON-type.result | 10 +++++----- mysql-test/columnstore/basic/t/JSON-type.test | 8 ++++---- ...MCOL-6198-segfault-crossengine-join.result | 6 +++--- .../MCOL-6198-segfault-crossengine-join.test | 20 +++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/mysql-test/columnstore/basic/r/JSON-type.result b/mysql-test/columnstore/basic/r/JSON-type.result index faee378b3..241937864 100644 --- a/mysql-test/columnstore/basic/r/JSON-type.result +++ b/mysql-test/columnstore/basic/r/JSON-type.result @@ -1,9 +1,9 @@ -DROP DATABASE IF EXISTS JSON_type; -CREATE DATABASE JSON_type; -USE JSON_type; +DROP DATABASE IF EXISTS json_type; +CREATE DATABASE json_type; +USE json_type; CREATE TABLE tj(j JSON) ENGINE=COLUMNSTORE; INSERT INTO tj(j) VALUES ('()'); -ERROR 23000: CONSTRAINT `tj.j` failed for `JSON_type`.`tj` +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` INSERT INTO tj(j) VALUES ('[]'), ('{}'), ('"a"'); SELECT * FROM tj WHERE j = '"A"'; j @@ -13,4 +13,4 @@ j INSERT INTO tj(j) VALUES ('{"a":"b", "b":"a"}'); SELECT * FROM tj WHERE j = '{"b":"a","a":"b"}'; j -DROP DATABASE JSON_type; +DROP DATABASE json_type; diff --git a/mysql-test/columnstore/basic/t/JSON-type.test b/mysql-test/columnstore/basic/t/JSON-type.test index 2b96897c7..3da4a985c 100644 --- a/mysql-test/columnstore/basic/t/JSON-type.test +++ b/mysql-test/columnstore/basic/t/JSON-type.test @@ -1,8 +1,8 @@ --disable_warnings -DROP DATABASE IF EXISTS JSON_type; +DROP DATABASE IF EXISTS json_type; --enable_warnings -CREATE DATABASE JSON_type; -USE JSON_type; +CREATE DATABASE json_type; +USE json_type; CREATE TABLE tj(j JSON) ENGINE=COLUMNSTORE; --error 4025 INSERT INTO tj(j) VALUES ('()'); # invalid @@ -13,5 +13,5 @@ INSERT INTO tj(j) VALUES ('{"a":"b", "b":"a"}'); SELECT * FROM tj WHERE j = '{"b":"a","a":"b"}'; # empty set, comparison is not structural. # UPDATE is not tested because it does not work. #UPDATE tj SET j = CONCAT(j,'()'); -DROP DATABASE JSON_type; +DROP DATABASE json_type; diff --git a/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result index 21aff1c26..2265636b7 100644 --- a/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result +++ b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.result @@ -1,5 +1,5 @@ -DROP DATABASE IF EXISTS MCOL_6198; -CREATE DATABASE MCOL_6198; +DROP DATABASE IF EXISTS mcol_6198; +CREATE DATABASE mcol_6198; SELECT v.c36 AS hst, m.p6 AS g, @@ -14,4 +14,4 @@ LEFT OUTER JOIN group_g02 AS g1 ON g1.key_id=m.p6 WHERE 1=1 GROUP BY c36,p6,g01,g02; -DROP DATABASE MCOL_6198; +DROP DATABASE mcol_6198; diff --git a/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test index 8d65b07cc..f6fd4d619 100644 --- a/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test +++ b/mysql-test/columnstore/bugfixes/MCOL-6198-segfault-crossengine-join.test @@ -4,11 +4,11 @@ -- source include/have_innodb.inc --disable_warnings -DROP DATABASE IF EXISTS MCOL_6198; -CREATE DATABASE MCOL_6198; +DROP DATABASE IF EXISTS mcol_6198; +CREATE DATABASE mcol_6198; --disable_query_log --disable_result_log -USE MCOL_6198; +USE mcol_6198; # # Enable cross engine join # Configure user and password in Columnstore.xml file @@ -1194,13 +1194,13 @@ END ==STOP== --delimiter ; -call filltablecol("MCOL_6198","c",100000); -call filltablecol("MCOL_6198","c",100000); +call filltablecol("mcol_6198","c",100000); +call filltablecol("mcol_6198","c",100000); -call filltablecol("MCOL_6198","p",100000); -call filltablecol("MCOL_6198","p",100000); -call filltablecol("MCOL_6198","p",100000); -call filltablecol("MCOL_6198","p",100000); +call filltablecol("mcol_6198","p",100000); +call filltablecol("mcol_6198","p",100000); +call filltablecol("mcol_6198","p",100000); +call filltablecol("mcol_6198","p",100000); CREATE TABLE group_g01(key_id BIGINT, eg_id VARCHAR(40)) ENGINE=innoDB; @@ -1231,4 +1231,4 @@ DROP USER 'cejuser'@'localhost'; --enable_result_log --enable_warnings -DROP DATABASE MCOL_6198; +DROP DATABASE mcol_6198; From 8dd0e7f2ba3994bf8acca598c524fba56c8e048f Mon Sep 17 00:00:00 2001 From: "aleksei.bukhalov" Date: Mon, 20 Oct 2025 18:09:17 +0200 Subject: [PATCH 16/19] MCOL-6197 add more testcases --- .../columnstore/basic/r/JSON-type.result | 22 +++++++++++++++++ mysql-test/columnstore/basic/t/JSON-type.test | 24 ++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/mysql-test/columnstore/basic/r/JSON-type.result b/mysql-test/columnstore/basic/r/JSON-type.result index 241937864..e9661d4d1 100644 --- a/mysql-test/columnstore/basic/r/JSON-type.result +++ b/mysql-test/columnstore/basic/r/JSON-type.result @@ -4,6 +4,28 @@ USE json_type; CREATE TABLE tj(j JSON) ENGINE=COLUMNSTORE; INSERT INTO tj(j) VALUES ('()'); ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES ('{'); +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES ('[1, 2,'); +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES ('"unclosed string'); +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES ('{"key": value}'); +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES (''); +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES ('{"good":1}'), ('bad'), ('[]'); +ERROR 23000: CONSTRAINT `tj.j` failed for `json_type`.`tj` +INSERT INTO tj(j) VALUES ('{"nested": [1, true, null]}'); +INSERT INTO tj(j) VALUES ('[ "hello", 42, false ]'); +INSERT INTO tj(j) VALUES (NULL); +SELECT * FROM tj WHERE j IS NULL; +j +NULL +INSERT INTO tj(j) VALUES ('null'); +SELECT * FROM tj WHERE j = 'null'; +j +null INSERT INTO tj(j) VALUES ('[]'), ('{}'), ('"a"'); SELECT * FROM tj WHERE j = '"A"'; j diff --git a/mysql-test/columnstore/basic/t/JSON-type.test b/mysql-test/columnstore/basic/t/JSON-type.test index 3da4a985c..9805fb6b5 100644 --- a/mysql-test/columnstore/basic/t/JSON-type.test +++ b/mysql-test/columnstore/basic/t/JSON-type.test @@ -5,7 +5,29 @@ CREATE DATABASE json_type; USE json_type; CREATE TABLE tj(j JSON) ENGINE=COLUMNSTORE; --error 4025 -INSERT INTO tj(j) VALUES ('()'); # invalid +INSERT INTO tj(j) VALUES ('()'); +--error 4025 +INSERT INTO tj(j) VALUES ('{'); +--error 4025 +INSERT INTO tj(j) VALUES ('[1, 2,'); +--error 4025 +INSERT INTO tj(j) VALUES ('"unclosed string'); +--error 4025 +INSERT INTO tj(j) VALUES ('{"key": value}'); +--error 4025 +INSERT INTO tj(j) VALUES (''); + +# batch insert with mix of valid and invalid, should fail entirely +--error 4025 +INSERT INTO tj(j) VALUES ('{"good":1}'), ('bad'), ('[]'); + +INSERT INTO tj(j) VALUES ('{"nested": [1, true, null]}'); +INSERT INTO tj(j) VALUES ('[ "hello", 42, false ]'); +INSERT INTO tj(j) VALUES (NULL); +SELECT * FROM tj WHERE j IS NULL; +INSERT INTO tj(j) VALUES ('null'); +SELECT * FROM tj WHERE j = 'null'; + INSERT INTO tj(j) VALUES ('[]'), ('{}'), ('"a"'); # valid SELECT * FROM tj WHERE j = '"A"'; # empty set. SELECT * FROM tj WHERE j = '"a"'; # single row. From 17035ab99015443af753e268c82ac2ce46f31a17 Mon Sep 17 00:00:00 2001 From: Aleksei Bukhalov Date: Thu, 23 Oct 2025 14:07:02 +0200 Subject: [PATCH 17/19] Revert "fix(plugin): MCOL 5675 - fix error message for null-safe equal (#3754)" This reverts commit 45fecde90279280f1e61d0f3b77440104f90d05d. --- dbcon/mysql/ha_mcs_execplan.cpp | 6 ------ .../columnstore/basic/r/mcol-5675.result | 10 ---------- .../r/mcs111_comparison_operators.result | 2 +- mysql-test/columnstore/basic/t/mcol-5675.test | 19 ------------------- .../basic/t/mcs111_comparison_operators.test | 1 - 5 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 mysql-test/columnstore/basic/r/mcol-5675.result delete mode 100644 mysql-test/columnstore/basic/t/mcol-5675.test diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 76ef89cc0..01ab0e52c 100644 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -1692,12 +1692,6 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip) { // Convert "a <=> b" to (a = b OR (a IS NULL AND b IS NULL))" idbassert(gwip->rcWorkStack.size() >= 2); - if(std::strcmp(ifp->func_name(), "<=>") == 0) - { - gwip->fatalParseError= true; - gwip->parseErrorText = "<=> (null-safe equal) is not supported in Columnstore"; - return false; - } ReturnedColumn* rhs = gwip->rcWorkStack.top(); gwip->rcWorkStack.pop(); ReturnedColumn* lhs = gwip->rcWorkStack.top(); diff --git a/mysql-test/columnstore/basic/r/mcol-5675.result b/mysql-test/columnstore/basic/r/mcol-5675.result deleted file mode 100644 index a5c6fffc1..000000000 --- a/mysql-test/columnstore/basic/r/mcol-5675.result +++ /dev/null @@ -1,10 +0,0 @@ -DROP DATABASE IF EXISTS test_mcol5675; -CREATE DATABASE test_mcol5675; -USE test_mcol5675; -CREATE TABLE person (name varchar(100) NOT NULL, surname varchar(100) DEFAULT NULL ) -ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ; -insert into person (name, surname) values ('Warren', NULL), ('Charlie', 'Peterson'); -SELECT * FROM person WHERE surname <=> 1; -ERROR HY000: Internal error: <=> (null-safe equal) is not supported in Columnstore -DROP TABLE person; -DROP DATABASE test_mcol5675; diff --git a/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result b/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result index 62f54a00d..25cd86f98 100644 --- a/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result +++ b/mysql-test/columnstore/basic/r/mcs111_comparison_operators.result @@ -62,7 +62,7 @@ t1_INT t1_DECIMAL 103 1234.56990 9913 98765.43210 SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <=> t1_DECIMAL ORDER BY 1; -ERROR HY000: Internal error: <=> (null-safe equal) is not supported in Columnstore +t1_INT t1_DECIMAL SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <> t1_DECIMAL ORDER BY 1; t1_INT t1_DECIMAL -7299 111.99000 diff --git a/mysql-test/columnstore/basic/t/mcol-5675.test b/mysql-test/columnstore/basic/t/mcol-5675.test deleted file mode 100644 index 406be6791..000000000 --- a/mysql-test/columnstore/basic/t/mcol-5675.test +++ /dev/null @@ -1,19 +0,0 @@ ---disable_warnings -DROP DATABASE IF EXISTS test_mcol5675; ---enable_warnings - -CREATE DATABASE test_mcol5675; -USE test_mcol5675; - -CREATE TABLE person (name varchar(100) NOT NULL, surname varchar(100) DEFAULT NULL ) - ENGINE=Columnstore DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ; - -insert into person (name, surname) values ('Warren', NULL), ('Charlie', 'Peterson'); - ---error 1815 -SELECT * FROM person WHERE surname <=> 1; - -DROP TABLE person; - -#clear -DROP DATABASE test_mcol5675; \ No newline at end of file diff --git a/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test b/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test index ea6e3d257..59ecfe3c4 100644 --- a/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test +++ b/mysql-test/columnstore/basic/t/mcs111_comparison_operators.test @@ -50,7 +50,6 @@ SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT != t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT = t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT >= t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <= t1_DECIMAL ORDER BY 1; ---error 1815 SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <=> t1_DECIMAL ORDER BY 1; SELECT t1_INT, t1_DECIMAL from t1 WHERE t1_INT <> t1_DECIMAL ORDER BY 1; From e3a2563b58898de8117199eddfd7845c5a24886d Mon Sep 17 00:00:00 2001 From: drrtuy Date: Thu, 23 Oct 2025 12:40:01 +0000 Subject: [PATCH 18/19] chore(cmake): MDEV-37921 rbo target now depends on MDB error codes. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 630918208..75aa24b19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ foreach(component ${COMPONENTS}) add_subdirectory(${component}) endforeach() +add_dependencies(rbo GenError) add_dependencies(udf_mysql GenError) add_dependencies(funcexp GenError) add_dependencies(oamcpp GenError) From dd82f2d91d834f58ea71633069403f51f2af1f66 Mon Sep 17 00:00:00 2001 From: "aleksei.bukhalov" Date: Fri, 24 Oct 2025 13:37:03 +0200 Subject: [PATCH 19/19] MCOL-6217 increase ram for mtrs --- build/prepare_test_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/prepare_test_container.sh b/build/prepare_test_container.sh index 01ae7dfab..5f9b56135 100755 --- a/build/prepare_test_container.sh +++ b/build/prepare_test_container.sh @@ -58,7 +58,7 @@ start_container() { if [[ "$CONTAINER_NAME" == *smoke* ]]; then docker_run_args+=(--memory 3g) elif [[ "$CONTAINER_NAME" == *mtr* ]]; then - docker_run_args+=(--shm-size=500m --memory 12g --env MYSQL_TEST_DIR="$MTR_PATH") + docker_run_args+=(--shm-size=500m --memory 13g --env MYSQL_TEST_DIR="$MTR_PATH") elif [[ "$CONTAINER_NAME" == *cmapi* ]]; then docker_run_args+=(--env PYTHONPATH="${PYTHONPATH}") elif [[ "$CONTAINER_NAME" == *upgrade* ]]; then