diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index b99a8a46d0874ee57d338389bde864fc1c9ae514..f687d7f244a42e255817a278e6169ce294788a38 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -176,8 +176,6 @@ SColumn* tscColumnListInsert(SArray* pColList, SColumnIndex* colIndex); SArray* tscColumnListClone(const SArray* src, int16_t tableIndex); void tscColumnListDestroy(SArray* pColList); -SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters); - int32_t tscValidateName(SSQLToken* pToken); void tscIncStreamExecutionCount(void* pStream); diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 6ce94d5aa4d10688d7f92dfe2c9ccbfc8852bc9d..75ca4b62408fad1c8eada83ba2c7c0c9b1d71d72 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -32,8 +32,8 @@ extern "C" { #include "qExecutor.h" #include "qsqlparser.h" -#include "qsqltype.h" #include "qtsbuf.h" +#include "tcmdtype.h" // forward declaration struct SSqlInfo; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index e85ade60e509373dd52a37e8774a6bca1c7b9d56..1b2334b99815ab44a382df90fb7d298b545f504d 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -14,8 +14,8 @@ */ #include "os.h" -#include "qsqltype.h" #include "tcache.h" +#include "tcmdtype.h" #include "trpc.h" #include "tscLocalMerge.h" #include "tscLog.h" diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 26a81c597f077e5101b3920e792c650d00ca50f3..9b6eff71232f609c18d02ab34c0c3d2ccf76312d 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1115,31 +1115,6 @@ SColumn* tscColumnListInsert(SArray* pColumnList, SColumnIndex* pColIndex) { return taosArrayGetP(pColumnList, i); } -SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters) { - if (numOfFilters == 0) { - assert(src == NULL); - return NULL; - } - - SColumnFilterInfo* pFilter = calloc(1, numOfFilters * sizeof(SColumnFilterInfo)); - - memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters); - for (int32_t j = 0; j < numOfFilters; ++j) { - - if (pFilter[j].filterstr) { - size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE; - pFilter[j].pz = (int64_t) calloc(1, len); - - memcpy((char*)pFilter[j].pz, (char*)src[j].pz, (size_t)len); - } - } - - assert(src->filterstr == 0 || src->filterstr == 1); - assert(!(src->lowerRelOptr == TSDB_RELATION_INVALID && src->upperRelOptr == TSDB_RELATION_INVALID)); - - return pFilter; -} - static void destroyFilterInfo(SColumnFilterInfo* pFilterInfo, int32_t numOfFilters) { for(int32_t i = 0; i < numOfFilters; ++i) { if (pFilterInfo[i].filterstr) { diff --git a/src/common/inc/qsqltype.h b/src/common/inc/tcmdtype.h similarity index 97% rename from src/common/inc/qsqltype.h rename to src/common/inc/tcmdtype.h index 6f6493d17ca8b3a3c180332a728d0529dc6d474a..90fb5bf47854313a67e395eea7b99a992a579889 100644 --- a/src/common/inc/qsqltype.h +++ b/src/common/inc/tcmdtype.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_QSQLCMD_H -#define TDENGINE_QSQLCMD_H +#ifndef TDENGINE_TSQLMSGTYPE_H +#define TDENGINE_TSQLMSGTYPE_H #ifdef __cplusplus extern "C" { @@ -109,4 +109,4 @@ extern char *sqlCmd[]; } #endif -#endif // TDENGINE_QSQLCMD_H +#endif // TDENGINE_TSQLMSGTYPE_H diff --git a/src/common/inc/tname.h b/src/common/inc/tname.h index d2008c9ff8181b54db83fdd92f777ba74489ce73..10d725db32102576837621c0dc50a822ba9a0104 100644 --- a/src/common/inc/tname.h +++ b/src/common/inc/tname.h @@ -27,4 +27,6 @@ SSchema tGetTableNameColumnSchema(); bool tscValidateTableNameLength(size_t len); +SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters); + #endif // TDENGINE_NAME_H diff --git a/src/common/src/sqlcmdstr.c b/src/common/src/sqlcmdstr.c index 8584ba79761835989ab7a3e24d88824c14d107c5..672106523e7c7eab8c606db1940dd9485e7f4c8f 100644 --- a/src/common/src/sqlcmdstr.c +++ b/src/common/src/sqlcmdstr.c @@ -15,4 +15,4 @@ #define TSDB_SQL_C -#include "qsqltype.h" +#include "tcmdtype.h" diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 2514ed26e55e54eddf54d83933beecdfbf4e06fa..295015d466456843c5ec149763d96edc2029f864 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -49,4 +49,29 @@ SSchema tGetTableNameColumnSchema() { bool tscValidateTableNameLength(size_t len) { return len < TSDB_TABLE_NAME_LEN; -} \ No newline at end of file +} + +SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters) { + if (numOfFilters == 0) { + assert(src == NULL); + return NULL; + } + + SColumnFilterInfo* pFilter = calloc(1, numOfFilters * sizeof(SColumnFilterInfo)); + + memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters); + for (int32_t j = 0; j < numOfFilters; ++j) { + + if (pFilter[j].filterstr) { + size_t len = (size_t) pFilter[j].len + 1 * TSDB_NCHAR_SIZE; + pFilter[j].pz = (int64_t) calloc(1, len); + + memcpy((char*)pFilter[j].pz, (char*)src[j].pz, (size_t)len); + } + } + + assert(src->filterstr == 0 || src->filterstr == 1); + assert(!(src->lowerRelOptr == TSDB_RELATION_INVALID && src->upperRelOptr == TSDB_RELATION_INVALID)); + + return pFilter; +} diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index d7d59230b65bff91d28f42e732a54acb176019f7..f29bd017362d8ae56376724f1ab0930cb074bcaa 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -95,16 +95,13 @@ typedef struct SSingleColumnFilterInfo { } SSingleColumnFilterInfo; typedef struct STableQueryInfo { // todo merge with the STableQueryInfo struct - int32_t tableIndex; - int32_t groupIndex; // group id in table list TSKEY lastKey; - int32_t numOfRes; + int32_t groupIndex; // group id in table list int16_t queryRangeSet; // denote if the query range is set, only available for interval query int64_t tag; STimeWindow win; STSCursor cur; - void* pTable; // for retrieve the page id list - + void* pTable; // for retrieve the page id list SWindowResInfo windowResInfo; } STableQueryInfo; @@ -127,11 +124,6 @@ typedef struct SQueryCostInfo { uint64_t computTime; } SQueryCostInfo; -//typedef struct SGroupItem { -// void *pTable; -// STableQueryInfo *info; -//} SGroupItem; - typedef struct SQuery { int16_t numOfCols; int16_t numOfTags; @@ -173,12 +165,12 @@ typedef struct SQueryRuntimeEnv { STSBuf* pTSBuf; STSCursor cur; SQueryCostInfo summary; - bool stableQuery; // super table query or not void* pQueryHandle; void* pSecQueryHandle; // another thread for - SDiskbasedResultBuf* pResultBuf; // query result buffer based on blocked-wised disk file + bool stableQuery; // super table query or not bool topBotQuery; // false int32_t prevGroupId; // previous executed group id + SDiskbasedResultBuf* pResultBuf; // query result buffer based on blocked-wised disk file } SQueryRuntimeEnv; typedef struct SQInfo { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index f33d739ba1f41e22c90ee33f6cc6133febbe0bee..5e3a7b2abd529c603cf19a62cc02244e933b06fb 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ #include "os.h" +#include "taosmsg.h" #include "qfill.h" #include "hash.h" @@ -22,9 +23,8 @@ #include "qresultBuf.h" #include "query.h" #include "queryLog.h" -#include "taosmsg.h" #include "tlosertree.h" -#include "tscUtil.h" // todo move the function to common module +#include "exception.h" #include "tscompression.h" #include "ttime.h" @@ -5656,7 +5656,6 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList, STableQueryInfo* item = createTableQueryInfo(&pQInfo->runtimeEnv, pTable, window); item->groupIndex = i; - item->tableIndex = tableIndex++; taosArrayPush(p1, &item); taosHashPut(pQInfo->tableqinfoGroupInfo.map, &id.tid, sizeof(id.tid), &item, POINTER_BYTES); } diff --git a/src/query/src/qparserImpl.c b/src/query/src/qparserImpl.c index 928b9eb8738e5c3ee299ed595fb163182c76e5a8..d4ac540d2fc725488bae83fb8890840f6ddb59a9 100644 --- a/src/query/src/qparserImpl.c +++ b/src/query/src/qparserImpl.c @@ -15,16 +15,16 @@ #include "os.h" #include "qsqlparser.h" +#include "queryLog.h" #include "taosdef.h" #include "taosmsg.h" +#include "tcmdtype.h" #include "tglobal.h" #include "tstoken.h" +#include "tstrbuild.h" #include "ttime.h" #include "ttokendef.h" #include "tutil.h" -#include "qsqltype.h" -#include "tstrbuild.h" -#include "queryLog.h" SSqlInfo qSQLParse(const char *pStr) { void *pParser = ParseAlloc(malloc); diff --git a/src/query/src/sql.c b/src/query/src/sql.c index e75802a98f4e94c23034072d908b8b5ece3acd7a..eafb052593b121047e3388b7ead3e754ffd3e55d 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -25,17 +25,17 @@ #include /************ Begin %include sections from the grammar ************************/ +#include +#include #include #include #include -#include -#include -#include "tutil.h" #include "qsqlparser.h" +#include "tcmdtype.h" #include "tstoken.h" -#include "tvariant.h" #include "ttokendef.h" -#include "qsqltype.h" +#include "tutil.h" +#include "tvariant.h" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols ** in a format understandable to "makeheaders". This section is blank unless