commit
d4455d1ec3
|
@ -1454,7 +1454,7 @@ static void addPrimaryTsColIntoResult(SQueryInfo* pQueryInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
SColumnIndex index = {0};
|
||||
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
||||
|
||||
// set the constant column value always attached to first table.
|
||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
|
@ -2432,6 +2432,8 @@ int32_t getTableIndexImpl(SStrToken* pTableToken, SQueryInfo* pQueryInfo, SColum
|
|||
if (pTableToken->n == 0) { // only one table and no table name prefix in column name
|
||||
if (pQueryInfo->numOfTables == 1) {
|
||||
pIndex->tableIndex = 0;
|
||||
} else {
|
||||
pIndex->tableIndex = COLUMN_INDEX_INITIAL_VAL;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -4187,7 +4189,7 @@ static void cleanQueryExpr(SCondExpr* pCondExpr) {
|
|||
static void doAddJoinTagsColumnsIntoTagList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondExpr* pCondExpr) {
|
||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
||||
if (QUERY_IS_JOIN_QUERY(pQueryInfo->type) && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
|
||||
SColumnIndex index = {0};
|
||||
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
||||
|
||||
if (getColumnIndexByName(pCmd, &pCondExpr->pJoinExpr->pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
||||
tscError("%p: invalid column name (left)", pQueryInfo);
|
||||
|
@ -4604,7 +4606,7 @@ int32_t parseOrderbyClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQu
|
|||
}
|
||||
|
||||
SStrToken columnName = {pVar->nLen, pVar->nType, pVar->pz};
|
||||
SColumnIndex index = {0};
|
||||
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
||||
|
||||
if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { // super table query
|
||||
if (getColumnIndexByName(pCmd, &columnName, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
||||
|
@ -6622,7 +6624,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS
|
|||
}
|
||||
}
|
||||
} else if (pSqlExpr->nSQLOptr == TK_ID) { // column name, normal column arithmetic expression
|
||||
SColumnIndex index = {0};
|
||||
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
||||
int32_t ret = getColumnIndexByName(pCmd, &pSqlExpr->colInfo, pQueryInfo, &index);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
return ret;
|
||||
|
|
|
@ -177,7 +177,7 @@ static void getNextTimeWindow(SQuery* pQuery, STimeWindow* tw) {
|
|||
static int32_t mergeIntoGroupResultImpl(SQInfo *pQInfo, SArray *group);
|
||||
|
||||
static void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult);
|
||||
static void setWindowResOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult);
|
||||
static void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult);
|
||||
static void resetMergeResultBuf(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx *pCtx, SResultRow *pRow);
|
||||
static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx *pCtx, int32_t functionId);
|
||||
|
||||
|
@ -618,7 +618,7 @@ static int32_t setWindowOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SWindowRes
|
|||
|
||||
// set time window for current result
|
||||
pResultRow->win = (*win);
|
||||
setWindowResOutputBufInitCtx(pRuntimeEnv, pResultRow);
|
||||
setResultRowOutputBufInitCtx(pRuntimeEnv, pResultRow);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -3839,7 +3839,7 @@ void setResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult) {
|
|||
}
|
||||
}
|
||||
|
||||
void setWindowResOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult) {
|
||||
void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResult) {
|
||||
SQuery *pQuery = pRuntimeEnv->pQuery;
|
||||
|
||||
// Note: pResult->pos[i]->num == 0, there is only fixed number of results for each group
|
||||
|
|
|
@ -203,10 +203,13 @@ endi
|
|||
|
||||
# this function will cause shell crash
|
||||
sql_error select count(join_mt0.c1), first(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1 order by join_mt0.ts desc;
|
||||
|
||||
sql_error select last(join_mt1.c7), first(join_mt1.c7) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10m) group by join_mt0.t1 order by join_mt0.ts asc;
|
||||
|
||||
sql_error select last(join_mt1.c7), first(join_mt1.c7) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10m) group by join_mt0.t1 order by join_mt0.ts asc;
|
||||
sql_error select count(join_mt0.c1), first(join_mt0.c1)-last(join_mt1.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts;", NULL);
|
||||
|
||||
print ================================> TD-2152
|
||||
sql_error select join_mt1.c1,join_mt0.c1 from join_mt1,join_mt0 where join_mt1.ts = join_mt0.ts and join_mt1.t1 = join_mt0.t1 order by t;
|
||||
|
||||
print =================================> add result check
|
||||
sql select count(join_mt0.c1), first(join_mt0.c1)/count(*), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts;", NULL);
|
||||
sql select count(join_mt0.c1), first(join_mt0.c1)-last(join_mt0.c1), first(join_mt1.c9) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts;", NULL);
|
||||
sql select last(join_mt0.c1) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts;", NULL);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
sleep 500
|
||||
run general/parser/alter.sim
|
||||
sleep 500
|
||||
run general/parser/alter1.sim
|
||||
|
|
Loading…
Reference in New Issue