1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

Merge branch 'develop-1.1' into 1.1-merge-up-20180509-a2

This commit is contained in:
Andrew Hutchings
2018-05-09 09:20:55 +01:00
20 changed files with 3430 additions and 3306 deletions

View File

@@ -850,14 +850,14 @@ static const yytype_uint8 yydefact[] =
static const yytype_int16 yydefgoto[] =
{
-1, 5, 6, 7, 8, 33, 9, 10, 320, 11,
29, 12, 96, 97, 98, 66, 104, 105, 141, 106,
107, 371, 372, 375, 376, 382, 385, 377, 378, 391,
321, 276, 13, 43, 44, 45, 46, 47, 48, 49,
25, 26, 50, 142, 68, 252, 99, 194, 253, 129,
254, 255, 167, 168, 219, 220, 169, 256, 257, 152,
130, 131, 132, 133, 178, 172, 134, 190, 304, 135,
185, 237, 51, 145, 52, 71
};
29, 12, 96, 97, 98, 66, 104, 105, 141, 106,
107, 371, 372, 375, 376, 382, 385, 377, 378, 391,
321, 276, 13, 43, 44, 45, 46, 47, 48, 49,
25, 26, 50, 142, 68, 252, 99, 194, 253, 129,
254, 255, 167, 168, 219, 220, 169, 256, 257, 152,
130, 131, 132, 133, 178, 172, 134, 190, 304, 135,
185, 237, 51, 145, 52, 71
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
@@ -910,14 +910,14 @@ static const yytype_int16 yypact[] =
static const yytype_int16 yypgoto[] =
{
-270, -270, -270, 331, -270, -270, -270, -270, 26, -270,
-270, -270, 62, 218, 336, 314, 287, -270, -136, -270,
-270, -270, 11, -270, -270, -270, -270, 6, 1, 7,
175, -269, -270, -270, -28, -270, -270, -270, -270, -270,
-29, 5, -270, -23, -70, -183, 79, -270, -175, -74,
-179, -223, -157, -270, -270, -270, 216, 90, -5, -202,
-270, -270, -270, -270, 161, 116, -270, 166, -270, -270,
-270, -270, -270, 119, -270, -270
};
-270, -270, 62, 218, 336, 314, 287, -270, -136, -270,
-270, -270, 11, -270, -270, -270, -270, 6, 1, 7,
175, -269, -270, -270, -28, -270, -270, -270, -270, -270,
-29, 5, -270, -23, -70, -183, 79, -270, -175, -74,
-179, -223, -157, -270, -270, -270, 216, 90, -5, -202,
-270, -270, -270, -270, 161, 116, -270, 166, -270, -270,
-270, -270, -270, 119, -270, -270
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which

View File

