1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -32,12 +32,10 @@
#include "is_columnstore.h"
using namespace logging;
// Required declaration as it isn't in a MairaDB include
bool schema_table_store_record(THD* thd, TABLE* table);
ST_FIELD_INFO is_columnstore_columns_fields[] =
{
ST_FIELD_INFO is_columnstore_columns_fields[] = {
Show::Column("TABLE_SCHEMA", Show::Varchar(64), NOT_NULL),
Show::Column("TABLE_NAME", Show::Varchar(64), NOT_NULL),
Show::Column("COLUMN_NAME", Show::Varchar(64), NOT_NULL),
@ -54,159 +52,153 @@ ST_FIELD_INFO is_columnstore_columns_fields[] =
Show::Column("NUMERIC_SCALE", Show::ULong(0), NOT_NULL),
Show::Column("IS_AUTOINCREMENT", Show::STiny(0), NOT_NULL),
Show::Column("COMPRESSION_TYPE", Show::Varchar(64), NOT_NULL),
Show::CEnd()
};
Show::CEnd()};
static int is_columnstore_columns_fill(THD* thd, TABLE_LIST* tables, COND* cond)
{
CHARSET_INFO* cs = system_charset_info;
TABLE* table = tables->table;
InformationSchemaCond isCond;
CHARSET_INFO* cs = system_charset_info;
TABLE* table = tables->table;
InformationSchemaCond isCond;
boost::shared_ptr<execplan::CalpontSystemCatalog> systemCatalogPtr =
execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(execplan::CalpontSystemCatalog::idb_tid2sid(thd->thread_id));
boost::shared_ptr<execplan::CalpontSystemCatalog> systemCatalogPtr =
execplan::CalpontSystemCatalog::makeCalpontSystemCatalog(
execplan::CalpontSystemCatalog::idb_tid2sid(thd->thread_id));
const std::vector< std::pair<execplan::CalpontSystemCatalog::OID, execplan::CalpontSystemCatalog::TableName> > catalog_tables
= systemCatalogPtr->getTables();
const std::vector<
std::pair<execplan::CalpontSystemCatalog::OID, execplan::CalpontSystemCatalog::TableName> >
catalog_tables = systemCatalogPtr->getTables();
systemCatalogPtr->identity(execplan::CalpontSystemCatalog::FE);
systemCatalogPtr->identity(execplan::CalpontSystemCatalog::FE);
if (cond)
if (cond)
{
isCond.getCondItems(cond);
}
for (std::vector<std::pair<execplan::CalpontSystemCatalog::OID,
execplan::CalpontSystemCatalog::TableName> >::const_iterator it =
catalog_tables.begin();
it != catalog_tables.end(); ++it)
{
if (!isCond.match((*it).second.schema, (*it).second.table))
continue;
execplan::CalpontSystemCatalog::RIDList column_rid_list;
// Note a table may get dropped as you iterate over the list of tables.
// So simply ignore the dropped table.
try
{
isCond.getCondItems(cond);
column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true, lower_case_table_names);
}
catch (IDBExcept& ex)
{
if (ex.errorCode() == ERR_TABLE_NOT_IN_CATALOG)
{
continue;
}
else
{
return 1;
}
}
for (std::vector<std::pair<execplan::CalpontSystemCatalog::OID, execplan::CalpontSystemCatalog::TableName> >::const_iterator it = catalog_tables.begin();
it != catalog_tables.end(); ++it)
for (size_t col_num = 0; col_num < column_rid_list.size(); col_num++)
{
if (!isCond.match((*it).second.schema, (*it).second.table))
continue;
execplan::CalpontSystemCatalog::TableColName tcn =
systemCatalogPtr->colName(column_rid_list[col_num].objnum);
execplan::CalpontSystemCatalog::ColType ct = systemCatalogPtr->colType(column_rid_list[col_num].objnum);
execplan::CalpontSystemCatalog::RIDList column_rid_list;
table->field[0]->store(tcn.schema.c_str(), tcn.schema.length(), cs);
table->field[1]->store(tcn.table.c_str(), tcn.table.length(), cs);
table->field[2]->store(tcn.column.c_str(), tcn.column.length(), cs);
table->field[3]->store(column_rid_list[col_num].objnum);
// Note a table may get dropped as you iterate over the list of tables.
// So simply ignore the dropped table.
try
{
column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true, lower_case_table_names);
}
catch (IDBExcept& ex)
{
if (ex.errorCode() == ERR_TABLE_NOT_IN_CATALOG)
{
continue;
}
else
{
return 1;
}
}
if (ct.ddn.dictOID == std::numeric_limits<int32_t>::min())
{
table->field[4]->set_null();
}
else
{
table->field[4]->set_notnull();
table->field[4]->store(ct.ddn.dictOID);
}
for (size_t col_num = 0; col_num < column_rid_list.size(); col_num++)
{
execplan::CalpontSystemCatalog::TableColName tcn = systemCatalogPtr->colName(column_rid_list[col_num].objnum);
execplan::CalpontSystemCatalog::ColType ct = systemCatalogPtr->colType(column_rid_list[col_num].objnum);
if (ct.ddn.listOID == std::numeric_limits<int32_t>::min())
{
table->field[5]->set_null();
}
else
{
table->field[5]->set_notnull();
table->field[5]->store(ct.ddn.listOID);
}
table->field[0]->store(tcn.schema.c_str(), tcn.schema.length(), cs);
table->field[1]->store(tcn.table.c_str(), tcn.table.length(), cs);
table->field[2]->store(tcn.column.c_str(), tcn.column.length(), cs);
table->field[3]->store(column_rid_list[col_num].objnum);
if (ct.ddn.treeOID == std::numeric_limits<int32_t>::min())
{
table->field[6]->set_null();
}
else
{
table->field[6]->set_notnull();
table->field[6]->store(ct.ddn.treeOID);
}
if (ct.ddn.dictOID == std::numeric_limits<int32_t>::min())
{
table->field[4]->set_null();
}
else
{
table->field[4]->set_notnull();
table->field[4]->store(ct.ddn.dictOID);
}
std::string data_type = execplan::colDataTypeToString(ct.colDataType);
table->field[7]->store(data_type.c_str(), data_type.length(), cs);
table->field[8]->store(ct.colWidth);
table->field[9]->store(ct.colPosition);
if (ct.ddn.listOID == std::numeric_limits<int32_t>::min())
{
table->field[5]->set_null();
}
else
{
table->field[5]->set_notnull();
table->field[5]->store(ct.ddn.listOID);
}
if (ct.defaultValue.empty())
{
table->field[10]->set_null();
}
else
{
table->field[10]->set_notnull();
table->field[10]->store(ct.defaultValue.c_str(), ct.defaultValue.length(), cs);
}
if (ct.ddn.treeOID == std::numeric_limits<int32_t>::min())
{
table->field[6]->set_null();
}
else
{
table->field[6]->set_notnull();
table->field[6]->store(ct.ddn.treeOID);
}
table->field[11]->store(ct.autoincrement);
table->field[12]->store(ct.precision);
table->field[13]->store(ct.scale);
std::string data_type = execplan::colDataTypeToString(ct.colDataType);
table->field[7]->store(data_type.c_str(), data_type.length(), cs);
table->field[8]->store(ct.colWidth);
table->field[9]->store(ct.colPosition);
if (ct.constraintType != execplan::CalpontSystemCatalog::NOTNULL_CONSTRAINT)
{
table->field[14]->store(true);
}
else
{
table->field[14]->store(false);
}
if (ct.defaultValue.empty())
{
table->field[10]->set_null();
}
else
{
table->field[10]->set_notnull();
table->field[10]->store(ct.defaultValue.c_str(), ct.defaultValue.length(), cs);
}
std::string compression_type;
table->field[11]->store(ct.autoincrement);
table->field[12]->store(ct.precision);
table->field[13]->store(ct.scale);
switch (ct.compressionType)
{
case 0: compression_type = "None"; break;
if (ct.constraintType != execplan::CalpontSystemCatalog::NOTNULL_CONSTRAINT)
{
table->field[14]->store(true);
}
else
{
table->field[14]->store(false);
}
case 2: compression_type = "Snappy"; break;
std::string compression_type;
case 3: compression_type = "LZ4"; break;
switch (ct.compressionType)
{
case 0:
compression_type = "None";
break;
default: compression_type = "Unknown"; break;
}
case 2:
compression_type = "Snappy";
break;
table->field[15]->store(compression_type.c_str(), compression_type.length(), cs);
case 3:
compression_type = "LZ4";
break;
default:
compression_type = "Unknown";
break;
}
table->field[15]->store(compression_type.c_str(), compression_type.length(), cs);
if (schema_table_store_record(thd, table))
return 1;
}
if (schema_table_store_record(thd, table))
return 1;
}
}
return 0;
return 0;
}
int is_columnstore_columns_plugin_init(void* p)
{
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = is_columnstore_columns_fields;
schema->fill_table = is_columnstore_columns_fill;
return 0;
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*)p;
schema->fields_info = is_columnstore_columns_fields;
schema->fill_table = is_columnstore_columns_fill;
return 0;
}