diff --git a/dbcon/mysql/ha_calpont.cpp b/dbcon/mysql/ha_calpont.cpp index 31b08451c..16e1e0def 100755 --- a/dbcon/mysql/ha_calpont.cpp +++ b/dbcon/mysql/ha_calpont.cpp @@ -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_close_connection ( handlerton *hton, THD* thd ); -static void calpont_set_error( THD*, uint64_t, LEX_STRING*, uint32_t); handlerton *calpont_hton; /* Variables for example share methods */ @@ -219,7 +218,6 @@ static int columnstore_init_func(void *p) calpont_hton->commit= calpont_commit; calpont_hton->rollback= calpont_rollback; calpont_hton->close_connection = calpont_close_connection; - calpont_hton->set_error= calpont_set_error; DBUG_RETURN(0); } @@ -248,7 +246,6 @@ static int infinidb_init_func(void *p) calpont_hton->commit= calpont_commit; calpont_hton->rollback= calpont_rollback; calpont_hton->close_connection = calpont_close_connection; - calpont_hton->set_error= calpont_set_error; DBUG_RETURN(0); } @@ -372,11 +369,6 @@ static int calpont_close_connection ( handlerton *hton, THD* thd ) 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) : handler(hton, table_arg), int_table_flags(HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE | diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 4c2f7959b..56df504dd 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -699,11 +699,13 @@ void debug_walk(const Item *item, void *arg) cout << ": " << endl; break; } +#if 0 case Item::WINDOW_FUNC_ITEM: { cout << "Window Function Item" << endl; break; } +#endif default: { 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); break; } +#if 0 case Item::WINDOW_FUNC_ITEM: { return buildWindowFunctionColumn(item, gwi, nonSupport); @@ -2469,6 +2472,7 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp rc->resultType(srcp->resultType()); break; } +#endif case Item::SUBSELECT_ITEM: { gwi.hasSubSelect = true; @@ -3500,23 +3504,24 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi) end=order_item + gc->order_field();order_item < end; order_item++) { - Item *ord_col= *(*order_item)->item; - if (ord_col->type() == Item::INT_ITEM) - { - Item_int* id = (Item_int*)ord_col; - if (id->val_int() > (int)selCols.size()) - { - gwi.fatalParseError = true; - return NULL; - } - rc = selCols[id->val_int()-1]->clone(); - rc->orderPos(id->val_int()-1); - } - else - { - rc = buildReturnedColumn(ord_col, gwi, gwi.fatalParseError); - } - rc->asc((*order_item)->asc); + Item *ord_col= *(*order_item)->item; + if (ord_col->type() == Item::INT_ITEM) + { + Item_int* id = (Item_int*)ord_col; + if (id->val_int() > (int)selCols.size()) + { + gwi.fatalParseError = true; + return NULL; + } + rc = selCols[id->val_int()-1]->clone(); + rc->orderPos(id->val_int()-1); + } + else + { + rc = buildReturnedColumn(ord_col, gwi, gwi.fatalParseError); + } + // 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)); } @@ -4423,6 +4428,7 @@ void gp_walk(const Item *item, void *arg) gwip->rcWorkStack.push(buildReturnedColumn(itp, *gwip, gwip->fatalParseError)); break; } +#if 0 case Item::WINDOW_FUNC_ITEM: { gwip->hasWindowFunc = true; @@ -4432,6 +4438,7 @@ void gp_walk(const Item *item, void *arg) gwip->rcWorkStack.push(af); break; } +#endif case Item::COPY_STR_ITEM: printf("********** received COPY_STR_ITEM *********\n"); break; @@ -4615,9 +4622,11 @@ void parse_item (Item *item, vector& field_vec, bool& hasNonSupport setError(item->thd(), ER_CHECK_NOT_IMPLEMENTED, parseErrorText); break; } +#if 0 case Item::WINDOW_FUNC_ITEM: parseInfo |= AF_BIT; break; +#endif default: 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); return ER_CHECK_NOT_IMPLEMENTED; } +#if 0 case Item::WINDOW_FUNC_ITEM: { 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); break; } +#endif default: { 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 // window functions are involved, either in order by or projection. +#if 0 bool hasWindowFunc = gwi.hasWindowFunc; gwi.hasWindowFunc = false; 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; } gwi.hasWindowFunc = hasWindowFunc; - +#endif groupcol = reinterpret_cast(select_lex.group_list.first); 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 // window functions are involved, either in order by or projection. +#if 0 for (; ordercol; ordercol= ordercol->next) { if ((*(ordercol->item))->type() == Item::WINDOW_FUNC_ITEM) gwi.hasWindowFunc = true; } - +#endif // re-visit the first of ordercol list ordercol = reinterpret_cast(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; } } - if (ordercol->asc) + if (ordercol->direction == ORDER::ORDER_ASC) rc->asc(true); else rc->asc(false); @@ -6022,7 +6035,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i ostringstream oss; oss << ordercol->counter; ord_cols += oss.str(); - if (!ordercol->asc) + if (!ordercol->direction == ORDER::ORDER_ASC) ord_cols += " desc"; continue; } @@ -6147,7 +6160,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i gwi.returnedCols.push_back(srcp); ord_cols += " `" + escapeBackTick(str.c_ptr()) + "`"; } - if (!ordercol->asc) + if (!ordercol->direction == ORDER::ORDER_ASC) ord_cols += " desc"; 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_cols += str.c_ptr(); } - if (!ordercol->asc) + if (!ordercol->direction == ORDER::ORDER_ASC) 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_cols += string(str.c_ptr()); } - if (!ordercol->asc) + if (!ordercol->direction == ORDER::ORDER_ASC) ord_cols += " desc"; } } diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index 71300fae0..3d5f1e381 100755 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -1170,7 +1170,7 @@ uint32_t doUpdateDelete(THD *thd) { multi_delete* deleteTable = (multi_delete*)((thd->lex->select_lex.join)->result); first_table= (TABLE_LIST*) deleteTable->get_tables(); - if (deleteTable->num_of_tables == 1) + if (deleteTable->get_num_of_tables() == 1) { schemaName = first_table->db; tableName = first_table->table_name; @@ -4444,15 +4444,5 @@ int ha_calpont_impl_rnd_pos(uchar *buf, uchar *pos) 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: diff --git a/dbcon/mysql/ha_calpont_impl.h b/dbcon/mysql/ha_calpont_impl.h index 58f680a41..79fc6933b 100644 --- a/dbcon/mysql/ha_calpont_impl.h +++ b/dbcon/mysql/ha_calpont_impl.h @@ -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_delete_row(); 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 #ifdef NEED_CALPONT_INTERFACE diff --git a/dbcon/mysql/ha_window_function.cpp b/dbcon/mysql/ha_window_function.cpp index ee91eed26..c7bed4f15 100755 --- a/dbcon/mysql/ha_window_function.cpp +++ b/dbcon/mysql/ha_window_function.cpp @@ -63,6 +63,7 @@ ReturnedColumn* nullOnError(gp_walk_info& gwi) return NULL; } +#if 0 WF_FRAME frame(BOUND& bound) { switch (bound) @@ -81,7 +82,7 @@ WF_FRAME frame(BOUND& bound) return WF_UNKNOWN; } } - +#endif ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi) { 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(gwi.thd->infinidb_vtable.cal_conn_info); gwi.hasWindowFunc = true; - Item_func_window* wf = (Item_func_window*)item; - string funcName = wf->func_name(); +// Item_func_window* wf = (Item_func_window*)item; + string funcName /*= wf->func_name()*/; WindowFunctionColumn* ac = new WindowFunctionColumn(funcName); - ac->distinct(wf->isDistinct()); - Window_context *wf_ctx = wf->window_ctx(); +// ac->distinct(wf->isDistinct()); +// Window_context *wf_ctx = wf->window_ctx(); SRCP srcp; +#if 0 // arguments vector funcParms; @@ -436,6 +438,7 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n // put ac on windowFuncList gwi.windowFuncList.push_back(ac); +#endif return ac; }