@@ -18,6 +18,7 @@
/* $Id: ddl.l 9341 2013-03-27 14:10:35Z chao $ */
%{
#include <string.h>
#include <iostream>
#include <vector>
#include <stdio.h>
@@ -31,7 +32,7 @@
#endif
using namespace ddlpackage;
typedef enum { NOOP, STRIP_QUOTES } copy_action_t;
typedef enum { NOOP, STRIP_QUOTES, STRIP_QUOTES_FQ } copy_action_t;
int lineno = 1;
void ddlerror(struct pass_to_bison* x, char const *s);
@@ -71,8 +72,10 @@ identifier {ident_start}{ident_cont}*
extended_identifier {ident_start}{extended_ident_cont}*
/* fully qualified names regexes */
fq_identifier {identifier}\.{identifier}
identifer_quoted {grave_accent}{extended_identifier}{grave_accent}
identifer_double_quoted {double_quote}{extended_identifier}{double_quote}
identifier_quoted {grave_accent}{extended_identifier}{grave_accent}
identifier_double_quoted {double_quote}{extended_identifier}{double_quote}
fq_quoted ({identifier_quoted}|{extended_identifier})\.({identifier_quoted}|{identifier})
fq_double_quoted ({identifier_double_quoted}|{extended_identifier})\.({identifier_double_quoted}|{identifier})
integer [-+]?{digit}+
decimal ([-+]?({digit}*\.{digit}+)|({digit}+\.{digit}*))
@@ -84,9 +87,11 @@ realfail2 ({integer}|{decimal})[Ee][-+]
%%
{identifer_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return IDENT; }
{identifer_double_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return IDENT; }
{identifier_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return IDENT; }
{identifier_double_quoted} { ddlget_lval(yyscanner)->str = scanner_copy( ddlget_text(yyscanner), yyscanner, STRIP_QUOTES ); return IDENT; }
{fq_identifier} { ddlget_lval(yyscanner)->str = scanner_copy(ddlget_text(yyscanner), yyscanner); return FQ_IDENT; }
{fq_quoted} { ddlget_lval(yyscanner)->str = scanner_copy(ddlget_text(yyscanner), yyscanner, STRIP_QUOTES_FQ); return FQ_IDENT; }
{fq_double_quoted} { ddlget_lval(yyscanner)->str = scanner_copy(ddlget_text(yyscanner), yyscanner, STRIP_QUOTES_FQ); return FQ_IDENT; }
ACTION {return ACTION;}
ADD {return ADD;}
@@ -281,6 +286,57 @@ char* scanner_copy (char *str, yyscan_t yyscanner, copy_action_t action)
nv[strlen(str) - 1] = '\0';
result = nv + 1;
}
else if (action == STRIP_QUOTES_FQ)
{
bool move_left = false;
bool move_right = false;
char* left = nv;
char* tmp_first = nv;
// MCOL-1384 Loop through all comas in this quoted fq id
// looking for $quote_sign.$quote_sign sequence.
char* fq_delimiter;
int tmp_pos = 0;
while((fq_delimiter = strchr(tmp_first, '.')) != NULL)
{
if( (*(fq_delimiter -1) == '`' && *(fq_delimiter + 1) == '`') ||
(*(fq_delimiter -1) == '"' && *(fq_delimiter + 1) == '"') )
{
tmp_pos += fq_delimiter - tmp_first;
break;
}
tmp_first = fq_delimiter;
}
char* fq_delimiter_orig = str + tmp_pos;
char* right = fq_delimiter + 1;
char* right_orig = fq_delimiter_orig + 1;
// MCOL-1384 Strip quotes from the left part.
if(*left == '"' || *left == '`')
{
result = left + 1;
*(fq_delimiter - 1) = '.';
move_left = true;
}
else
{
fq_delimiter += 1;
}
int right_length = strlen(right);
// MCOL-1384 Strip quotes from the right part.
if(*right == '`' || *right == '"')
{
right += 1; right_orig += 1;
right_length -= 2;
move_right = true;
*(fq_delimiter + right_length) = '\0';
}
if(move_left || move_right)
{
strncpy(fq_delimiter, right_orig, right_length);
}
}
return result;
}

View File

