Merge pull request #2340 from taosdata/feature/query

Feature/query
This commit is contained in:
Shengliang Guan 2020-06-18 16:29:18 +08:00 committed by GitHub
commit c196808306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 471 additions and 458 deletions

View File

@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef TDENGINE_TSCSECONARYMERGE_H #ifndef TDENGINE_TSCLOCALMERGE_H
#define TDENGINE_TSCSECONARYMERGE_H #define TDENGINE_TSCLOCALMERGE_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -27,14 +27,7 @@ extern "C" {
#include "tsclient.h" #include "tsclient.h"
#define MAX_NUM_OF_SUBQUERY_RETRY 3 #define MAX_NUM_OF_SUBQUERY_RETRY 3
/*
* @version 0.1
* @date 2018/01/05
* @author liaohj
* management of client-side reducer for metric query
*/
struct SQLFunctionCtx; struct SQLFunctionCtx;
typedef struct SLocalDataSource { typedef struct SLocalDataSource {
@ -60,7 +53,6 @@ typedef struct SLocalReducer {
char * prevRowOfInput; char * prevRowOfInput;
tFilePage * pResultBuf; tFilePage * pResultBuf;
int32_t nResultBufSize; int32_t nResultBufSize;
// char * pBufForInterpo; // intermediate buffer for interpolation
tFilePage * pTempBuffer; tFilePage * pTempBuffer;
struct SQLFunctionCtx *pCtx; struct SQLFunctionCtx *pCtx;
int32_t rowSize; // size of each intermediate result. int32_t rowSize; // size of each intermediate result.
@ -81,13 +73,8 @@ typedef struct SLocalReducer {
} SLocalReducer; } SLocalReducer;
typedef struct SSubqueryState { typedef struct SSubqueryState {
/* int32_t numOfRemain; // the number of remain unfinished subquery
* the number of completed retrieval subquery, once this value equals to numOfVnodes, int32_t numOfTotal; // the number of total sub-queries
* all retrieval are completed.Local merge is launched.
*/
int32_t numOfCompleted;
int32_t numOfTotal; // number of total sub-queries
int32_t code; // code from subqueries
uint64_t numOfRetrievedRows; // total number of points in this query uint64_t numOfRetrievedRows; // total number of points in this query
} SSubqueryState; } SSubqueryState;
@ -128,4 +115,4 @@ int32_t tscDoLocalMerge(SSqlObj *pSql);
} }
#endif #endif
#endif // TDENGINE_TSCSECONARYMERGE_H #endif // TDENGINE_TSCLOCALMERGE_H

View File

@ -26,11 +26,9 @@ extern "C" {
void tscFetchDatablockFromSubquery(SSqlObj* pSql); void tscFetchDatablockFromSubquery(SSqlObj* pSql);
void tscSetupOutputColumnIndex(SSqlObj* pSql); void tscSetupOutputColumnIndex(SSqlObj* pSql);
int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql);
void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code); void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code);
SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index); SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index);
void tscDestroyJoinSupporter(SJoinSupporter* pSupporter);
int32_t tscHandleMasterJoinQuery(SSqlObj* pSql); int32_t tscHandleMasterJoinQuery(SSqlObj* pSql);

View File

