diff --git a/mysql-test/suite/tianmu/r/alter_table_mix_use.result b/mysql-test/suite/tianmu/r/alter_table_mix_use.result new file mode 100644 index 000000000..8a00f1c29 --- /dev/null +++ b/mysql-test/suite/tianmu/r/alter_table_mix_use.result @@ -0,0 +1,176 @@ +create database alter_table_mix; +use alter_table_mix; +CREATE TABLE `alter_table_mix_test` ( +`c_tinyint` tinyint DEFAULT NULL COMMENT 'tinyint', +`c_smallint` smallint NOT NULL COMMENT 'smallint', +`c_mediumint` mediumint DEFAULT NULL COMMENT 'mediumint', +`c_int` int DEFAULT NULL COMMENT 'int', +`c_bigint` bigint DEFAULT NULL COMMENT 'bigint', +`c_float` float DEFAULT NULL COMMENT 'float', +`c_double` double DEFAULT NULL COMMENT 'double', +`c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', +`c_date` date DEFAULT NULL COMMENT 'date', +`c_datetime` datetime DEFAULT NULL COMMENT 'datetime', +`c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', +`c_time` time DEFAULT NULL COMMENT 'time', +`c_char` char(10) DEFAULT NULL COMMENT 'char', +`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', +`c_blob` blob COMMENT 'blob', +`c_text` text COMMENT 'text', +`c_longblob` longblob COMMENT 'longblob' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +show create table alter_table_mix_test; +Table Create Table +alter_table_mix_test CREATE TABLE `alter_table_mix_test` ( + `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint(6) NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', + `c_int` int(11) DEFAULT NULL COMMENT 'int', + `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text', + `c_longblob` longblob COMMENT 'longblob' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +insert into alter_table_mix_test(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn'); +alter table alter_table_mix_test rename alter_table_rename_add, add c_add char(10); +show create table alter_table_rename_add; +Table Create Table +alter_table_rename_add CREATE TABLE `alter_table_rename_add` ( + `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint(6) NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', + `c_int` int(11) DEFAULT NULL COMMENT 'int', + `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text', + `c_longblob` longblob COMMENT 'longblob', + `c_add` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +insert into alter_table_rename_add(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text, c_add) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn', 'add'); +show create table alter_table_rename_add; +Table Create Table +alter_table_rename_add CREATE TABLE `alter_table_rename_add` ( + `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint(6) NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', + `c_int` int(11) DEFAULT NULL COMMENT 'int', + `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text', + `c_longblob` longblob COMMENT 'longblob', + `c_add` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +CREATE TABLE `alter_table_mix_test` ( +`c_tinyint` tinyint DEFAULT NULL COMMENT 'tinyint', +`c_smallint` smallint NOT NULL COMMENT 'smallint', +`c_mediumint` mediumint DEFAULT NULL COMMENT 'mediumint', +`c_int` int DEFAULT NULL COMMENT 'int', +`c_bigint` bigint DEFAULT NULL COMMENT 'bigint', +`c_float` float DEFAULT NULL COMMENT 'float', +`c_double` double DEFAULT NULL COMMENT 'double', +`c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', +`c_date` date DEFAULT NULL COMMENT 'date', +`c_datetime` datetime DEFAULT NULL COMMENT 'datetime', +`c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', +`c_time` time DEFAULT NULL COMMENT 'time', +`c_char` char(10) DEFAULT NULL COMMENT 'char', +`c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', +`c_blob` blob COMMENT 'blob', +`c_text` text COMMENT 'text', +`c_longblob` longblob COMMENT 'longblob' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +show create table alter_table_mix_test; +Table Create Table +alter_table_mix_test CREATE TABLE `alter_table_mix_test` ( + `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint(6) NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', + `c_int` int(11) DEFAULT NULL COMMENT 'int', + `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text', + `c_longblob` longblob COMMENT 'longblob' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +insert into alter_table_mix_test(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn'); +alter table alter_table_mix_test rename alter_table_rename_drop, drop c_longblob; +show create table alter_table_rename_drop; +Table Create Table +alter_table_rename_drop CREATE TABLE `alter_table_rename_drop` ( + `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint(6) NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', + `c_int` int(11) DEFAULT NULL COMMENT 'int', + `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +insert into alter_table_rename_drop(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn'); +show create table alter_table_rename_drop; +Table Create Table +alter_table_rename_drop CREATE TABLE `alter_table_rename_drop` ( + `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint(6) NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', + `c_int` int(11) DEFAULT NULL COMMENT 'int', + `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci diff --git a/mysql-test/suite/tianmu/r/alter_table_null.result b/mysql-test/suite/tianmu/r/alter_table_null.result index eda7a2890..c105a39e5 100644 --- a/mysql-test/suite/tianmu/r/alter_table_null.result +++ b/mysql-test/suite/tianmu/r/alter_table_null.result @@ -40,12 +40,12 @@ alter_table_null_test CREATE TABLE `alter_table_null_test` ( `c_text` text COLLATE utf8mb4_unicode_ci COMMENT 'text', `c_longblob` longblob COMMENT 'longblob' ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci -alter table alter_table_null_test modify c_smallint smallint NOT NULL; +alter table alter_table_null_test modify c_smallint smallint NULL; show create table alter_table_null_test; Table Create Table alter_table_null_test CREATE TABLE `alter_table_null_test` ( `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', - `c_smallint` smallint(6) NOT NULL, + `c_smallint` smallint(6) DEFAULT NULL, `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', `c_int` int(11) DEFAULT NULL COMMENT 'int', `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', @@ -68,7 +68,7 @@ show create table alter_table_null_test; Table Create Table alter_table_null_test CREATE TABLE `alter_table_null_test` ( `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', - `c_smallint` smallint(6) NOT NULL, + `c_smallint` smallint(6) DEFAULT NULL, `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', `c_int` int(11) DEFAULT NULL COMMENT 'int', `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', @@ -89,7 +89,7 @@ show create table alter_table_null_test; Table Create Table alter_table_null_test CREATE TABLE `alter_table_null_test` ( `c_tinyint` tinyint(4) DEFAULT NULL COMMENT 'tinyint', - `c_smallint` smallint(6) NOT NULL, + `c_smallint` smallint(6) DEFAULT NULL, `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', `c_int` int(11) DEFAULT NULL COMMENT 'int', `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', @@ -111,7 +111,7 @@ show create table alter_table_null_test; Table Create Table alter_table_null_test CREATE TABLE `alter_table_null_test` ( `c_tinyint` tinyint(4) NOT NULL, - `c_smallint` smallint(6) NOT NULL, + `c_smallint` smallint(6) DEFAULT NULL, `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', `c_int` int(11) DEFAULT NULL COMMENT 'int', `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', @@ -134,7 +134,7 @@ show create table alter_table_null_test; Table Create Table alter_table_null_test CREATE TABLE `alter_table_null_test` ( `c_tinyint` tinyint(4) NOT NULL, - `c_smallint` smallint(6) NOT NULL, + `c_smallint` smallint(6) DEFAULT NULL, `c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint', `c_int` int(11) DEFAULT NULL COMMENT 'int', `c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint', diff --git a/mysql-test/suite/tianmu/t/alter_table_mix_use.test b/mysql-test/suite/tianmu/t/alter_table_mix_use.test new file mode 100644 index 000000000..8e66f49dd --- /dev/null +++ b/mysql-test/suite/tianmu/t/alter_table_mix_use.test @@ -0,0 +1,84 @@ +--source include/have_tianmu.inc + +# +#ALTER TABLE table_name NOT NULL to NULL or NULL to NOT NULL ... +# +create database alter_table_mix; +use alter_table_mix; + +CREATE TABLE `alter_table_mix_test` ( + `c_tinyint` tinyint DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint DEFAULT NULL COMMENT 'mediumint', + `c_int` int DEFAULT NULL COMMENT 'int', + `c_bigint` bigint DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COMMENT 'text', + `c_longblob` longblob COMMENT 'longblob' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +# +#ALTER TABLE: RENAME TABLE and ADD COLUMN +# + +show create table alter_table_mix_test; + +insert into alter_table_mix_test(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn'); + +alter table alter_table_mix_test rename alter_table_rename_add, add c_add char(10); + +show create table alter_table_rename_add; + +insert into alter_table_rename_add(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text, c_add) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn', 'add'); + +show create table alter_table_rename_add; + +# +#ALTER TABLE: RENAME TABLE and DROP COLUMN +# + +CREATE TABLE `alter_table_mix_test` ( + `c_tinyint` tinyint DEFAULT NULL COMMENT 'tinyint', + `c_smallint` smallint NOT NULL COMMENT 'smallint', + `c_mediumint` mediumint DEFAULT NULL COMMENT 'mediumint', + `c_int` int DEFAULT NULL COMMENT 'int', + `c_bigint` bigint DEFAULT NULL COMMENT 'bigint', + `c_float` float DEFAULT NULL COMMENT 'float', + `c_double` double DEFAULT NULL COMMENT 'double', + `c_decimal` decimal(10,5) DEFAULT NULL COMMENT 'decimal', + `c_date` date DEFAULT NULL COMMENT 'date', + `c_datetime` datetime DEFAULT NULL COMMENT 'datetime', + `c_timestamp` timestamp NULL DEFAULT NULL COMMENT 'timestamp', + `c_time` time DEFAULT NULL COMMENT 'time', + `c_char` char(10) DEFAULT NULL COMMENT 'char', + `c_varchar` varchar(10) DEFAULT NULL COMMENT 'varchar', + `c_blob` blob COMMENT 'blob', + `c_text` text COMMENT 'text', + `c_longblob` longblob COMMENT 'longblob' +) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +show create table alter_table_mix_test; + +insert into alter_table_mix_test(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn'); + +alter table alter_table_mix_test rename alter_table_rename_drop, drop c_longblob; + +show create table alter_table_rename_drop; + +insert into alter_table_rename_drop(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text) +values(105,105,105,105,105,5.2,10.88,105.083,'2016-02-25','2016-02-25 10:20:01','2016-02-25 05:20:01','10:20:01','stoneatom1','hello1','bcdefghijklmn'); + +show create table alter_table_rename_drop; + diff --git a/mysql-test/suite/tianmu/t/alter_table_null.test b/mysql-test/suite/tianmu/t/alter_table_null.test index 52135ad69..f2e080a8d 100644 --- a/mysql-test/suite/tianmu/t/alter_table_null.test +++ b/mysql-test/suite/tianmu/t/alter_table_null.test @@ -32,7 +32,7 @@ CREATE TABLE `alter_table_null_test` ( show create table alter_table_null_test; -alter table alter_table_null_test modify c_smallint smallint NOT NULL; +alter table alter_table_null_test modify c_smallint smallint NULL; show create table alter_table_null_test; diff --git a/storage/tianmu/core/temp_table.h b/storage/tianmu/core/temp_table.h index a6a94e52e..fd8c586aa 100644 --- a/storage/tianmu/core/temp_table.h +++ b/storage/tianmu/core/temp_table.h @@ -109,20 +109,20 @@ class TempTable : public JustATable { bool outer_nulls_possible) override; // provide the best upper // approximation of number of diff. // values (incl. null, if flag set) - uint64_t ExactDistinctVals([[maybe_unused]] Filter *f) override { return common::NULL_VALUE_64; } - bool IsDistinct([[maybe_unused]] Filter *f) override { return false; } + uint64_t ExactDistinctVals(Filter *f [[maybe_unused]]) override { return common::NULL_VALUE_64; } + bool IsDistinct(Filter *f [[maybe_unused]]) override { return false; } size_t MaxStringSize(Filter *f = nullptr) override; // maximal byte string length in column - int64_t RoughMin(Filter *f = nullptr, common::RSValue *rf = nullptr) override { + int64_t RoughMin(Filter *f [[maybe_unused]] = nullptr, common::RSValue *rf [[maybe_unused]] = nullptr) override { return common::MINUS_INF_64; } // for numerical: best rough approximation of min for a given filter (or // global min if filter is nullptr) - int64_t RoughMax(Filter *f = nullptr, common::RSValue *rf = nullptr) override { + int64_t RoughMax(Filter *f [[maybe_unused]] = nullptr, common::RSValue *rf [[maybe_unused]] = nullptr) override { return common::PLUS_INF_64; } // for numerical: best rough approximation of max for a given filter (or // global max if filter is nullptr) - void DisplayAttrStats([[maybe_unused]] Filter *f) override {} - bool TryToMerge([[maybe_unused]] Descriptor &d1, [[maybe_unused]] Descriptor &d2) override { return false; } - PackOntologicalStatus GetPackOntologicalStatus([[maybe_unused]] int pack_no) override { + void DisplayAttrStats(Filter *f [[maybe_unused]]) override {} + bool TryToMerge(Descriptor &d1 [[maybe_unused]], Descriptor &d2 [[maybe_unused]]) override { return false; } + PackOntologicalStatus GetPackOntologicalStatus(int pack_no [[maybe_unused]]) override { return PackOntologicalStatus::NORMAL; } // not implemented properly yet void ApplyFilter(MultiIndex &, int64_t offset, int64_t no_obj); @@ -144,30 +144,30 @@ class TempTable : public JustATable { bool IsRoughNullsOnly() const override { return false; } int64_t GetSum(int pack, bool &nonnegative) override; int NumOfAttr() const override { return -1; } - common::RSValue RoughCheck([[maybe_unused]] int pack, [[maybe_unused]] Descriptor &d, - [[maybe_unused]] bool additional_nulls_possible) override { + common::RSValue RoughCheck(int pack [[maybe_unused]], Descriptor &d [[maybe_unused]], + bool additional_nulls_possible [[maybe_unused]]) override { return common::RSValue::RS_SOME; } - common::RSValue RoughCheck([[maybe_unused]] int pack1, [[maybe_unused]] int pack2, - [[maybe_unused]] Descriptor &d) override { + common::RSValue RoughCheck(int pack1 [[maybe_unused]], int pack2 [[maybe_unused]], + Descriptor &d [[maybe_unused]]) override { return common::RSValue::RS_SOME; } // as far as Attr is not pack oriented the function below should not be // called - void EvaluatePack([[maybe_unused]] MIUpdatingIterator &mit, [[maybe_unused]] int dim, - [[maybe_unused]] Descriptor &desc) override { + void EvaluatePack(MIUpdatingIterator &mit [[maybe_unused]], int dim [[maybe_unused]], + Descriptor &desc [[maybe_unused]]) override { DEBUG_ASSERT(0); } - common::ErrorCode EvaluateOnIndex([[maybe_unused]] MIUpdatingIterator &mit, [[maybe_unused]] int dim, - [[maybe_unused]] Descriptor &desc, [[maybe_unused]] int64_t limit) override { + common::ErrorCode EvaluateOnIndex(MIUpdatingIterator &mit [[maybe_unused]], int dim [[maybe_unused]], + Descriptor &desc [[maybe_unused]], int64_t limit [[maybe_unused]]) override { TIANMU_ERROR("To be implemented."); return common::ErrorCode::FAILED; } - types::BString DecodeValue_S([[maybe_unused]] int64_t code) override { + types::BString DecodeValue_S(int64_t code [[maybe_unused]]) override { DEBUG_ASSERT(0); return types::BString(); } // RCAttr only - int EncodeValue_S([[maybe_unused]] types::BString &v) override { + int EncodeValue_S(types::BString &v [[maybe_unused]]) override { DEBUG_ASSERT(0); return -1; } // lookup (physical) only @@ -239,7 +239,7 @@ class TempTable : public JustATable { void SuspendDisplay(); void ResumeDisplay(); void LockPackForUse(unsigned attr, unsigned pack_no) override; - void UnlockPackFromUse([[maybe_unused]] unsigned attr, [[maybe_unused]] unsigned pack_no) override {} + void UnlockPackFromUse(unsigned attr [[maybe_unused]], unsigned pack_no [[maybe_unused]]) override {} int64_t NumOfObj() override { return no_obj; } uint32_t Getpackpower() const override { return p_power; } int64_t NumOfMaterialized() { return no_materialized; } @@ -265,10 +265,10 @@ class TempTable : public JustATable { bool IsNull(int64_t obj, int attr) override; // return true if the value of attr. is null - int64_t RoughMin([[maybe_unused]] int n_a, Filter *f = nullptr) { return common::MINUS_INF_64; } - int64_t RoughMax([[maybe_unused]] int n_a, Filter *f = nullptr) { return common::PLUS_INF_64; } + int64_t RoughMin(int n_a [[maybe_unused]], Filter *f [[maybe_unused]] = nullptr) { return common::MINUS_INF_64; } + int64_t RoughMax(int n_a [[maybe_unused]], Filter *f [[maybe_unused]] = nullptr) { return common::PLUS_INF_64; } - uint MaxStringSize(int n_a, Filter *f = nullptr) override { + uint MaxStringSize(int n_a, Filter *f [[maybe_unused]] = nullptr) override { if (n_a < 0) return GetFieldSize(-n_a - 1); return GetFieldSize(n_a); diff --git a/storage/tianmu/handler/tianmu_handler.cpp b/storage/tianmu/handler/tianmu_handler.cpp index 28d3da119..8cc368420 100644 --- a/storage/tianmu/handler/tianmu_handler.cpp +++ b/storage/tianmu/handler/tianmu_handler.cpp @@ -1529,19 +1529,22 @@ enum_alter_inplace_result ha_tianmu::check_if_supported_inplace_alter([[maybe_un if ((ha_alter_info->handler_flags & ~TIANMU_SUPPORTED_ALTER_ADD_DROP_ORDER) && (ha_alter_info->handler_flags != TIANMU_SUPPORTED_ALTER_COLUMN_NAME)) { - // support alter table column type + // support alter table: column type if (ha_alter_info->handler_flags & Alter_inplace_info::ALTER_STORED_COLUMN_TYPE) DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - // support alter table column exceeded length + // support alter table: column exceeded length if ((ha_alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH)) DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - // support alter table column default + // support alter table: column default if (ha_alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_DEFAULT) DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); - // support alter table NULL to NOT NULL or NOT NULL to NULL + // support alter table: NULL to NOT NULL or NOT NULL to NULL if (ha_alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_NULLABLE || ha_alter_info->handler_flags & Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE) DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + // support alter table: mix add/drop column、order column and other syntaxs to use + if (ha_alter_info->handler_flags & TIANMU_SUPPORTED_ALTER_ADD_DROP_ORDER) + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); DBUG_RETURN(HA_ALTER_ERROR); }