@@ -866,16 +866,16 @@ static const yytype_uint8 yydefact[] =
static const yytype_int16 yydefgoto[] =
{
-1, 13, 14, 15, 128, 129, 130, 131, 295, 296,
297, 358, 378, 298, 155, 132, 360, 105, 133, 363,
180, 181, 182, 338, 339, 16, 188, 268, 269, 304,
17, 18, 19, 20, 21, 22, 23, 158, 253, 254,
24, 25, 26, 31, 27, 108, 109, 28, 101, 102,
99, 136, 137, 138, 61, 170, 171, 214, 215, 100,
261, 318, 290, 143, 144, 145, 146, 147, 282, 148,
149, 278, 150, 243, 151, 192, 152, 63, 64, 65,
66, 67, 216, 44, 68, 335, 156, 33, 69, 259,
340, 80
};
297, 358, 378, 298, 155, 132, 360, 105, 133, 363,
180, 181, 182, 338, 339, 16, 188, 268, 269, 304,
17, 18, 19, 20, 21, 22, 23, 158, 253, 254,
24, 25, 26, 31, 27, 108, 109, 28, 101, 102,
99, 136, 137, 138, 61, 170, 171, 214, 215, 100,
261, 318, 290, 143, 144, 145, 146, 147, 282, 148,
149, 278, 150, 243, 151, 192, 152, 63, 64, 65,
66, 67, 216, 44, 68, 335, 156, 33, 69, 259,
340, 80
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
@@ -930,16 +930,16 @@ static const yytype_int16 yypact[] =
static const yytype_int16 yypgoto[] =
{
-270, -270, 489, -270, -270, -270, 375, -270, -270, 179,
-270, -270, -270, -270, -269, -270, -270, -163, -270, -270,
-270, -270, 281, -270, 145, -270, -270, -270, 204, 240,
-270, -270, -270, -270, -270, -270, -270, -270, -270, 226,
-270, -270, -270, -131, -270, -270, 354, -270, 427, 359,
-56, 386, -136, -103, -170, -216, -270, -270, 255, -270,
-270, -270, -270, -134, -270, -270, -270, -270, 242, -270,
-270, 244, -270, -270, -270, 8, -24, -270, -189, 61,
-270, 140, -11, 484, -97, -270, -72, 4, 47, -270,
449, 443
};
-270, -270, -270, -270, -269, -270, -270, -163, -270, -270,
-270, -270, 281, -270, 145, -270, -270, -270, 204, 240,
-270, -270, -270, -270, -270, -270, -270, -270, -270, 226,
-270, -270, -270, -131, -270, -270, 354, -270, 427, 359,
-56, 386, -136, -103, -170, -216, -270, -270, 255, -270,
-270, -270, -270, -134, -270, -270, -270, -270, 242, -270,
-270, 244, -270, -270, -270, 8, -24, -270, -189, 61,
-270, 140, -11, 484, -97, -270, -72, 4, 47, -270,
449, 443
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which

View File

@@ -487,23 +487,25 @@ void adjustLastStep(JobStepVector& querySteps, DeliveredTableMap& deliverySteps,
// (jobInfo.constantCol == CONST_COL_EXIST) ||
// (jobInfo.hasDistinct))
// {
if (jobInfo.annexStep.get() == NULL)
jobInfo.annexStep.reset(new TupleAnnexStep(jobInfo));
if (jobInfo.annexStep.get() == NULL)
jobInfo.annexStep.reset(new TupleAnnexStep(jobInfo));
TupleAnnexStep* tas = dynamic_cast<TupleAnnexStep*>(jobInfo.annexStep.get());
tas->setLimit(jobInfo.limitStart, jobInfo.limitCount);
TupleAnnexStep* tas = dynamic_cast<TupleAnnexStep*>(jobInfo.annexStep.get());
tas->setLimit(jobInfo.limitStart, jobInfo.limitCount);
// if (jobInfo.limitCount != (uint64_t) - 1)
// if (jobInfo.limitCount != (uint64_t) - 1)
// {
if (jobInfo.orderByColVec.size() > 0)
tas->addOrderBy(new LimitedOrderBy());
if (jobInfo.orderByColVec.size() > 0)
tas->addOrderBy(new LimitedOrderBy());
// }
if (jobInfo.constantCol == CONST_COL_EXIST)
tas->addConstant(new TupleConstantStep(jobInfo));
if (jobInfo.constantCol == CONST_COL_EXIST)
tas->addConstant(new TupleConstantStep(jobInfo));
if (jobInfo.hasDistinct)
tas->setDistinct();
if (jobInfo.hasDistinct)
tas->setDistinct();
// }
if (jobInfo.annexStep)

View File

@@ -76,12 +76,14 @@ void LimitedOrderBy::initialize(const RowGroup& rg, const JobInfo& jobInfo)
{
map<uint32_t, uint32_t>::iterator j = keyToIndexMap.find(i->first);
idbassert(j != keyToIndexMap.end());
// MCOL-1052 Ordering direction in CSEP differs from
// internal direction representation.
if (i->second)
fOrderByCond.push_back(IdbSortSpec(j->second, false));
else
fOrderByCond.push_back(IdbSortSpec(j->second, true));
//fOrderByCond.push_back(IdbSortSpec(j->second, i->second));
}
@@ -181,7 +183,7 @@ void LimitedOrderBy::finalize()
fDataQueue.push(fData);
// MCOL-1052 The removed check effectivly disables sorting to happen,
// since fStart = 0;
// since fStart = 0;
if (true)
{
uint64_t newSize = fRowsPerRG * fRowGroup.getRowSize();

View File

@@ -1304,7 +1304,7 @@ void TupleAggregateStep::prep1PhaseAggregate(
{
throw logic_error("prep1PhaseAggregate: A UDAF function is called but there's no/not enough UDAFColumn/-s");
}
}
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colProj, i));

