1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-05-31 11:41:14 +03:00

MCOL-597 Take Window Functions just to get a compile. No other changes were needed.

This commit is contained in:
David Hall 2017-03-03 15:57:41 -06:00
parent f240c89faf
commit 12acd033fb
5 changed files with 46 additions and 49 deletions

View File

@ -121,7 +121,6 @@ static int calpont_commit(handlerton *hton, THD* thd, bool all);
static int calpont_rollback(handlerton *hton, THD* thd, bool all); static int calpont_rollback(handlerton *hton, THD* thd, bool all);
static int calpont_close_connection ( handlerton *hton, THD* thd ); static int calpont_close_connection ( handlerton *hton, THD* thd );
static void calpont_set_error( THD*, uint64_t, LEX_STRING*, uint32_t);
handlerton *calpont_hton; handlerton *calpont_hton;
/* Variables for example share methods */ /* Variables for example share methods */
@ -219,7 +218,6 @@ static int columnstore_init_func(void *p)
calpont_hton->commit= calpont_commit; calpont_hton->commit= calpont_commit;
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->set_error= calpont_set_error;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -248,7 +246,6 @@ static int infinidb_init_func(void *p)
calpont_hton->commit= calpont_commit; calpont_hton->commit= calpont_commit;
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->set_error= calpont_set_error;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -372,11 +369,6 @@ static int calpont_close_connection ( handlerton *hton, THD* thd )
return rc; return rc;
} }
static void calpont_set_error(THD* thd, uint64_t errCode, LEX_STRING* args, uint32_t argCount)
{
return ha_calpont_impl_set_error(thd, errCode, args, argCount);
}
ha_calpont::ha_calpont(handlerton *hton, TABLE_SHARE *table_arg) : ha_calpont::ha_calpont(handlerton *hton, TABLE_SHARE *table_arg) :
handler(hton, table_arg), handler(hton, table_arg),
int_table_flags(HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE | int_table_flags(HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE |

View File

@ -699,11 +699,13 @@ void debug_walk(const Item *item, void *arg)
cout << ": <NULL>" << endl; cout << ": <NULL>" << endl;
break; break;
} }
#if 0
case Item::WINDOW_FUNC_ITEM: case Item::WINDOW_FUNC_ITEM:
{ {
cout << "Window Function Item" << endl; cout << "Window Function Item" << endl;
break; break;
} }
#endif
default: default:
{ {
cout << "UNKNOWN_ITEM type " << item->type() << endl; cout << "UNKNOWN_ITEM type " << item->type() << endl;
@ -2453,6 +2455,7 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp
rc = new ConstantColumn(valStr); rc = new ConstantColumn(valStr);
break; break;
} }
#if 0
case Item::WINDOW_FUNC_ITEM: case Item::WINDOW_FUNC_ITEM:
{ {
return buildWindowFunctionColumn(item, gwi, nonSupport); return buildWindowFunctionColumn(item, gwi, nonSupport);
@ -2469,6 +2472,7 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp
rc->resultType(srcp->resultType()); rc->resultType(srcp->resultType());
break; break;
} }
#endif
case Item::SUBSELECT_ITEM: case Item::SUBSELECT_ITEM:
{ {
gwi.hasSubSelect = true; gwi.hasSubSelect = true;
@ -3500,23 +3504,24 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
end=order_item + gc->order_field();order_item < end; end=order_item + gc->order_field();order_item < end;
order_item++) order_item++)
{ {
Item *ord_col= *(*order_item)->item; Item *ord_col= *(*order_item)->item;
if (ord_col->type() == Item::INT_ITEM) if (ord_col->type() == Item::INT_ITEM)
{ {
Item_int* id = (Item_int*)ord_col; Item_int* id = (Item_int*)ord_col;
if (id->val_int() > (int)selCols.size()) if (id->val_int() > (int)selCols.size())
{ {
gwi.fatalParseError = true; gwi.fatalParseError = true;
return NULL; return NULL;
} }
rc = selCols[id->val_int()-1]->clone(); rc = selCols[id->val_int()-1]->clone();
rc->orderPos(id->val_int()-1); rc->orderPos(id->val_int()-1);
} }
else else
{ {
rc = buildReturnedColumn(ord_col, gwi, gwi.fatalParseError); rc = buildReturnedColumn(ord_col, gwi, gwi.fatalParseError);
} }
rc->asc((*order_item)->asc); // 10.2 TODO: direction is now a tri-state flag
rc->asc((*order_item)->direction == ORDER::ORDER_ASC ? true : false);
orderCols.push_back(SRCP(rc)); orderCols.push_back(SRCP(rc));
} }
@ -4423,6 +4428,7 @@ void gp_walk(const Item *item, void *arg)
gwip->rcWorkStack.push(buildReturnedColumn(itp, *gwip, gwip->fatalParseError)); gwip->rcWorkStack.push(buildReturnedColumn(itp, *gwip, gwip->fatalParseError));
break; break;
} }
#if 0
case Item::WINDOW_FUNC_ITEM: case Item::WINDOW_FUNC_ITEM:
{ {
gwip->hasWindowFunc = true; gwip->hasWindowFunc = true;
@ -4432,6 +4438,7 @@ void gp_walk(const Item *item, void *arg)
gwip->rcWorkStack.push(af); gwip->rcWorkStack.push(af);
break; break;
} }
#endif
case Item::COPY_STR_ITEM: case Item::COPY_STR_ITEM:
printf("********** received COPY_STR_ITEM *********\n"); printf("********** received COPY_STR_ITEM *********\n");
break; break;
@ -4615,9 +4622,11 @@ void parse_item (Item *item, vector<Item_field*>& field_vec, bool& hasNonSupport
setError(item->thd(), ER_CHECK_NOT_IMPLEMENTED, parseErrorText); setError(item->thd(), ER_CHECK_NOT_IMPLEMENTED, parseErrorText);
break; break;
} }
#if 0
case Item::WINDOW_FUNC_ITEM: case Item::WINDOW_FUNC_ITEM:
parseInfo |= AF_BIT; parseInfo |= AF_BIT;
break; break;
#endif
default: default:
break; break;
} }
@ -5507,6 +5516,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText, gwi); setError(gwi.thd, ER_CHECK_NOT_IMPLEMENTED, gwi.parseErrorText, gwi);
return ER_CHECK_NOT_IMPLEMENTED; return ER_CHECK_NOT_IMPLEMENTED;
} }
#if 0
case Item::WINDOW_FUNC_ITEM: case Item::WINDOW_FUNC_ITEM:
{ {
SRCP srcp(buildWindowFunctionColumn(item, gwi, gwi.fatalParseError)); SRCP srcp(buildWindowFunctionColumn(item, gwi, gwi.fatalParseError));
@ -5520,6 +5530,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
gwi.returnedCols.push_back(srcp); gwi.returnedCols.push_back(srcp);
break; break;
} }
#endif
default: default:
{ {
break; break;
@ -5672,6 +5683,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
// check if window functions are in order by. InfiniDB process order by list if // check if window functions are in order by. InfiniDB process order by list if
// window functions are involved, either in order by or projection. // window functions are involved, either in order by or projection.
#if 0
bool hasWindowFunc = gwi.hasWindowFunc; bool hasWindowFunc = gwi.hasWindowFunc;
gwi.hasWindowFunc = false; gwi.hasWindowFunc = false;
for (; groupcol; groupcol= groupcol->next) for (; groupcol; groupcol= groupcol->next)
@ -5687,7 +5699,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
return ER_CHECK_NOT_IMPLEMENTED; return ER_CHECK_NOT_IMPLEMENTED;
} }
gwi.hasWindowFunc = hasWindowFunc; gwi.hasWindowFunc = hasWindowFunc;
#endif
groupcol = reinterpret_cast<ORDER*>(select_lex.group_list.first); groupcol = reinterpret_cast<ORDER*>(select_lex.group_list.first);
for (; groupcol; groupcol= groupcol->next) for (; groupcol; groupcol= groupcol->next)
@ -5933,12 +5945,13 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
// check if window functions are in order by. InfiniDB process order by list if // check if window functions are in order by. InfiniDB process order by list if
// window functions are involved, either in order by or projection. // window functions are involved, either in order by or projection.
#if 0
for (; ordercol; ordercol= ordercol->next) for (; ordercol; ordercol= ordercol->next)
{ {
if ((*(ordercol->item))->type() == Item::WINDOW_FUNC_ITEM) if ((*(ordercol->item))->type() == Item::WINDOW_FUNC_ITEM)
gwi.hasWindowFunc = true; gwi.hasWindowFunc = true;
} }
#endif
// re-visit the first of ordercol list // re-visit the first of ordercol list
ordercol = reinterpret_cast<ORDER*>(order_list.first); ordercol = reinterpret_cast<ORDER*>(order_list.first);
@ -5989,7 +6002,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
return ER_CHECK_NOT_IMPLEMENTED; return ER_CHECK_NOT_IMPLEMENTED;
} }
} }
if (ordercol->asc) if (ordercol->direction == ORDER::ORDER_ASC)
rc->asc(true); rc->asc(true);
else else
rc->asc(false); rc->asc(false);
@ -6022,7 +6035,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
ostringstream oss; ostringstream oss;
oss << ordercol->counter; oss << ordercol->counter;
ord_cols += oss.str(); ord_cols += oss.str();
if (!ordercol->asc) if (!ordercol->direction == ORDER::ORDER_ASC)
ord_cols += " desc"; ord_cols += " desc";
continue; continue;
} }
@ -6147,7 +6160,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
gwi.returnedCols.push_back(srcp); gwi.returnedCols.push_back(srcp);
ord_cols += " `" + escapeBackTick(str.c_ptr()) + "`"; ord_cols += " `" + escapeBackTick(str.c_ptr()) + "`";
} }
if (!ordercol->asc) if (!ordercol->direction == ORDER::ORDER_ASC)
ord_cols += " desc"; ord_cols += " desc";
continue; continue;
} }
@ -6211,7 +6224,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
ord_item->print(&str, QT_INFINIDB); ord_item->print(&str, QT_INFINIDB);
ord_cols += str.c_ptr(); ord_cols += str.c_ptr();
} }
if (!ordercol->asc) if (!ordercol->direction == ORDER::ORDER_ASC)
ord_cols += " desc"; ord_cols += " desc";
} }
} }
@ -6551,7 +6564,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
ord_item->print(&str, QT_INFINIDB_NO_QUOTE); ord_item->print(&str, QT_INFINIDB_NO_QUOTE);
ord_cols += string(str.c_ptr()); ord_cols += string(str.c_ptr());
} }
if (!ordercol->asc) if (!ordercol->direction == ORDER::ORDER_ASC)
ord_cols += " desc"; ord_cols += " desc";
} }
} }

