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"]; 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) diff --git a/VERSION b/VERSION index 1c93ec7ee..c89f2840a 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=1 COLUMNSTORE_VERSION_RELEASE=1 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 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/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) diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index face4efdb..7045ab44e 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -427,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; @@ -782,6 +784,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/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.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; 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/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; } 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 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')`. 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 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..e9661d4d1 --- /dev/null +++ b/mysql-test/columnstore/basic/r/JSON-type.result @@ -0,0 +1,38 @@ +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 ('{'); +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 +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..9805fb6b5 --- /dev/null +++ b/mysql-test/columnstore/basic/t/JSON-type.test @@ -0,0 +1,39 @@ +--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 ('()'); +--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. +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/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..2265636b7 --- /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..f6fd4d619 --- /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/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/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 + 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); 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; } 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;