@ -64,7 +64,8 @@ typedef struct SJoinSupporter {
SSubqueryState* pState; SSubqueryState* pState;
SSqlObj* pObj; // parent SqlObj SSqlObj* pObj; // parent SqlObj
int32_t subqueryIndex; // index of sub query int32_t subqueryIndex; // index of sub query
int64_t interval; // interval time int64_t intervalTime; // interval time
int64_t slidingTime; // sliding time
SLimitVal limit; // limit info SLimitVal limit; // limit info
uint64_t uid; // query meter uid uint64_t uid; // query meter uid
SArray* colList; // previous query information, no need to use this attribute, and the corresponding attribution SArray* colList; // previous query information, no need to use this attribute, and the corresponding attribution

File diff suppressed because it is too large Load Diff

View File

@ -1216,7 +1216,6 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl
// interval query with limit applied // interval query with limit applied
int32_t numOfRes = 0; int32_t numOfRes = 0;
if (isIntervalQuery(pQuery)) { if (isIntervalQuery(pQuery)) {
numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo); numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo);
} else { } else {

View File

@ -15,7 +15,6 @@
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -114,46 +114,46 @@ sql drop table tb
sql drop table mt sql drop table mt
sleep 3000 sleep 3000
## ALTER TABLE WHILE STREAMING [TBASE271] ### ALTER TABLE WHILE STREAMING [TBASE271]
sql create table tb1 (ts timestamp, c1 int, c2 nchar(5), c3 int) #sql create table tb1 (ts timestamp, c1 int, c2 nchar(5), c3 int)
sql create table strm as select count(*), avg(c1), first(c2), sum(c3) from tb1 interval(2s) #sql create table strm as select count(*), avg(c1), first(c2), sum(c3) from tb1 interval(2s)
sql select * from strm #sql select * from strm
if $rows != 0 then #if $rows != 0 then
return -1 # return -1
endi #endi
#sleep 12000 ##sleep 12000
sql insert into tb1 values (now, 1, 'taos', 1) #sql insert into tb1 values (now, 1, 'taos', 1)
sleep 20000 #sleep 20000
sql select * from strm #sql select * from strm
print rows = $rows #print rows = $rows
if $rows != 1 then #if $rows != 1 then
return -1 # return -1
endi #endi
if $data04 != 1 then #if $data04 != 1 then
return -1 # return -1
endi #endi
sql alter table tb1 drop column c3 #sql alter table tb1 drop column c3
sleep 6000 #sleep 6000
sql insert into tb1 values (now, 2, 'taos') #sql insert into tb1 values (now, 2, 'taos')
sleep 30000 #sleep 30000
sql select * from strm #sql select * from strm
if $rows != 2 then #if $rows != 2 then
return -1 # return -1
endi #endi
if $data04 != 1 then #if $data04 != 1 then
return -1 # return -1
endi #endi
sql alter table tb1 add column c3 int #sql alter table tb1 add column c3 int
sleep 6000 #sleep 6000
sql insert into tb1 values (now, 3, 'taos', 3); #sql insert into tb1 values (now, 3, 'taos', 3);
sleep 3000 #sleep 3000
sql select * from strm #sql select * from strm
if $rows != 3 then #if $rows != 3 then
return -1 # return -1
endi #endi
if $data04 != 1 then #if $data04 != 1 then
return -1 # return -1
endi #endi
## ALTER TABLE AND INSERT BY COLUMNS ## ALTER TABLE AND INSERT BY COLUMNS
sql create table mt (ts timestamp, c1 int, c2 int) tags(t1 int) sql create table mt (ts timestamp, c1 int, c2 int) tags(t1 int)

View File

@ -82,26 +82,22 @@ sleep 2000
run general/parser/groupby.sim run general/parser/groupby.sim
sleep 2000 sleep 2000
run general/parser/set_tag_vals.sim run general/parser/set_tag_vals.sim
sleep 2000 sleep 2000
run general/parser/slimit_alter_tags.sim # persistent failed run general/parser/slimit_alter_tags.sim # persistent failed
sleep 2000 sleep 2000
run general/parser/join.sim run general/parser/join.sim
sleep 2000 sleep 2000
run general/parser/join_multivnode.sim run general/parser/join_multivnode.sim
sleep 2000 sleep 2000
#run general/parser/repeatAlter.sim run general/parser/repeatAlter.sim
sleep 2000
#run general/parser/repeatStream.sim
sleep 2000 sleep 2000
run general/parser/binary_escapeCharacter.sim run general/parser/binary_escapeCharacter.sim
sleep 2000 sleep 2000
run general/parser/bug.sim run general/parser/bug.sim
sleep 2000 #sleep 2000
run general/parser/stream_on_sys.sim #run general/parser/repeatStream.sim
sleep 2000 #sleep 2000
run general/parser/stream.sim #run general/parser/stream_on_sys.sim
#sleep 2000
#run general/parser/stream.sim

View File

@ -324,7 +324,7 @@ cd ../../../debug; make
./test.sh -f unique/vnode/replica3_vgroup.sim ./test.sh -f unique/vnode/replica3_vgroup.sim
./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim ./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim
./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim ./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim
./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim ./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim
./test.sh -f unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim ./test.sh -f unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim
./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim ./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim