You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-2178 Introduced a dummy replacement for a infinidb_table.
Used Item attribute getters introduced by 10.4 Make changes to support Item::CONST_ITEM introduced by 10.4 as a replacement for INT_,REAL_,STRING_ ITEM. Replaced QT_INFINIDB_DERIVED and similar flags with correponded flags for Item->print(). Replaced or commented out infinidb_ variable names with columnstore_ where applicable.
This commit is contained in:
committed by
Gagan Goel
parent
6fd5b2f22d
commit
cd72326c4d
@ -23,6 +23,8 @@
|
||||
#include "ha_calpont_impl.h"
|
||||
#include "ha_mcs_pushdown.h"
|
||||
|
||||
MIGR::INFINIDB_VTABLE MIGR::infinidb_vtable;
|
||||
|
||||
static handler* calpont_create_handler(handlerton* hton,
|
||||
TABLE_SHARE* table,
|
||||
MEM_ROOT* mem_root);
|
||||
@ -116,6 +118,7 @@ static int columnstore_init_func(void* p)
|
||||
struct tm tm;
|
||||
time_t t;
|
||||
|
||||
|
||||
time(&t);
|
||||
localtime_r(&t, &tm);
|
||||
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d ",
|
||||
|
@ -2117,8 +2117,8 @@ int ha_calpont_impl_commit_ (handlerton* hton, THD* thd, bool all, cal_connectio
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (MIGR::infinidb_vtable.vtable_state == THD::INFINIDB_ALTER_VTABLE ||
|
||||
MIGR::infinidb_vtable.vtable_state == THD::INFINIDB_SELECT_VTABLE )
|
||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ALTER_VTABLE ||
|
||||
MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_SELECT_VTABLE )
|
||||
return rc;
|
||||
|
||||
if (thd->slave_thread && !ci.replicationEnabled)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -752,8 +752,8 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
||||
|
||||
//float float_val = *(float*)(&value);
|
||||
//f2->store(float_val);
|
||||
if (f2->decimals() < (uint32_t)row.getScale(s))
|
||||
// WIP MCOL-2178
|
||||
// WIP MCOL-2178
|
||||
//if (f2->decimals() < (uint32_t)row.getScale(s))
|
||||
//f2->dec = (uint32_t)row.getScale(s);
|
||||
|
||||
f2->store(dl);
|
||||
@ -1320,7 +1320,6 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
|
||||
// @bug 1127. Re-construct update stmt using lex instead of using the original query.
|
||||
// string dmlStmt="";
|
||||
string dmlStmt = string(idb_mysql_query_str(thd));
|
||||
string schemaName;
|
||||
string tableName("");
|
||||
@ -1338,28 +1337,16 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
{
|
||||
ColumnAssignment* columnAssignmentPtr;
|
||||
Item_field* item;
|
||||
// TABLE_LIST* table_ptr = thd->lex->thd->lex->first_select_lex()->get_table_list();
|
||||
List_iterator_fast<Item> field_it(thd->lex->thd->lex->first_select_lex()->item_list);
|
||||
List_iterator_fast<Item> field_it(thd->lex->first_select_lex()->item_list);
|
||||
List_iterator_fast<Item> value_it(thd->lex->value_list);
|
||||
// dmlStmt += "update ";
|
||||
updateCP->queryType(CalpontSelectExecutionPlan::UPDATE);
|
||||
ci->stats.fQueryType = updateCP->queryType();
|
||||
uint32_t cnt = 0;
|
||||
tr1::unordered_set<string> timeStampColumnNames;
|
||||
|
||||
// for (; table_ptr; table_ptr= table_ptr->next_local)
|
||||
// {
|
||||
// dmlStmt += string(table_ptr->table_name);
|
||||
// if (table_ptr->next_local)
|
||||
// dmlStmt += ", ";
|
||||
// }
|
||||
|
||||
// dmlStmt += " set ";
|
||||
|
||||
while ((item = (Item_field*) field_it++))
|
||||
{
|
||||
cnt++;
|
||||
// dmlStmt += string(item->name) + "=";
|
||||
|
||||
string tmpTableName = bestTableName(item);
|
||||
|
||||
@ -1411,21 +1398,41 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
columnAssignmentPtr->fFuncScale = 0;
|
||||
Item* value = value_it++;
|
||||
|
||||
if (value->type() == Item::STRING_ITEM)
|
||||
if (value->type() == Item::CONST_ITEM)
|
||||
{
|
||||
//@Bug 2587 use val_str to replace value->name to get rid of 255 limit
|
||||
String val, *str;
|
||||
str = value->val_str(&val);
|
||||
columnAssignmentPtr->fScalarExpression.assign(str->ptr(), str->length());
|
||||
columnAssignmentPtr->fFromCol = false;
|
||||
if (value->cmp_type() == STRING_RESULT)
|
||||
{
|
||||
//@Bug 2587 use val_str to replace value->name to get rid of 255 limit
|
||||
String val, *str;
|
||||
str = value->val_str(&val);
|
||||
columnAssignmentPtr->fScalarExpression.assign(str->ptr(), str->length());
|
||||
columnAssignmentPtr->fFromCol = false;
|
||||
}
|
||||
else if (value->cmp_type() == INT_RESULT)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
if (value->unsigned_flag)
|
||||
{
|
||||
oss << value->val_uint();
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << value->val_int();
|
||||
}
|
||||
|
||||
columnAssignmentPtr->fScalarExpression = oss.str();
|
||||
columnAssignmentPtr->fFromCol = false;
|
||||
}
|
||||
}
|
||||
else if ( value->type() == Item::VARBIN_ITEM )
|
||||
// WIP MCOL-2178
|
||||
/*else if ( value->type() == Item::VARBIN_ITEM )
|
||||
{
|
||||
String val, *str;
|
||||
str = value->val_str(&val);
|
||||
columnAssignmentPtr->fScalarExpression.assign(str->ptr(), str->length());
|
||||
columnAssignmentPtr->fFromCol = false;
|
||||
}
|
||||
}*/
|
||||
else if ( value->type() == Item::FUNC_ITEM )
|
||||
{
|
||||
//Bug 2092 handle negative values
|
||||
@ -1491,23 +1498,6 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( value->type() == Item::INT_ITEM )
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
if (value->unsigned_flag)
|
||||
{
|
||||
oss << value->val_uint();
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << value->val_int();
|
||||
}
|
||||
|
||||
// dmlStmt += oss.str();
|
||||
columnAssignmentPtr->fScalarExpression = oss.str();
|
||||
columnAssignmentPtr->fFromCol = false;
|
||||
}
|
||||
else if ( value->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
isFromCol = true;
|
||||
@ -1590,8 +1580,6 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
|
||||
colAssignmentListPtr->push_back ( columnAssignmentPtr );
|
||||
// if (cnt < thd->lex->thd->lex->first_select_lex()->item_list.elements)
|
||||
// dmlStmt += ", ";
|
||||
}
|
||||
|
||||
// Support for on update current_timestamp() for timestamp fields
|
||||
@ -1620,7 +1608,6 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
else
|
||||
{
|
||||
// dmlStmt = string(idb_mysql_query_str(thd));
|
||||
updateCP->queryType(CalpontSelectExecutionPlan::DELETE);
|
||||
ci->stats.fQueryType = updateCP->queryType();
|
||||
}
|
||||
@ -1639,7 +1626,7 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
else
|
||||
{
|
||||
first_table = (TABLE_LIST*) thd->lex->thd->lex->first_select_lex()->table_list.first;
|
||||
first_table = (TABLE_LIST*) thd->lex->first_select_lex()->table_list.first;
|
||||
aTableName.schema = first_table->table->s->db.str;
|
||||
aTableName.table = first_table->table->s->table_name.str;
|
||||
}
|
||||
@ -1690,9 +1677,9 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
else if ((thd->lex)->sql_command == SQLCOM_DELETE_MULTI) //@Bug 6121 error out on multi tables delete.
|
||||
{
|
||||
if ( (thd->lex->thd->lex->first_select_lex()->join) != 0)
|
||||
if ( (thd->lex->first_select_lex()->join) != 0)
|
||||
{
|
||||
multi_delete* deleteTable = (multi_delete*)((thd->lex->thd->lex->first_select_lex()->join)->result);
|
||||
multi_delete* deleteTable = (multi_delete*)((thd->lex->first_select_lex()->join)->result);
|
||||
first_table = (TABLE_LIST*) deleteTable->get_tables();
|
||||
|
||||
if (deleteTable->get_num_of_tables() == 1)
|
||||
@ -1715,7 +1702,7 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
else
|
||||
{
|
||||
first_table = (TABLE_LIST*) thd->lex->thd->lex->first_select_lex()->table_list.first;
|
||||
first_table = (TABLE_LIST*) thd->lex->first_select_lex()->table_list.first;
|
||||
schemaName = first_table->table->s->db.str;
|
||||
tableName = first_table->table->s->table_name.str;
|
||||
aliasName = first_table->alias.str;
|
||||
@ -1726,7 +1713,7 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
}
|
||||
else
|
||||
{
|
||||
first_table = (TABLE_LIST*) thd->lex->thd->lex->first_select_lex()->table_list.first;
|
||||
first_table = (TABLE_LIST*) thd->lex->first_select_lex()->table_list.first;
|
||||
schemaName = first_table->table->s->db.str;
|
||||
tableName = first_table->table->s->table_name.str;
|
||||
aliasName = first_table->alias.str;
|
||||
@ -1759,8 +1746,8 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
|
||||
if (( (thd->lex)->sql_command == SQLCOM_UPDATE ) || ( (thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) )
|
||||
{
|
||||
items = (thd->lex->thd->lex->first_select_lex()->item_list);
|
||||
thd->lex->thd->lex->first_select_lex()->item_list = thd->lex->value_list;
|
||||
items = (thd->lex->first_select_lex()->item_list);
|
||||
thd->lex->first_select_lex()->item_list = thd->lex->value_list;
|
||||
}
|
||||
|
||||
select_lex = *lex->first_select_lex();
|
||||
@ -1824,7 +1811,7 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
// @bug 4457. MySQL inconsistence! for some queries, some structures are only available
|
||||
// in the derived_tables_processing phase. So by pass the phase for DML only when the
|
||||
// execution plan can not be successfully generated. recover lex before returning;
|
||||
thd->lex->thd->lex->first_select_lex()->item_list = items;
|
||||
thd->lex->first_select_lex()->item_list = items;
|
||||
MIGR::infinidb_vtable.vtable_state = origState;
|
||||
return 0;
|
||||
}
|
||||
@ -1975,7 +1962,7 @@ uint32_t doUpdateDelete(THD* thd)
|
||||
|
||||
//cout<< "Plan is " << endl << *updateCP << endl;
|
||||
if (( (thd->lex)->sql_command == SQLCOM_UPDATE ) || ( (thd->lex)->sql_command == SQLCOM_UPDATE_MULTI ) )
|
||||
thd->lex->thd->lex->first_select_lex()->item_list = items;
|
||||
thd->lex->first_select_lex()->item_list = items;
|
||||
}
|
||||
|
||||
//cout<< "Plan is " << endl << *updateCP << endl;
|
||||
@ -3253,7 +3240,7 @@ int ha_calpont_impl_delete_table(const char* name)
|
||||
}
|
||||
else
|
||||
{
|
||||
TABLE_LIST* first_table = (TABLE_LIST*) thd->lex->thd->lex->first_select_lex()->table_list.first;
|
||||
TABLE_LIST* first_table = (TABLE_LIST*) thd->lex->first_select_lex()->table_list.first;
|
||||
dbName = const_cast<char*>(first_table->db.str);
|
||||
}
|
||||
|
||||
@ -4280,7 +4267,6 @@ int ha_calpont_impl_close_connection (handlerton* hton, THD* thd)
|
||||
int ha_calpont_impl_rename_table(const char* from, const char* to)
|
||||
{
|
||||
IDEBUG( cout << "ha_calpont_impl_rename_table: " << from << " => " << to << endl );
|
||||
THD* thd = current_thd;
|
||||
|
||||
if (get_fe_conn_info_ptr() == NULL)
|
||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||
|
@ -129,11 +129,11 @@ create_calpont_group_by_handler(THD* thd, Query* query)
|
||||
SELECT_LEX *select_lex = query->from->select_lex;
|
||||
|
||||
// Create a handler if query is valid. See comments for details.
|
||||
if ( MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_DISABLE_VTABLE
|
||||
if //( MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_DISABLE_VTABLE
|
||||
// WIP MCOL-2178
|
||||
//&& ( MIGR::infinidb_vtable_mode == 0
|
||||
// || MIGR::infinidb_vtable_mode == 2 )
|
||||
&& ( query->group_by || select_lex->with_sum_func ) )
|
||||
( query->group_by || select_lex->with_sum_func ) //)
|
||||
{
|
||||
bool unsupported_feature = false;
|
||||
// revisit SELECT_LEX for all units
|
||||
@ -214,12 +214,12 @@ create_columnstore_derived_handler(THD* thd, TABLE_LIST *derived)
|
||||
|
||||
SELECT_LEX_UNIT *unit= derived->derived;
|
||||
|
||||
if ( MIGR::infinidb_vtable.vtable_state != MIGR::INFINIDB_DISABLE_VTABLE )
|
||||
/* //if ( MIGR::infinidb_vtable.vtable_state != MIGR::INFINIDB_DISABLE_VTABLE )
|
||||
// WIP MCOL-2178
|
||||
// && MIGR::infinidb_vtable_mode != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
|
||||
{
|
||||
@ -472,13 +472,15 @@ create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex)
|
||||
ha_columnstore_select_handler* handler = NULL;
|
||||
handlerton *ht= 0;
|
||||
|
||||
/*
|
||||
// Return if vtable enabled.
|
||||
if ( MIGR::infinidb_vtable.vtable_state != MIGR::INFINIDB_DISABLE_VTABLE )
|
||||
//if ( MIGR::infinidb_vtable.vtable_state != MIGR::INFINIDB_DISABLE_VTABLE )
|
||||
// WIP MCOL-2178
|
||||
// && MIGR::infinidb_vtable_mode != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (SELECT_LEX* sl = select_lex;sl; sl= sl->next_select())
|
||||
{
|
||||
if (!(sl->join))
|
||||
|
@ -109,7 +109,9 @@ void View::transform()
|
||||
// for nested view, the view name is vout.vin... format
|
||||
CalpontSystemCatalog::TableAliasName tn = make_aliasview(table_ptr->db.str, table_ptr->table_name.str, table_ptr->alias.str, viewName);
|
||||
gwi.viewName = make_aliastable(table_ptr->db.str, table_ptr->table_name.str, viewName);
|
||||
View* view = new View(table_ptr->view->select_lex, &gwi);
|
||||
// WIP MCOL-2178 CS could mess with the SELECT_LEX unit so better
|
||||
// use a copy.
|
||||
View* view = new View(*table_ptr->view->first_select_lex(), &gwi);
|
||||
view->viewName(gwi.viewName);
|
||||
gwi.viewList.push_back(view);
|
||||
view->transform();
|
||||
|
@ -154,7 +154,8 @@ class MIGR
|
||||
INFINIDB_VTABLE() : cal_conn_info(NULL) {init();}
|
||||
void init()
|
||||
{
|
||||
vtable_state = INFINIDB_INIT_CONNECT;
|
||||
//vtable_state = INFINIDB_INIT_CONNECT;
|
||||
vtable_state = INFINIDB_DISABLE_VTABLE;
|
||||
autoswitch = false;
|
||||
has_order_by = false;
|
||||
duplicate_field_name = false;
|
||||
|
@ -47,21 +47,21 @@ group_concat_max_len=512
|
||||
sql_mode="ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
|
||||
|
||||
# Enable compression by default on create, set to 0 to turn off
|
||||
infinidb_compression_type=2
|
||||
#columnstore_compression_type=2
|
||||
|
||||
# Default for string table threshhold
|
||||
infinidb_stringtable_threshold=20
|
||||
#columnstore_stringtable_threshold=20
|
||||
|
||||
# infinidb local query flag
|
||||
infinidb_local_query=0
|
||||
#columnstore_local_query=0
|
||||
|
||||
infinidb_diskjoin_smallsidelimit=0
|
||||
infinidb_diskjoin_largesidelimit=0
|
||||
infinidb_diskjoin_bucketsize=100
|
||||
infinidb_um_mem_limit=0
|
||||
#columnstore_diskjoin_smallsidelimit=0
|
||||
#columnstore_diskjoin_largesidelimit=0
|
||||
#columnstore_diskjoin_bucketsize=100
|
||||
#columnstore_um_mem_limit=0
|
||||
|
||||
infinidb_use_import_for_batchinsert=1
|
||||
infinidb_import_for_batchinsert_delimiter=7
|
||||
#columnstore_use_import_for_batchinsert=1
|
||||
#columnstore_import_for_batchinsert_delimiter=7
|
||||
|
||||
basedir = /usr/local/mariadb/columnstore/mysql/
|
||||
character-sets-dir = /usr/local/mariadb/columnstore/mysql/share/charsets/
|
||||
|
Reference in New Issue
Block a user