You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
Parsing support for ENUM with columnstore engine
This commit is contained in:
@@ -117,6 +117,7 @@ CREATE {return CREATE;}
|
||||
CURRENT_USER {return CURRENT_USER;}
|
||||
DATE {ddlget_lval(yyscanner)->str = scanner_copy("date", yyscanner); return DATE;}
|
||||
DATETIME {return DATETIME;}
|
||||
ENUM {return ENUM;}
|
||||
TIME {ddlget_lval(yyscanner)->str = scanner_copy("time", yyscanner); return TIME;}
|
||||
TIMESTAMP {return TIMESTAMP;}
|
||||
DECIMAL {return DECIMAL;}
|
||||
|
@@ -122,6 +122,7 @@ void fix_column_length_and_charset(SchemaObject* elem, const CHARSET_INFO* def_c
|
||||
ddlpackage::AlterTableActionList *ataList;
|
||||
ddlpackage::DDL_CONSTRAINT_ATTRIBUTES cattr;
|
||||
std::pair<std::string, std::string> *tableOption;
|
||||
std::vector<std::string> *strList;
|
||||
const char *columnOption;
|
||||
ddlpackage::ColumnConstraintDef *columnConstraintDef;
|
||||
ddlpackage::ColumnNameList *columnNameList;
|
||||
@@ -154,7 +155,7 @@ void fix_column_length_and_charset(SchemaObject* elem, const CHARSET_INFO* def_c
|
||||
CHARACTER CHECK CLOB COLUMN
|
||||
BOOL BOOLEAN
|
||||
COLUMNS COMMENT CONSTRAINT CONSTRAINTS CREATE CURRENT_USER DATETIME DEC
|
||||
DECIMAL DEFAULT DEFERRABLE DEFERRED IDB_DELETE DROP ENGINE
|
||||
DECIMAL DEFAULT DEFERRABLE DEFERRED IDB_DELETE DROP ENGINE ENUM
|
||||
FOREIGN FULL IMMEDIATE INDEX INITIALLY IDB_INT INTEGER KEY LONGBLOB LONGTEXT
|
||||
MATCH MAX_ROWS MEDIUMBLOB MEDIUMTEXT MEDIUMINT
|
||||
MIN_ROWS MODIFY NO NOT NULL_TOK NUMBER NUMERIC ON PARTIAL PRECISION PRIMARY
|
||||
@@ -207,6 +208,7 @@ ZEROFILL
|
||||
%type <refActionCode> opt_delete_rule
|
||||
%type <columnType> exact_numeric_type
|
||||
%type <str> literal
|
||||
%type <strList> nonemptyLiteralList
|
||||
%type <matchType> opt_match_type
|
||||
%type <matchType> match_type
|
||||
%type <ata> alter_table_comment
|
||||
@@ -261,7 +263,7 @@ ZEROFILL
|
||||
// for objects allocated during parse:.
|
||||
%destructor { delete $$; } qualified_name ident table_element column_def exact_numeric_type
|
||||
%destructor { delete $$; } table_options opt_table_options table_name
|
||||
%destructor { delete $$; } column_name_list data_type column_constraint
|
||||
%destructor { delete $$; } column_name_list data_type column_constraint nonemptyLiteralList
|
||||
%destructor { delete $$; } column_constraint_def column_qualifier_list
|
||||
%destructor { delete $$; } opt_referential_triggered_action referential_triggered_action
|
||||
%destructor { delete $$; } table_option character_string_type binary_string_type blob_type
|
||||
@@ -845,6 +847,7 @@ data_type:
|
||||
$1->fCollate = $3;
|
||||
$$ = $1;
|
||||
}
|
||||
| ENUM '(' nonemptyLiteralList ')' { $$ = new ColumnType(DDL_ENUM); $$->fEnumValues = std::move(*$3); }
|
||||
| IDB_BLOB
|
||||
{
|
||||
$$ = new ColumnType(DDL_BLOB);
|
||||
@@ -855,7 +858,11 @@ data_type:
|
||||
$$ = new ColumnType(DDL_CLOB);
|
||||
$$->fLength = DDLDatatypeLength[DDL_CLOB];
|
||||
}
|
||||
;
|
||||
|
||||
nonemptyLiteralList:
|
||||
literal { $$ = new std::vector<std::string>(); $$->push_back($1); }
|
||||
| nonemptyLiteralList ',' literal { $$ = $1; $1 = nullptr; $$->push_back($3); }
|
||||
;
|
||||
|
||||
column_qualifier_list:
|
||||
|
@@ -186,6 +186,7 @@ enum DDL_DATATYPES
|
||||
DDL_MEDINT,
|
||||
DDL_INT,
|
||||
DDL_FLOAT,
|
||||
DDL_ENUM,
|
||||
DDL_DATE,
|
||||
DDL_BIGINT,
|
||||
DDL_DOUBLE,
|
||||
@@ -941,6 +942,9 @@ struct ColumnType
|
||||
/** @brief SQL "with timezone" specifier */
|
||||
bool fWithTimezone;
|
||||
|
||||
/** @brief enum values for the SQL with enum type */
|
||||
std::vector<std::string> fEnumValues;
|
||||
|
||||
int fCompressiontype;
|
||||
|
||||
std::string fAutoincrement;
|
||||
|
@@ -1125,6 +1125,7 @@ int ColumnType::unserialize(ByteStream& bytestream)
|
||||
std::string autoincrement;
|
||||
messageqcpp::ByteStream::octbyte nextVal;
|
||||
messageqcpp::ByteStream::quadbyte charsetNum;
|
||||
messageqcpp::ByteStream::octbyte enumValuesNum = fEnumValues.size();
|
||||
|
||||
// read column types
|
||||
bytestream >> ftype;
|
||||
@@ -1136,6 +1137,14 @@ int ColumnType::unserialize(ByteStream& bytestream)
|
||||
bytestream >> autoincrement;
|
||||
bytestream >> nextVal;
|
||||
bytestream >> charsetNum;
|
||||
bytestream >> enumValuesNum;
|
||||
|
||||
for (size_t i = 0; i<fEnumValues.size(); ++i) {
|
||||
std::string value;
|
||||
|
||||
bytestream >> value;
|
||||
fEnumValues.push_back(value);
|
||||
}
|
||||
|
||||
fType = ftype;
|
||||
fLength = length;
|
||||
@@ -1166,6 +1175,7 @@ int ColumnType::serialize(ByteStream& bytestream)
|
||||
std::string autoincrement = fAutoincrement;
|
||||
messageqcpp::ByteStream::octbyte nextVal = fNextvalue;
|
||||
messageqcpp::ByteStream::quadbyte charsetNum = fCharsetNum;
|
||||
messageqcpp::ByteStream::octbyte enumValuesNum = fEnumValues.size();
|
||||
|
||||
// write column types
|
||||
bytestream << ftype;
|
||||
@@ -1177,6 +1187,11 @@ int ColumnType::serialize(ByteStream& bytestream)
|
||||
bytestream << autoincrement;
|
||||
bytestream << nextVal;
|
||||
bytestream << charsetNum;
|
||||
bytestream << enumValuesNum;
|
||||
|
||||
for (size_t i = 0; i<fEnumValues.size(); ++i) {
|
||||
bytestream << fEnumValues[i];
|
||||
}
|
||||
|
||||
// cout << "BS length = " << bytestream.length() << endl;
|
||||
|
||||
|
@@ -840,6 +840,10 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta
|
||||
}
|
||||
}
|
||||
|
||||
if (createTable->fTableDef->fColumns[i]->fType->fType == ddlpackage::DDL_ENUM) {
|
||||
// TO DO
|
||||
}
|
||||
|
||||
// check varbinary data type
|
||||
if ((createTable->fTableDef->fColumns[i]->fType->fType == ddlpackage::DDL_VARBINARY) &&
|
||||
!isVarbinaryAllowed)
|
||||
|
Reference in New Issue
Block a user