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 Functions with constant args are processed by CS now.
Fix crash in ha_calpont_impl_close_connection() Fix leak in ci.tableMap. Removed extra returns in pushdown_init to avoid crashes. create_select_handler now detects INSERT..SELECT. buildConstColFromFilter now uses any kind of filter to supply relevant columns. Remove strings used by vtable redo phase. Make FromSubQuery aware of Pushdown handlers. Changed debug_walk to work around changed Item framework. Temporary disabled derived handler and unsupported features checks.
This commit is contained in:
committed by
Gagan Goel
parent
b4d1cbc529
commit
3074b6c4b3
@ -145,8 +145,8 @@ static int columnstore_init_func(void* p)
|
|||||||
mcs_hton->commit = calpont_commit;
|
mcs_hton->commit = calpont_commit;
|
||||||
mcs_hton->rollback = calpont_rollback;
|
mcs_hton->rollback = calpont_rollback;
|
||||||
mcs_hton->close_connection = calpont_close_connection;
|
mcs_hton->close_connection = calpont_close_connection;
|
||||||
mcs_hton->create_group_by = create_calpont_group_by_handler;
|
//mcs_hton->create_group_by = create_calpont_group_by_handler;
|
||||||
mcs_hton->create_derived = create_columnstore_derived_handler;
|
//mcs_hton->create_derived = create_columnstore_derived_handler;
|
||||||
mcs_hton->create_select = create_columnstore_select_handler;
|
mcs_hton->create_select = create_columnstore_select_handler;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ static int infinidb_init_func(void* p)
|
|||||||
calpont_hton->rollback = calpont_rollback;
|
calpont_hton->rollback = calpont_rollback;
|
||||||
calpont_hton->close_connection = calpont_close_connection;
|
calpont_hton->close_connection = calpont_close_connection;
|
||||||
calpont_hton->create_group_by = create_calpont_group_by_handler;
|
calpont_hton->create_group_by = create_calpont_group_by_handler;
|
||||||
calpont_hton->create_derived = create_columnstore_derived_handler;
|
//calpont_hton->create_derived = create_columnstore_derived_handler;
|
||||||
calpont_hton->create_select = create_columnstore_select_handler;
|
calpont_hton->create_select = create_columnstore_select_handler;
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1515,7 +1515,6 @@ uint32_t doUpdateDelete(THD* thd)
|
|||||||
setError(thd, ER_INTERNAL_ERROR,
|
setError(thd, ER_INTERNAL_ERROR,
|
||||||
logging::IDBErrorInfo::instance()->errorMsg(ERR_WF_UPDATE));
|
logging::IDBErrorInfo::instance()->errorMsg(ERR_WF_UPDATE));
|
||||||
return ER_CHECK_NOT_IMPLEMENTED;
|
return ER_CHECK_NOT_IMPLEMENTED;
|
||||||
//return 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1594,7 +1593,6 @@ uint32_t doUpdateDelete(THD* thd)
|
|||||||
}
|
}
|
||||||
catch (IDBExcept& ie)
|
catch (IDBExcept& ie)
|
||||||
{
|
{
|
||||||
// setError(thd, ER_UNKNOWN_TABLE, ie.what());
|
|
||||||
setError(thd, ER_INTERNAL_ERROR, ie.what());
|
setError(thd, ER_INTERNAL_ERROR, ie.what());
|
||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
@ -1710,7 +1708,7 @@ uint32_t doUpdateDelete(THD* thd)
|
|||||||
|
|
||||||
//@Bug 2808 Error out on order by or limit clause
|
//@Bug 2808 Error out on order by or limit clause
|
||||||
//@bug5096. support dml limit.
|
//@bug5096. support dml limit.
|
||||||
if (/*( thd->lex->first_select_lex()->explicit_limit ) || */( thd->lex->first_select_lex()->order_list.elements != 0 ) )
|
if (( thd->lex->first_select_lex()->order_list.elements != 0 ) )
|
||||||
{
|
{
|
||||||
string emsg("DML Statement with order by clause is not currently supported.");
|
string emsg("DML Statement with order by clause is not currently supported.");
|
||||||
thd->raise_error_printf(ER_INTERNAL_ERROR, emsg.c_str());
|
thd->raise_error_printf(ER_INTERNAL_ERROR, emsg.c_str());
|
||||||
@ -2348,20 +2346,10 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
thd->lex->sql_command == SQLCOM_LOAD))
|
thd->lex->sql_command == SQLCOM_LOAD))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// @bug 3005. if the table is not $vtable, then this could be a UDF defined on the connector.
|
|
||||||
// watch this for other complications
|
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_SELECT_VTABLE &&
|
|
||||||
string(table->s->table_name.str).find("$vtable") != 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// return error is error status is already set
|
// return error is error status is already set
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR)
|
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR)
|
||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
|
|
||||||
// by pass the extra union trips. return 0
|
|
||||||
if (MIGR::infinidb_vtable.isUnion && MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_CREATE_VTABLE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// @bug 2232. Basic SP support. Error out non support sp cases.
|
// @bug 2232. Basic SP support. Error out non support sp cases.
|
||||||
// @bug 3939. Only error out for sp with select. Let pass for alter table in sp.
|
// @bug 3939. Only error out for sp with select. Let pass for alter table in sp.
|
||||||
if (MIGR::infinidb_vtable.call_sp && (thd->lex)->sql_command != SQLCOM_ALTER_TABLE)
|
if (MIGR::infinidb_vtable.call_sp && (thd->lex)->sql_command != SQLCOM_ALTER_TABLE)
|
||||||
@ -2371,11 +2359,6 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mysql reads table twice for order by
|
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_REDO_PHASE1 ||
|
|
||||||
MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ORDER_BY)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE )
|
if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -2392,12 +2375,6 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
|
|
||||||
idbassert(ci != 0);
|
idbassert(ci != 0);
|
||||||
|
|
||||||
// MySQL sometimes calls rnd_init multiple times, plan should only be
|
|
||||||
// generated and sent once.
|
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_CREATE_VTABLE &&
|
|
||||||
!MIGR::infinidb_vtable.isNewQuery)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||||
{
|
{
|
||||||
force_close_fep_conn(thd, ci);
|
force_close_fep_conn(thd, ci);
|
||||||
@ -2491,7 +2468,13 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
|
|
||||||
// for ExeMgr logging sqltext. only log once for the query although multi plans may be sent
|
// for ExeMgr logging sqltext. only log once for the query although multi plans may be sent
|
||||||
if (ci->tableMap.size() == 1)
|
if (ci->tableMap.size() == 1)
|
||||||
|
{
|
||||||
ti.csep->data(idb_mysql_query_str(thd));
|
ti.csep->data(idb_mysql_query_str(thd));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ti.csep->data("<part of the query executed in table mode>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// vtable mode
|
// vtable mode
|
||||||
else
|
else
|
||||||
@ -2595,6 +2578,7 @@ int ha_calpont_impl_rnd_init(TABLE* table)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// @bug 2547. don't need to send the plan if it's impossible where for all unions.
|
// @bug 2547. don't need to send the plan if it's impossible where for all unions.
|
||||||
|
// WIP MCOL-2178 This singleton attribute could be a problem
|
||||||
if (MIGR::infinidb_vtable.impossibleWhereOnUnion)
|
if (MIGR::infinidb_vtable.impossibleWhereOnUnion)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -3115,10 +3099,6 @@ int ha_calpont_impl_rnd_end(TABLE* table, bool is_pushdown_hand)
|
|||||||
|
|
||||||
ti.tpl_ctx = 0;
|
ti.tpl_ctx = 0;
|
||||||
|
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_SELECT_VTABLE &&
|
|
||||||
MIGR::infinidb_vtable.has_order_by)
|
|
||||||
MIGR::infinidb_vtable.vtable_state = MIGR::INFINIDB_ORDER_BY;
|
|
||||||
|
|
||||||
ci->tableMap[table] = ti;
|
ci->tableMap[table] = ti;
|
||||||
|
|
||||||
// push warnings from CREATE phase
|
// push warnings from CREATE phase
|
||||||
@ -4158,15 +4138,6 @@ int ha_calpont_impl_commit (handlerton* hton, THD* thd, bool all)
|
|||||||
|
|
||||||
int ha_calpont_impl_rollback (handlerton* hton, THD* thd, bool all)
|
int ha_calpont_impl_rollback (handlerton* hton, THD* thd, bool all)
|
||||||
{
|
{
|
||||||
// @bug 1738. no need to rollback for select. This is to avoid concurrent session
|
|
||||||
// conflict because DML is not thread safe.
|
|
||||||
//comment out for bug 3874. Select should never come to rollback. If there is no active transaction,
|
|
||||||
//rollback in DMLProc is not doing anything anyway
|
|
||||||
//if (!(current_thd->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
|
|
||||||
//{
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL)
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
|
|
||||||
@ -4176,7 +4147,6 @@ int ha_calpont_impl_rollback (handlerton* hton, THD* thd, bool all)
|
|||||||
{
|
{
|
||||||
|
|
||||||
ci->dmlProc = new MessageQueueClient("DMLProc");
|
ci->dmlProc = new MessageQueueClient("DMLProc");
|
||||||
//cout << "rollback starts a client " << ci->dmlProc << " for session " << thd->thread_id << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc = ha_calpont_impl_rollback_(hton, thd, all, *ci);
|
int rc = ha_calpont_impl_rollback_(hton, thd, all, *ci);
|
||||||
@ -4225,6 +4195,8 @@ int ha_calpont_impl_close_connection (handlerton* hton, THD* thd)
|
|||||||
ci->cal_conn_hndl = 0;
|
ci->cal_conn_hndl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thd_set_ha_data(thd, hton, NULL);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4357,12 +4329,6 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
|||||||
string alias;
|
string alias;
|
||||||
alias.assign(table->alias.ptr(), table->alias.length());
|
alias.assign(table->alias.ptr(), table->alias.length());
|
||||||
IDEBUG( cout << "external_lock for " << alias << endl );
|
IDEBUG( cout << "external_lock for " << alias << endl );
|
||||||
idbassert((MIGR::infinidb_vtable.vtable_state >= MIGR::INFINIDB_INIT_CONNECT &&
|
|
||||||
MIGR::infinidb_vtable.vtable_state <= MIGR::INFINIDB_REDO_QUERY) ||
|
|
||||||
MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR);
|
|
||||||
|
|
||||||
if ( MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_INIT )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (get_fe_conn_info_ptr() == NULL)
|
if (get_fe_conn_info_ptr() == NULL)
|
||||||
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
set_fe_conn_info_ptr((void*)new cal_connection_info());
|
||||||
@ -4371,18 +4337,15 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
|||||||
|
|
||||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||||
{
|
{
|
||||||
|
ci->physTablesList.clear();
|
||||||
|
ci->tableMap.clear();
|
||||||
force_close_fep_conn(thd, ci);
|
force_close_fep_conn(thd, ci);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalTableMap::iterator mapiter = ci->tableMap.find(table);
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
|
|
||||||
//FIXME: fix this! (must be related to F_UNLCK define in winport)
|
CalTableMap::iterator mapiter = ci->tableMap.find(table);
|
||||||
if (mapiter != ci->tableMap.end() && lock_type == 0) // make sure it's the release lock (2nd) call
|
|
||||||
#else
|
|
||||||
if (mapiter != ci->tableMap.end() && lock_type == 2) // make sure it's the release lock (2nd) call
|
if (mapiter != ci->tableMap.end() && lock_type == 2) // make sure it's the release lock (2nd) call
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// table mode
|
// table mode
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_DISABLE_VTABLE)
|
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_DISABLE_VTABLE)
|
||||||
@ -4411,11 +4374,26 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
|||||||
{
|
{
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, infinidb_autoswitch_warning.c_str());
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, infinidb_autoswitch_warning.c_str());
|
||||||
}
|
}
|
||||||
|
// MCOL-2178 Check for tableMap size to set this only once.
|
||||||
ci->queryState = 0;
|
ci->queryState = 0;
|
||||||
}
|
}
|
||||||
else // vtable mode
|
ci->tableMap.erase(table);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lock_type == 0)
|
||||||
{
|
{
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_SELECT_VTABLE)
|
ci->physTablesList.insert(table);
|
||||||
|
}
|
||||||
|
else if (lock_type == 2)
|
||||||
|
{
|
||||||
|
std::set<TABLE*>::iterator iter = ci->physTablesList.find(table);
|
||||||
|
if ( iter != ci->physTablesList.end() )
|
||||||
|
{
|
||||||
|
ci->physTablesList.erase(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( iter != ci->physTablesList.end() && ci->physTablesList.empty() )
|
||||||
{
|
{
|
||||||
if (!ci->cal_conn_hndl)
|
if (!ci->cal_conn_hndl)
|
||||||
return 0;
|
return 0;
|
||||||
@ -4430,11 +4408,11 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
|
|||||||
MIGR::infinidb_vtable.override_largeside_estimate = false;
|
MIGR::infinidb_vtable.override_largeside_estimate = false;
|
||||||
// MCOL-3247 Use THD::ha_data as a per-plugin per-session
|
// MCOL-3247 Use THD::ha_data as a per-plugin per-session
|
||||||
// storage for cal_conn_hndl to use it later in close_connection
|
// storage for cal_conn_hndl to use it later in close_connection
|
||||||
thd_set_ha_data(thd, calpont_hton, get_fe_conn_info_ptr());
|
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
|
||||||
|
ci->tableMap.clear();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ci->tableMap.erase(table);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -4495,11 +4473,6 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR)
|
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR)
|
||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
|
|
||||||
// MCOL-1052
|
|
||||||
// by pass the extra union trips. return 0
|
|
||||||
//if (MIGR::infinidb_vtable.isUnion && MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_CREATE_VTABLE)
|
|
||||||
// return 0;
|
|
||||||
|
|
||||||
// @bug 2232. Basic SP support. Error out non support sp cases.
|
// @bug 2232. Basic SP support. Error out non support sp cases.
|
||||||
// @bug 3939. Only error out for sp with select. Let pass for alter table in sp.
|
// @bug 3939. Only error out for sp with select. Let pass for alter table in sp.
|
||||||
if (MIGR::infinidb_vtable.call_sp && (thd->lex)->sql_command != SQLCOM_ALTER_TABLE)
|
if (MIGR::infinidb_vtable.call_sp && (thd->lex)->sql_command != SQLCOM_ALTER_TABLE)
|
||||||
@ -4521,12 +4494,6 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
idbassert(ci != 0);
|
idbassert(ci != 0);
|
||||||
|
|
||||||
|
|
||||||
// MySQL sometimes calls rnd_init multiple times, plan should only be
|
|
||||||
// generated and sent once.
|
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_DISABLE_VTABLE &&
|
|
||||||
!MIGR::infinidb_vtable.isNewQuery)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||||
{
|
{
|
||||||
force_close_fep_conn(thd, ci);
|
force_close_fep_conn(thd, ci);
|
||||||
@ -4660,6 +4627,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
|||||||
// send plan whenever group_init is called
|
// send plan whenever group_init is called
|
||||||
int status = cp_get_group_plan(thd, csep, gi);
|
int status = cp_get_group_plan(thd, csep, gi);
|
||||||
|
|
||||||
|
// WIP MCOL-2178 This could be a problem
|
||||||
if (status > 0)
|
if (status > 0)
|
||||||
goto internal_error;
|
goto internal_error;
|
||||||
else if (status < 0)
|
else if (status < 0)
|
||||||
@ -5271,7 +5239,7 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
//check whether the system is ready to process statement.
|
//check whether the system is ready to process statement.
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
static DBRM dbrm(true);
|
static DBRM dbrm(true);
|
||||||
bool bSystemQueryReady = dbrm.getSystemQueryReady();
|
int bSystemQueryReady = dbrm.getSystemQueryReady();
|
||||||
|
|
||||||
if (bSystemQueryReady == 0)
|
if (bSystemQueryReady == 0)
|
||||||
{
|
{
|
||||||
@ -5299,18 +5267,6 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
// prevent "create table as select" from running on slave
|
// prevent "create table as select" from running on slave
|
||||||
MIGR::infinidb_vtable.hasInfiniDBTable = true;
|
MIGR::infinidb_vtable.hasInfiniDBTable = true;
|
||||||
|
|
||||||
/* If this node is the slave, ignore DML to IDB tables */
|
|
||||||
if (thd->slave_thread && (
|
|
||||||
thd->lex->sql_command == SQLCOM_INSERT ||
|
|
||||||
thd->lex->sql_command == SQLCOM_INSERT_SELECT ||
|
|
||||||
thd->lex->sql_command == SQLCOM_UPDATE ||
|
|
||||||
thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
|
|
||||||
thd->lex->sql_command == SQLCOM_DELETE ||
|
|
||||||
thd->lex->sql_command == SQLCOM_DELETE_MULTI ||
|
|
||||||
thd->lex->sql_command == SQLCOM_TRUNCATE ||
|
|
||||||
thd->lex->sql_command == SQLCOM_LOAD))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// return error is error status is already set
|
// return error is error status is already set
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR)
|
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ERROR)
|
||||||
return ER_INTERNAL_ERROR;
|
return ER_INTERNAL_ERROR;
|
||||||
@ -5327,10 +5283,14 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
// mysql reads table twice for order by
|
// mysql reads table twice for order by
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_REDO_PHASE1 ||
|
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_REDO_PHASE1 ||
|
||||||
MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ORDER_BY)
|
MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_ORDER_BY)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE )
|
if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//Update and delete code
|
//Update and delete code
|
||||||
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))
|
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))
|
||||||
@ -5347,12 +5307,6 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
|
|
||||||
idbassert(ci != 0);
|
idbassert(ci != 0);
|
||||||
|
|
||||||
// MySQL sometimes calls rnd_init multiple times, plan should only be
|
|
||||||
// generated and sent once.
|
|
||||||
if (MIGR::infinidb_vtable.vtable_state == MIGR::INFINIDB_CREATE_VTABLE &&
|
|
||||||
!MIGR::infinidb_vtable.isNewQuery)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
if (thd->killed == KILL_QUERY || thd->killed == KILL_QUERY_HARD)
|
||||||
{
|
{
|
||||||
if (ci->cal_conn_hndl)
|
if (ci->cal_conn_hndl)
|
||||||
@ -5495,17 +5449,19 @@ int ha_cs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table)
|
|||||||
dh = reinterpret_cast<derived_handler*>(handler_info->hndl_ptr);
|
dh = reinterpret_cast<derived_handler*>(handler_info->hndl_ptr);
|
||||||
status = cs_get_derived_plan(dh, thd, csep);
|
status = cs_get_derived_plan(dh, thd, csep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "pushdown_init get_plan status " << status << std::endl;
|
||||||
|
|
||||||
// WIP MCOL-2121 Find a way to return an actual error
|
// Return an error to avoid MDB crash later in end_statement
|
||||||
// It either ends up with 42 or other error status
|
if (status != 0)
|
||||||
if (status > 0)
|
|
||||||
goto internal_error;
|
goto internal_error;
|
||||||
else if (status < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
std::cout << "pushdown_init impossibleWhereOnUnion " << status << std::endl;
|
||||||
// @bug 2547. don't need to send the plan if it's impossible where for all unions.
|
// @bug 2547. don't need to send the plan if it's impossible where for all unions.
|
||||||
if (MIGR::infinidb_vtable.impossibleWhereOnUnion)
|
if (MIGR::infinidb_vtable.impossibleWhereOnUnion)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
string query;
|
string query;
|
||||||
query.assign(idb_mysql_query_str(thd));
|
query.assign(idb_mysql_query_str(thd));
|
||||||
|
@ -322,9 +322,12 @@ ParseTree* setDerivedFilter(THD* thd, ParseTree*& n,
|
|||||||
FromSubQuery::FromSubQuery(gp_walk_info& gwip) : SubQuery(gwip)
|
FromSubQuery::FromSubQuery(gp_walk_info& gwip) : SubQuery(gwip)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
FromSubQuery::FromSubQuery(gp_walk_info& gwip, SELECT_LEX* sub) :
|
FromSubQuery::FromSubQuery(gp_walk_info& gwip,
|
||||||
SubQuery(gwip),
|
SELECT_LEX* sub,
|
||||||
fFromSub(sub)
|
bool isPushdownHandler) :
|
||||||
|
SubQuery(gwip),
|
||||||
|
fFromSub(sub),
|
||||||
|
fPushdownHand(isPushdownHandler)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
FromSubQuery::~FromSubQuery()
|
FromSubQuery::~FromSubQuery()
|
||||||
@ -345,7 +348,7 @@ SCSEP FromSubQuery::transform()
|
|||||||
gwi.viewName = fGwip.viewName;
|
gwi.viewName = fGwip.viewName;
|
||||||
csep->derivedTbAlias(fAlias); // always lower case
|
csep->derivedTbAlias(fAlias); // always lower case
|
||||||
|
|
||||||
if (getSelectPlan(gwi, *fFromSub, csep) != 0)
|
if (getSelectPlan(gwi, *fFromSub, csep, fPushdownHand) != 0)
|
||||||
{
|
{
|
||||||
fGwip.fatalParseError = true;
|
fGwip.fatalParseError = true;
|
||||||
|
|
||||||
|
@ -210,33 +210,9 @@ static derived_handler*
|
|||||||
create_columnstore_derived_handler(THD* thd, TABLE_LIST *derived)
|
create_columnstore_derived_handler(THD* thd, TABLE_LIST *derived)
|
||||||
{
|
{
|
||||||
ha_columnstore_derived_handler* handler = NULL;
|
ha_columnstore_derived_handler* handler = NULL;
|
||||||
handlerton *ht= 0;
|
|
||||||
|
|
||||||
SELECT_LEX_UNIT *unit= derived->derived;
|
SELECT_LEX_UNIT *unit= derived->derived;
|
||||||
|
|
||||||
/* //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())
|
|
||||||
{
|
|
||||||
if (!(sl->join))
|
|
||||||
return 0;
|
|
||||||
for (TABLE_LIST *tbl= sl->join->tables_list; tbl; tbl= tbl->next_local)
|
|
||||||
{
|
|
||||||
if (!tbl->table)
|
|
||||||
return 0;
|
|
||||||
// Same handlerton type check.
|
|
||||||
if (!ht)
|
|
||||||
ht= tbl->table->file->partition_ht();
|
|
||||||
else if (ht != tbl->table->file->partition_ht())
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool unsupported_feature = false;
|
bool unsupported_feature = false;
|
||||||
{
|
{
|
||||||
SELECT_LEX select_lex = *unit->first_select();
|
SELECT_LEX select_lex = *unit->first_select();
|
||||||
@ -253,7 +229,7 @@ create_columnstore_derived_handler(THD* thd, TABLE_LIST *derived)
|
|||||||
|
|
||||||
if ( icp )
|
if ( icp )
|
||||||
{
|
{
|
||||||
icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
|
//icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,36 +446,21 @@ static select_handler*
|
|||||||
create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex)
|
create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex)
|
||||||
{
|
{
|
||||||
ha_columnstore_select_handler* handler = NULL;
|
ha_columnstore_select_handler* handler = NULL;
|
||||||
handlerton *ht= 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Return if vtable enabled.
|
|
||||||
//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))
|
|
||||||
return 0;
|
|
||||||
for (TABLE_LIST *tbl= sl->join->tables_list; tbl; tbl= tbl->next_local)
|
|
||||||
{
|
|
||||||
if (!tbl->table)
|
|
||||||
return 0;
|
|
||||||
// Same handlerton type check.
|
|
||||||
if (!ht)
|
|
||||||
ht= tbl->table->file->partition_ht();
|
|
||||||
else if (ht != tbl->table->file->partition_ht())
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool unsupported_feature = false;
|
bool unsupported_feature = false;
|
||||||
|
// Select_handler use the short-cut that effectively disables
|
||||||
|
// INSERT..SELECT and LDI
|
||||||
|
if ( (thd->lex)->sql_command == SQLCOM_INSERT_SELECT
|
||||||
|
|| (thd->lex)->sql_command == SQLCOM_CREATE_TABLE )
|
||||||
|
|
||||||
|
{
|
||||||
|
unsupported_feature = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Impossible HAVING or WHERE
|
// Impossible HAVING or WHERE
|
||||||
if ( ( select_lex->having && select_lex->having_value == Item::COND_FALSE )
|
// WIP replace with function call
|
||||||
|
if ( unsupported_feature
|
||||||
|
|| ( select_lex->having && select_lex->having_value == Item::COND_FALSE )
|
||||||
|| ( select_lex->cond_count > 0
|
|| ( select_lex->cond_count > 0
|
||||||
&& select_lex->cond_value == Item::COND_FALSE ) )
|
&& select_lex->cond_value == Item::COND_FALSE ) )
|
||||||
{
|
{
|
||||||
@ -521,7 +482,7 @@ create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex)
|
|||||||
|
|
||||||
if ( where_icp )
|
if ( where_icp )
|
||||||
{
|
{
|
||||||
where_icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
|
//where_icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Looking for JOIN with ON expression through
|
// Looking for JOIN with ON expression through
|
||||||
@ -532,7 +493,7 @@ create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex)
|
|||||||
if(table_ptr->on_expr)
|
if(table_ptr->on_expr)
|
||||||
{
|
{
|
||||||
on_icp = reinterpret_cast<Item_cond*>(table_ptr->on_expr);
|
on_icp = reinterpret_cast<Item_cond*>(table_ptr->on_expr);
|
||||||
on_icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
|
//on_icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +504,7 @@ create_columnstore_select_handler(THD* thd, SELECT_LEX* select_lex)
|
|||||||
unsupported_feature = true;
|
unsupported_feature = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!unsupported_feature)
|
if (!unsupported_feature)
|
||||||
{
|
{
|
||||||
handler = new ha_columnstore_select_handler(thd, select_lex);
|
handler = new ha_columnstore_select_handler(thd, select_lex);
|
||||||
@ -571,7 +532,8 @@ ha_columnstore_select_handler::ha_columnstore_select_handler(THD *thd,
|
|||||||
* select_handler constructor
|
* select_handler constructor
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
ha_columnstore_select_handler::~ha_columnstore_select_handler()
|
ha_columnstore_select_handler::~ha_columnstore_select_handler()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*@brief Initiate the query for select_handler */
|
/*@brief Initiate the query for select_handler */
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
|
@ -45,7 +45,10 @@ namespace cal_impl_if
|
|||||||
class SubQuery
|
class SubQuery
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SubQuery(gp_walk_info& gwip) : fGwip(gwip), fCorrelated(false) {}
|
SubQuery(gp_walk_info& gwip) :
|
||||||
|
fGwip(gwip),
|
||||||
|
fCorrelated(false)
|
||||||
|
{}
|
||||||
virtual ~SubQuery() {}
|
virtual ~SubQuery() {}
|
||||||
virtual gp_walk_info& gwip() const
|
virtual gp_walk_info& gwip() const
|
||||||
{
|
{
|
||||||
@ -178,7 +181,7 @@ class FromSubQuery : public SubQuery
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FromSubQuery(gp_walk_info&);
|
FromSubQuery(gp_walk_info&);
|
||||||
FromSubQuery(gp_walk_info&, SELECT_LEX* fromSub);
|
FromSubQuery(gp_walk_info&, SELECT_LEX* fromSub, bool isPushdownHand=false);
|
||||||
~FromSubQuery();
|
~FromSubQuery();
|
||||||
const SELECT_LEX* fromSub() const
|
const SELECT_LEX* fromSub() const
|
||||||
{
|
{
|
||||||
@ -200,6 +203,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
SELECT_LEX* fFromSub;
|
SELECT_LEX* fFromSub;
|
||||||
std::string fAlias;
|
std::string fAlias;
|
||||||
|
bool fPushdownHand;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SelectSubQuery : public SubQuery
|
class SelectSubQuery : public SubQuery
|
||||||
|
Reference in New Issue
Block a user