[td-13039] fix bug.
This commit is contained in:
parent
8196b6ee9a
commit
56f38425a9
|
@ -53,7 +53,6 @@ TEST(testCase, driverInit_Test) {
|
||||||
// taos_init();
|
// taos_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
TEST(testCase, connect_Test) {
|
TEST(testCase, connect_Test) {
|
||||||
// taos_options(TSDB_OPTION_CONFIGDIR, "/home/ubuntu/first/cfg");
|
// taos_options(TSDB_OPTION_CONFIGDIR, "/home/ubuntu/first/cfg");
|
||||||
|
|
||||||
|
@ -564,8 +563,6 @@ TEST(testCase, insert_test) {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
taos_close(pConn);
|
taos_close(pConn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
TEST(testCase, projection_query_tables) {
|
TEST(testCase, projection_query_tables) {
|
||||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
|
@ -579,7 +576,7 @@ TEST(testCase, projection_query_tables) {
|
||||||
|
|
||||||
TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
#if 0
|
|
||||||
pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
|
pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
|
||||||
if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
||||||
|
@ -602,9 +599,8 @@ TEST(testCase, projection_query_tables) {
|
||||||
|
|
||||||
taos_free_result(p);
|
taos_free_result(p);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
pRes = taos_query(pConn, "select count(ts) from tu");
|
pRes = taos_query(pConn, "select * from tu");
|
||||||
if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
|
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
@ -625,7 +621,6 @@ TEST(testCase, projection_query_tables) {
|
||||||
taos_close(pConn);
|
taos_close(pConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
TEST(testCase, projection_query_stables) {
|
TEST(testCase, projection_query_stables) {
|
||||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
ASSERT_NE(pConn, nullptr);
|
ASSERT_NE(pConn, nullptr);
|
||||||
|
@ -687,6 +682,5 @@ TEST(testCase, agg_query_tables) {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
taos_close(pConn);
|
taos_close(pConn);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
|
@ -8140,11 +8140,9 @@ SOperatorInfo* doCreateOperatorTreeNode(SPhysiNode* pPhyNode, SExecTaskInfo* pTa
|
||||||
idList = taosArrayInit(4, sizeof(uint64_t));
|
idList = taosArrayInit(4, sizeof(uint64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pScanPhyNode->pScanCols, idList, pTaskInfo);
|
// SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pScanPhyNode->pScanCols, idList, pTaskInfo);
|
||||||
// taosArrayDestroy(idList);
|
taosArrayDestroy(idList);
|
||||||
|
// return pOperator;
|
||||||
// //TODO destroy groupInfo
|
|
||||||
// return pOperator;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8175,9 +8173,9 @@ SOperatorInfo* doCreateOperatorTreeNode(SPhysiNode* pPhyNode, SExecTaskInfo* pTa
|
||||||
static tsdbReaderT createDataReaderImpl(STableScanPhysiNode* pTableScanNode, STableGroupInfo* pGroupInfo, void* readHandle, uint64_t queryId, uint64_t taskId) {
|
static tsdbReaderT createDataReaderImpl(STableScanPhysiNode* pTableScanNode, STableGroupInfo* pGroupInfo, void* readHandle, uint64_t queryId, uint64_t taskId) {
|
||||||
STsdbQueryCond cond = {.loadExternalRows = false};
|
STsdbQueryCond cond = {.loadExternalRows = false};
|
||||||
|
|
||||||
cond.order = pTableScanNode->scan.order;
|
cond.order = pTableScanNode->scan.order;
|
||||||
cond.numOfCols = LIST_LENGTH(pTableScanNode->scan.pScanCols);
|
cond.numOfCols = LIST_LENGTH(pTableScanNode->scan.pScanCols);
|
||||||
cond.colList = calloc(cond.numOfCols, sizeof(SColumnInfo));
|
cond.colList = calloc(cond.numOfCols, sizeof(SColumnInfo));
|
||||||
if (cond.colList == NULL) {
|
if (cond.colList == NULL) {
|
||||||
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -8187,15 +8185,21 @@ static tsdbReaderT createDataReaderImpl(STableScanPhysiNode* pTableScanNode, STa
|
||||||
cond.type = BLOCK_LOAD_OFFSET_SEQ_ORDER;
|
cond.type = BLOCK_LOAD_OFFSET_SEQ_ORDER;
|
||||||
// cond.type = pTableScanNode->scanFlag;
|
// cond.type = pTableScanNode->scanFlag;
|
||||||
|
|
||||||
|
int32_t j = 0;
|
||||||
for (int32_t i = 0; i < cond.numOfCols; ++i) {
|
for (int32_t i = 0; i < cond.numOfCols; ++i) {
|
||||||
STargetNode* pNode = (STargetNode*)nodesListGetNode(pTableScanNode->scan.pScanCols, i);
|
STargetNode* pNode = (STargetNode*)nodesListGetNode(pTableScanNode->scan.pScanCols, i);
|
||||||
|
|
||||||
SColumnNode* pColNode = (SColumnNode*)pNode->pExpr;
|
SColumnNode* pColNode = (SColumnNode*)pNode->pExpr;
|
||||||
cond.colList[i].type = pColNode->node.resType.type;
|
if (pColNode->colType == COLUMN_TYPE_TAG) {
|
||||||
cond.colList[i].bytes = pColNode->node.resType.bytes;
|
continue;
|
||||||
cond.colList[i].colId = pColNode->colId;
|
}
|
||||||
|
|
||||||
|
cond.colList[j].type = pColNode->node.resType.type;
|
||||||
|
cond.colList[j].bytes = pColNode->node.resType.bytes;
|
||||||
|
cond.colList[j].colId = pColNode->colId;
|
||||||
|
j += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cond.numOfCols = j;
|
||||||
return tsdbQueryTables(readHandle, &cond, pGroupInfo, queryId, taskId);
|
return tsdbQueryTables(readHandle, &cond, pGroupInfo, queryId, taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode
|
||||||
if (NULL == pCol) {
|
if (NULL == pCol) {
|
||||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY);
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i < pMeta->tableInfo.numOfTags), pCol);
|
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i >= pMeta->tableInfo.numOfColumns), pCol);
|
||||||
nodesListAppend(pList, (SNode*)pCol);
|
nodesListAppend(pList, (SNode*)pCol);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -156,7 +156,7 @@ static bool findAndSetColumn(SColumnNode* pCol, const STableNode* pTable) {
|
||||||
int32_t nums = pMeta->tableInfo.numOfTags + pMeta->tableInfo.numOfColumns;
|
int32_t nums = pMeta->tableInfo.numOfTags + pMeta->tableInfo.numOfColumns;
|
||||||
for (int32_t i = 0; i < nums; ++i) {
|
for (int32_t i = 0; i < nums; ++i) {
|
||||||
if (0 == strcmp(pCol->colName, pMeta->schema[i].name)) {
|
if (0 == strcmp(pCol->colName, pMeta->schema[i].name)) {
|
||||||
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i < pMeta->tableInfo.numOfTags), pCol);
|
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i >= pMeta->tableInfo.numOfColumns), pCol);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1090,6 +1090,10 @@ static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) {
|
||||||
static int32_t translateShowTables(STranslateContext* pCxt) {
|
static int32_t translateShowTables(STranslateContext* pCxt) {
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
SVShowTablesReq* pShowReq = calloc(1, sizeof(SVShowTablesReq));
|
SVShowTablesReq* pShowReq = calloc(1, sizeof(SVShowTablesReq));
|
||||||
|
if (pCxt->pParseCxt->db == NULL || strlen(pCxt->pParseCxt->db) == 0) {
|
||||||
|
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_TSC_INVALID_OPERATION, "db not specified");
|
||||||
|
}
|
||||||
|
|
||||||
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, strlen(pCxt->pParseCxt->db));
|
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, strlen(pCxt->pParseCxt->db));
|
||||||
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
||||||
tNameGetFullDbName(&name, dbFname);
|
tNameGetFullDbName(&name, dbFname);
|
||||||
|
|
Loading…
Reference in New Issue