View File

@@ -123,8 +123,8 @@ static int calpont_rollback(handlerton* hton, THD* thd, bool all);
static int calpont_close_connection ( handlerton* hton, THD* thd );
handlerton* calpont_hton;
static group_by_handler *
create_calpont_group_by_handler(THD *thd, Query *query);
static group_by_handler*
create_calpont_group_by_handler(THD* thd, Query* query);
/* Variables for example share methods */
@@ -1142,7 +1142,7 @@ static MYSQL_SYSVAR_ULONG(
/*@brief create_calpont_group_by_handler- Creates handler*/
/***********************************************************
* DESCRIPTION:
* Creates a group_by pushdown handler.
* Creates a group_by pushdown handler.
* Details are in server/sql/group_by_handler.h
* PARAMETERS:
* thd - THD pointer.
@@ -1151,21 +1151,21 @@ static MYSQL_SYSVAR_ULONG(
* group_by_handler if success
* NULL in other case
***********************************************************/
static group_by_handler *
create_calpont_group_by_handler(THD *thd, Query *query)
static group_by_handler*
create_calpont_group_by_handler(THD* thd, Query* query)
{
ha_calpont_group_by_handler *handler = NULL;
ha_calpont_group_by_handler* handler = NULL;
if ( thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE )
{
handler = new ha_calpont_group_by_handler(thd, query);
// Notify the server, that CS handles GROUP BY, ORDER BY and HAVING clauses.
// Notify the server, that CS handles GROUP BY, ORDER BY and HAVING clauses.
query->group_by = NULL;
query->order_by = NULL;
query->having = NULL;
}
return handler;
}

View File

@@ -251,13 +251,13 @@ public:
/*@brief group_by_handler class*/
/***********************************************************
* DESCRIPTION:
* Provides server with group_by_handler API methods.
* Provides server with group_by_handler API methods.
* One should read comments in server/sql/group_by_handler.h
* Attributes:
* select - attribute contains all GROUP BY, HAVING, ORDER items and calls it
* an extended SELECT list accordin to comments in
* server/sql/group_handler.cc.
* So the temporary table for
* select - attribute contains all GROUP BY, HAVING, ORDER items and calls it
* an extended SELECT list accordin to comments in
* server/sql/group_handler.cc.
* So the temporary table for
* select count(*) from b group by a having a > 3 order by a
* will have 4 columns not 1.
* However server ignores all NULLs used in GROUP BY, HAVING, ORDER.
@@ -274,29 +274,29 @@ public:
***********************************************************/
class ha_calpont_group_by_handler: public group_by_handler
{
public:
ha_calpont_group_by_handler(THD *thd_arg, Query *query)
: group_by_handler(thd_arg, calpont_hton),
select(query->select),
table_list(query->from),
distinct(query->distinct),
where(query->where),
group_by(query->group_by),
order_by(query->order_by),
having(query->having)
{ }
~ha_calpont_group_by_handler() { }
int init_scan();
int next_row();
int end_scan();
public:
ha_calpont_group_by_handler(THD* thd_arg, Query* query)
: group_by_handler(thd_arg, calpont_hton),
select(query->select),
table_list(query->from),
distinct(query->distinct),
where(query->where),
group_by(query->group_by),
order_by(query->order_by),
having(query->having)
{ }
~ha_calpont_group_by_handler() { }
int init_scan();
int next_row();
int end_scan();
List<Item> *select;
TABLE_LIST *table_list;
bool distinct;
Item *where;
ORDER *group_by;
ORDER *order_by;
Item *having;
List<Item>* select;
TABLE_LIST* table_list;
bool distinct;
Item* where;
ORDER* group_by;
ORDER* order_by;
Item* having;
};
#endif //HA_CALPONT_H__

View File

@@ -174,10 +174,6 @@ uint32_t convertDataType(int dataType)
calpontDataType = CalpontSystemCatalog::DATETIME;
break;
case ddlpackage::DDL_TIME:
calpontDataType = CalpontSystemCatalog::TIME;
break;
case ddlpackage::DDL_CLOB:
calpontDataType = CalpontSystemCatalog::CLOB;
break;
@@ -1872,20 +1868,16 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& tabl
if (ddlStatement.find("AUTO_INCREMENT") != string::npos)
{
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "Use of the MySQL auto_increment syntax is not supported in Columnstore. If you wish to create an auto increment column in Columnstore, please consult the Columnstore SQL Syntax Guide for the correct usage.");
}
// MCOL-867. MariaDB RENAME TABLE statement supports WAIT|NOWAIT options since 10.3.0 but Columnstore isn't yet.
else if (ddlStatement.find("WAIT") != string::npos || ddlStatement.find("NOWAIT") != string::npos)
{
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "WAIT and NOWAIT options are not supported in Columnstore. Please consult the Columnstore SQL Syntax Guide for the correct usage.");
ci->alterTableState = cal_connection_info::NOT_ALTER;
ci->isAlter = false;
}
else
{
//@Bug 1888,1885. update error message
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types.");
ci->alterTableState = cal_connection_info::NOT_ALTER;
ci->isAlter = false;
}
ci->alterTableState = cal_connection_info::NOT_ALTER;
ci->isAlter = false;
}
return rc;
@@ -2187,7 +2179,6 @@ int ha_calpont_impl_rename_table_(const char* from, const char* to, cal_connecti
THD* thd = current_thd;
string emsg;
ostringstream stmt1;
pair<string, string> fromPair;
pair<string, string> toPair;
string stmt;
@@ -2215,20 +2206,21 @@ int ha_calpont_impl_rename_table_(const char* from, const char* to, cal_connecti
return -1;
}
stmt1 << "alter table " << fromPair.second << " rename to " << toPair.second << ";";
stmt = stmt1.str();
// This explicitely shields both db objects with quotes that the lexer strips down later.
stmt = "alter table `" + fromPair.second + "` rename to `" + toPair.second + "`;";
string db;
if ( fromPair.first.length() != 0 )
db = fromPair.first;
else if ( thd->db )
if ( thd->db )
db = thd->db;
else if ( fromPair.first.length() != 0 )
db = fromPair.first;
else
db = toPair.first;
int rc = ProcessDDLStatement(stmt, db, "", tid2sid(thd->thread_id), emsg);
if (rc != 0)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, emsg.c_str());
push_warning(thd, Sql_condition::WARN_LEVEL_ERROR, 9999, emsg.c_str());
return rc;
}

