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-1052 WIP Clean up the code.
This commit is contained in:
@ -1181,6 +1181,7 @@ int ha_calpont_group_by_handler::init_scan()
|
|||||||
|
|
||||||
// Save vtable_state to restore the after we inited.
|
// Save vtable_state to restore the after we inited.
|
||||||
THD::infinidb_state oldState = thd->infinidb_vtable.vtable_state;
|
THD::infinidb_state oldState = thd->infinidb_vtable.vtable_state;
|
||||||
|
// MCOL-1052 Should be removed after cleaning the code up.
|
||||||
thd->infinidb_vtable.vtable_state = THD::INFINIDB_CREATE_VTABLE;
|
thd->infinidb_vtable.vtable_state = THD::INFINIDB_CREATE_VTABLE;
|
||||||
int rc = ha_calpont_impl_group_by_init(this, table);
|
int rc = ha_calpont_impl_group_by_init(this, table);
|
||||||
thd->infinidb_vtable.vtable_state = oldState;
|
thd->infinidb_vtable.vtable_state = oldState;
|
||||||
|
@ -5167,9 +5167,6 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
|
|
||||||
bool localQuery = (thd->variables.infinidb_local_query > 0 ? true : false);
|
bool localQuery = (thd->variables.infinidb_local_query > 0 ? true : false);
|
||||||
|
|
||||||
|
|
||||||
//if (!ci->cal_conn_hndl || thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE)
|
|
||||||
if ( thd->infinidb_vtable.vtable_state == THD::INFINIDB_CREATE_VTABLE)
|
|
||||||
{
|
{
|
||||||
ci->stats.reset(); // reset query stats
|
ci->stats.reset(); // reset query stats
|
||||||
ci->stats.setStartTime();
|
ci->stats.setStartTime();
|
||||||
@ -5198,7 +5195,6 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
sm::sm_cleanup(ci->cal_conn_hndl);
|
sm::sm_cleanup(ci->cal_conn_hndl);
|
||||||
ci->cal_conn_hndl = 0;
|
ci->cal_conn_hndl = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sm::sm_init(sessionID, &ci->cal_conn_hndl, localQuery);
|
sm::sm_init(sessionID, &ci->cal_conn_hndl, localQuery);
|
||||||
idbassert(ci->cal_conn_hndl != 0);
|
idbassert(ci->cal_conn_hndl != 0);
|
||||||
@ -5218,8 +5214,6 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
|
|
||||||
hndl = ci->cal_conn_hndl;
|
hndl = ci->cal_conn_hndl;
|
||||||
|
|
||||||
if (thd->infinidb_vtable.vtable_state != THD::INFINIDB_SELECT_VTABLE)
|
|
||||||
{
|
|
||||||
if (!csep)
|
if (!csep)
|
||||||
csep.reset(new CalpontSelectExecutionPlan());
|
csep.reset(new CalpontSelectExecutionPlan());
|
||||||
|
|
||||||
@ -5245,6 +5239,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
|
|
||||||
csep->traceFlags(ci->traceFlags);
|
csep->traceFlags(ci->traceFlags);
|
||||||
|
|
||||||
|
// MCOL-1052 Send Items lists down to the optimizer.
|
||||||
gi.groupByTables = group_hand->table_list;
|
gi.groupByTables = group_hand->table_list;
|
||||||
gi.groupByFields = group_hand->select;
|
gi.groupByFields = group_hand->select;
|
||||||
gi.groupByWhere = group_hand->where;
|
gi.groupByWhere = group_hand->where;
|
||||||
@ -5301,10 +5296,8 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
IDEBUG( cerr << *csep << endl );
|
IDEBUG( cerr << *csep << endl );
|
||||||
IDEBUG( cout << "-------------- EXECUTION PLAN END --------------\n" << endl );
|
IDEBUG( cout << "-------------- EXECUTION PLAN END --------------\n" << endl );
|
||||||
}
|
}
|
||||||
}
|
}// end of execution plan generation
|
||||||
// end of execution plan generation
|
|
||||||
|
|
||||||
if (thd->infinidb_vtable.vtable_state != THD::INFINIDB_SELECT_VTABLE)
|
|
||||||
{
|
{
|
||||||
ByteStream msg;
|
ByteStream msg;
|
||||||
ByteStream emsgBs;
|
ByteStream emsgBs;
|
||||||
@ -5536,7 +5529,6 @@ internal_error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
//return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@brief ha_calpont_impl_group_by_next - Return result set for MariaDB group_by
|
/*@brief ha_calpont_impl_group_by_next - Return result set for MariaDB group_by
|
||||||
@ -5573,10 +5565,6 @@ int ha_calpont_impl_group_by_next(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_ERROR)
|
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_ERROR)
|
||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
|
|
||||||
// @bug 3005
|
|
||||||
//if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_SELECT_VTABLE)
|
|
||||||
// return HA_ERR_END_OF_FILE;
|
|
||||||
|
|
||||||
if (((thd->lex)->sql_command == SQLCOM_UPDATE) || ((thd->lex)->sql_command == SQLCOM_DELETE) ||
|
if (((thd->lex)->sql_command == SQLCOM_UPDATE) || ((thd->lex)->sql_command == SQLCOM_DELETE) ||
|
||||||
((thd->lex)->sql_command == SQLCOM_DELETE_MULTI) || ((thd->lex)->sql_command == SQLCOM_UPDATE_MULTI))
|
((thd->lex)->sql_command == SQLCOM_DELETE_MULTI) || ((thd->lex)->sql_command == SQLCOM_UPDATE_MULTI))
|
||||||
return HA_ERR_END_OF_FILE;
|
return HA_ERR_END_OF_FILE;
|
||||||
@ -5669,7 +5657,6 @@ int ha_calpont_impl_group_by_next(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
}
|
}
|
||||||
|
|
||||||
setError(thd, ER_INTERNAL_ERROR, emsg);
|
setError(thd, ER_INTERNAL_ERROR, emsg);
|
||||||
//setError(thd, ER_INTERNAL_ERROR, "testing");
|
|
||||||
ci->stats.fErrorNo = rc;
|
ci->stats.fErrorNo = rc;
|
||||||
CalpontSystemCatalog::removeCalpontSystemCatalog(tid2sid(thd->thread_id));
|
CalpontSystemCatalog::removeCalpontSystemCatalog(tid2sid(thd->thread_id));
|
||||||
rc = ER_INTERNAL_ERROR;
|
rc = ER_INTERNAL_ERROR;
|
||||||
@ -5707,18 +5694,6 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_REDO_PHASE1)
|
|
||||||
// return rc;
|
|
||||||
/*
|
|
||||||
if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE )
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
if (((thd->lex)->sql_command == SQLCOM_UPDATE) ||
|
|
||||||
((thd->lex)->sql_command == SQLCOM_DELETE) ||
|
|
||||||
((thd->lex)->sql_command == SQLCOM_DELETE_MULTI) ||
|
|
||||||
((thd->lex)->sql_command == SQLCOM_UPDATE_MULTI))
|
|
||||||
return rc;
|
|
||||||
*/
|
|
||||||
if (((thd->lex)->sql_command == SQLCOM_INSERT) ||
|
if (((thd->lex)->sql_command == SQLCOM_INSERT) ||
|
||||||
((thd->lex)->sql_command == SQLCOM_INSERT_SELECT) )
|
((thd->lex)->sql_command == SQLCOM_INSERT_SELECT) )
|
||||||
{
|
{
|
||||||
@ -5788,9 +5763,6 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
|||||||
cal_table_info ti = ci->tableMap[table];
|
cal_table_info ti = ci->tableMap[table];
|
||||||
sm::cpsm_conhdl_t* hndl;
|
sm::cpsm_conhdl_t* hndl;
|
||||||
|
|
||||||
//if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE)
|
|
||||||
// hndl = ti.conn_hndl;
|
|
||||||
//else
|
|
||||||
hndl = ci->cal_conn_hndl;
|
hndl = ci->cal_conn_hndl;
|
||||||
|
|
||||||
if (ti.tpl_ctx)
|
if (ti.tpl_ctx)
|
||||||
@ -5813,10 +5785,6 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
|||||||
{
|
{
|
||||||
sm::tpl_close(ti.tpl_ctx, &hndl, ci->stats);
|
sm::tpl_close(ti.tpl_ctx, &hndl, ci->stats);
|
||||||
|
|
||||||
// set conn hndl back. could be changed in tpl_close
|
|
||||||
//if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE)
|
|
||||||
// ti.conn_hndl = hndl;
|
|
||||||
//else
|
|
||||||
ci->cal_conn_hndl = hndl;
|
ci->cal_conn_hndl = hndl;
|
||||||
|
|
||||||
ti.tpl_ctx = 0;
|
ti.tpl_ctx = 0;
|
||||||
@ -5848,11 +5816,6 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
|||||||
|
|
||||||
ti.tpl_ctx = 0;
|
ti.tpl_ctx = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_SELECT_VTABLE &&
|
|
||||||
thd->infinidb_vtable.has_order_by)
|
|
||||||
thd->infinidb_vtable.vtable_state = THD::INFINIDB_ORDER_BY;
|
|
||||||
*/
|
|
||||||
ci->tableMap[table] = ti;
|
ci->tableMap[table] = ti;
|
||||||
|
|
||||||
// push warnings from CREATE phase
|
// push warnings from CREATE phase
|
||||||
@ -5866,4 +5829,3 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// vim:sw=4 ts=4:
|
// vim:sw=4 ts=4:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user