View File

@ -1170,7 +1170,7 @@ uint32_t doUpdateDelete(THD *thd)
{ {
multi_delete* deleteTable = (multi_delete*)((thd->lex->select_lex.join)->result); multi_delete* deleteTable = (multi_delete*)((thd->lex->select_lex.join)->result);
first_table= (TABLE_LIST*) deleteTable->get_tables(); first_table= (TABLE_LIST*) deleteTable->get_tables();
if (deleteTable->num_of_tables == 1) if (deleteTable->get_num_of_tables() == 1)
{ {
schemaName = first_table->db; schemaName = first_table->db;
tableName = first_table->table_name; tableName = first_table->table_name;
@ -4444,15 +4444,5 @@ int ha_calpont_impl_rnd_pos(uchar *buf, uchar *pos)
return ER_INTERNAL_ERROR; return ER_INTERNAL_ERROR;
} }
// Called from mysql parser to set IDB error for window functions
void ha_calpont_impl_set_error(THD* thd, uint64_t errCode, LEX_STRING* args, uint32_t argCount)
{
IDEBUG( cout << "ha_calpont_impl_ser_error" << endl);
Message::Args arguments;
for (uint32_t i = 0; i < argCount; i++)
arguments.add(args[i].str);
string emsg = logging::IDBErrorInfo::instance()->errorMsg(errCode, arguments);
setError(thd, ER_INTERNAL_ERROR, emsg);
}
// vim:sw=4 ts=4: // vim:sw=4 ts=4:

View File

@ -48,7 +48,6 @@ extern int ha_calpont_impl_external_lock(THD *thd, TABLE* table, int lock_type);
extern int ha_calpont_impl_update_row(); extern int ha_calpont_impl_update_row();
extern int ha_calpont_impl_delete_row(); extern int ha_calpont_impl_delete_row();
extern int ha_calpont_impl_rnd_pos(uchar *buf, uchar *pos); extern int ha_calpont_impl_rnd_pos(uchar *buf, uchar *pos);
extern void ha_calpont_impl_set_error(THD* thd, uint64_t errCode, LEX_STRING* args, uint32_t argCount);
#endif #endif
#ifdef NEED_CALPONT_INTERFACE #ifdef NEED_CALPONT_INTERFACE

View File

@ -63,6 +63,7 @@ ReturnedColumn* nullOnError(gp_walk_info& gwi)
return NULL; return NULL;
} }
#if 0
WF_FRAME frame(BOUND& bound) WF_FRAME frame(BOUND& bound)
{ {
switch (bound) switch (bound)
@ -81,7 +82,7 @@ WF_FRAME frame(BOUND& bound)
return WF_UNKNOWN; return WF_UNKNOWN;
} }
} }
#endif
ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi) ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi)
{ {
if (!(gwi.thd->infinidb_vtable.cal_conn_info)) if (!(gwi.thd->infinidb_vtable.cal_conn_info))
@ -188,12 +189,13 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info); cal_connection_info* ci = reinterpret_cast<cal_connection_info*>(gwi.thd->infinidb_vtable.cal_conn_info);
gwi.hasWindowFunc = true; gwi.hasWindowFunc = true;
Item_func_window* wf = (Item_func_window*)item; // Item_func_window* wf = (Item_func_window*)item;
string funcName = wf->func_name(); string funcName /*= wf->func_name()*/;
WindowFunctionColumn* ac = new WindowFunctionColumn(funcName); WindowFunctionColumn* ac = new WindowFunctionColumn(funcName);
ac->distinct(wf->isDistinct()); // ac->distinct(wf->isDistinct());
Window_context *wf_ctx = wf->window_ctx(); // Window_context *wf_ctx = wf->window_ctx();
SRCP srcp; SRCP srcp;
#if 0
// arguments // arguments
vector<SRCP> funcParms; vector<SRCP> funcParms;
@ -436,6 +438,7 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
// put ac on windowFuncList // put ac on windowFuncList
gwi.windowFuncList.push_back(ac); gwi.windowFuncList.push_back(ac);
#endif
return ac; return ac;
} }