File diff suppressed because it is too large Load Diff

View File

@@ -427,7 +427,7 @@ int vbin2hex(const uint8_t* p, const unsigned l, char* o)
return 0;
}
int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool handler_flag=false)
int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool handler_flag = false)
{
int rc = HA_ERR_END_OF_FILE;
int num_attr = ti.msTablePtr->s->fields;
@@ -469,6 +469,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
{
Field** f;
f = ti.msTablePtr->field;
//set all fields to null in null col bitmap
if (!handler_flag)
memset(buf, -1, ti.msTablePtr->s->null_bytes);
@@ -476,6 +477,7 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
{
memset(ti.msTablePtr->null_flags, -1, ti.msTablePtr->s->null_bytes);
}
std::vector<CalpontSystemCatalog::ColType>& colTypes = ti.tpl_scan_ctx->ctp;
int64_t intColVal = 0;
uint64_t uintColVal = 0;
@@ -5074,7 +5076,7 @@ int ha_calpont_impl_rnd_pos(uchar* buf, uchar* pos)
return ER_INTERNAL_ERROR;
}
/*@brief ha_calpont_impl_group_by_init - Get data for MariaDB group_by
/*@brief ha_calpont_impl_group_by_init - Get data for MariaDB group_by
pushdown handler */
/***********************************************************
* DESCRIPTION:
@@ -5132,8 +5134,8 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
setError(thd, ER_CHECK_NOT_IMPLEMENTED, "This stored procedure syntax is not supported by Columnstore in this version");
thd->infinidb_vtable.vtable_state = THD::INFINIDB_ERROR;
return ER_INTERNAL_ERROR;
}
}
uint32_t sessionID = tid2sid(thd->thread_id);
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
csc->identity(CalpontSystemCatalog::FE);
@@ -5145,9 +5147,9 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
idbassert(ci != 0);
// MySQL sometimes calls rnd_init multiple times, plan should only be
// generated and sent once.
// generated and sent once.
if (thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE &&
!thd->infinidb_vtable.isNewQuery)
return 0;
@@ -5183,7 +5185,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
sm::cpsm_conhdl_t* hndl;
SCSEP csep;
bool localQuery = (thd->variables.infinidb_local_query > 0 ? true : false);
bool localQuery = (thd->variables.infinidb_local_query > 0 ? true : false);
{
ci->stats.reset(); // reset query stats
@@ -5213,7 +5215,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
sm::sm_cleanup(ci->cal_conn_hndl);
ci->cal_conn_hndl = 0;
}
sm::sm_init(sessionID, &ci->cal_conn_hndl, localQuery);
idbassert(ci->cal_conn_hndl != 0);
ci->cal_conn_hndl->csc = csc;
@@ -5256,7 +5258,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
csep->schemaName(group_hand->table_list->db);
csep->traceFlags(ci->traceFlags);
// MCOL-1052 Send Items lists down to the optimizer.
gi.groupByTables = group_hand->table_list;
gi.groupByFields = group_hand->select;
@@ -5265,7 +5267,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
gi.groupByOrder = group_hand->order_by;
gi.groupByHaving = group_hand->having;
gi.groupByDistinct = group_hand->distinct;
// MCOL-1052 Send pushed conditions here, since server could omit GROUP BY
// items in case of = or IN functions used on GROUP BY columns.
{
@@ -5274,15 +5276,17 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
execplan::CalpontSelectExecutionPlan::ColumnMap::iterator condColMapIter;
execplan::ParseTree* ptIt;
execplan::ReturnedColumn* rcIt;
for(TABLE_LIST* tl = gi.groupByTables; tl; tl=tl->next_local)
for (TABLE_LIST* tl = gi.groupByTables; tl; tl = tl->next_local)
{
mapiter = ci->tableMap.find(tl->table);
if(mapiter != ci->tableMap.end() && mapiter->second.condInfo != NULL
&& mapiter->second.condInfo->condPush)
if (mapiter != ci->tableMap.end() && mapiter->second.condInfo != NULL
&& mapiter->second.condInfo->condPush)
{
while(!mapiter->second.condInfo->ptWorkStack.empty())
while (!mapiter->second.condInfo->ptWorkStack.empty())
{
ptIt=mapiter->second.condInfo->ptWorkStack.top();
ptIt = mapiter->second.condInfo->ptWorkStack.top();
mapiter->second.condInfo->ptWorkStack.pop();
gi.pushedPts.push_back(ptIt);
}
@@ -5316,14 +5320,14 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, msg.c_str());
}
#ifdef PLAN_HEX_FILE
#ifdef PLAN_HEX_FILE
// plan serialization
ifstream ifs("/tmp/li1-plan.hex");
ByteStream bs1;
ifs >> bs1;
ifs.close();
csep->unserialize(bs1);
#endif
#endif
if (ci->traceFlags & 1)
{
@@ -5338,7 +5342,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
IDEBUG( cout << "-------------- EXECUTION PLAN END --------------\n" << endl );
}
}// end of execution plan generation
{
ByteStream msg;
ByteStream emsgBs;
@@ -5569,10 +5573,10 @@ internal_error:
ci->cal_conn_hndl = 0;
}
return ER_INTERNAL_ERROR;
return ER_INTERNAL_ERROR;
}
/*@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
pushdown handler
*/
/***********************************************************
@@ -5588,7 +5592,7 @@ internal_error:
***********************************************************/
int ha_calpont_impl_group_by_next(ha_calpont_group_by_handler* group_hand, TABLE* table)
{
THD* thd = current_thd;
THD* thd = current_thd;
/* If this node is the slave, ignore DML to IDB tables */
if (thd->slave_thread && (
@@ -5697,7 +5701,7 @@ int ha_calpont_impl_group_by_next(ha_calpont_group_by_handler* group_hand, TABLE
emsg = errorcodes.errorString(rc);
}
setError(thd, ER_INTERNAL_ERROR, emsg);
setError(thd, ER_INTERNAL_ERROR, emsg);
ci->stats.fErrorNo = rc;
CalpontSystemCatalog::removeCalpontSystemCatalog(tid2sid(thd->thread_id));
rc = ER_INTERNAL_ERROR;
@@ -5806,7 +5810,7 @@ int ha_calpont_impl_group_by_end(ha_calpont_group_by_handler* group_hand, TABLE*
cal_table_info ti = ci->tableMap[table];
sm::cpsm_conhdl_t* hndl;
hndl = ci->cal_conn_hndl;
hndl = ci->cal_conn_hndl;
if (ti.tpl_ctx)
{

View File

@@ -194,14 +194,14 @@ struct cal_table_info
struct cal_group_info
{
cal_group_info() : groupByFields(0),
cal_group_info() : groupByFields(0),
groupByTables(0),
groupByWhere(0),
groupByGroup(0),
groupByOrder(0),
groupByHaving(0),
groupByDistinct(false)
{ }
{ }
~cal_group_info() { }
List<Item>* groupByFields; // MCOL-1052 SELECT

View File

@@ -512,12 +512,13 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
{
Item* orderItem = *(orderCol->item);
srcp.reset(buildReturnedColumn(orderItem, gwi, nonSupport));
// MCOL-1052 GROUP BY handler has all of query's agg Items
// as field and correlates them with its extended SELECT Items.
// as field and correlates them with its extended SELECT Items.
if (!srcp)
{
orderItem = orderCol->item_ptr;
orderItem = orderCol->item_ptr;
if (orderItem)
{
gwi.fatalParseError = false;

View File

@@ -27,6 +27,8 @@
#include <boost/shared_ptr.hpp>
#include "calpontsystemcatalog.h"
#include "dataconvert.h"
#include "exceptclasses.h"
using namespace logging;
// Required declaration as it isn't in a MairaDB include
@@ -70,7 +72,25 @@ static int is_columnstore_columns_fill(THD* thd, TABLE_LIST* tables, COND* cond)
for (std::vector<std::pair<execplan::CalpontSystemCatalog::OID, execplan::CalpontSystemCatalog::TableName> >::const_iterator it = catalog_tables.begin();
it != catalog_tables.end(); ++it)
{
execplan::CalpontSystemCatalog::RIDList column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true);
execplan::CalpontSystemCatalog::RIDList column_rid_list;
// Note a table may get dropped as you iterate over the list of tables.
// So simply ignore the dropped table.
try
{
column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true);
}
catch (IDBExcept& ex)
{
if (ex.errorCode() == ERR_TABLE_NOT_IN_CATALOG)
{
continue;
}
else
{
return 1;
}
}
for (size_t col_num = 0; col_num < column_rid_list.size(); col_num++)
{

View File

@@ -145,7 +145,7 @@ status_t tpl_scan_fetch_getband(cpsm_conhdl_t* hndl, sp_cpsm_tplsch_t& ntplsch,
if (ntplsch->bs.length() != 0)
{
ntplsch->deserializeTable(ntplsch->bs);
if (ntplsch->rowGroup && ntplsch->rowGroup->getRGData() == NULL)
{
ntplsch->bs.restart();