revert first/last fetch
This commit is contained in:
parent
2b924c68fd
commit
5955d121b3
|
@ -45,8 +45,6 @@ int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placehol
|
||||||
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent);
|
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent);
|
||||||
int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput);
|
int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput);
|
||||||
void tfreeSParseQueryRes(void* p);
|
void tfreeSParseQueryRes(void* p);
|
||||||
int32_t translatePostDropCTbWithTsma(SParseContext* pCxt, SQuery* pQuery, SSDataBlock* pBlock);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef TD_ENTERPRISE
|
#ifdef TD_ENTERPRISE
|
||||||
int32_t translateView(STranslateContext* pCxt, SNode** pTable, SName* pName);
|
int32_t translateView(STranslateContext* pCxt, SNode** pTable, SName* pName);
|
||||||
|
|
|
@ -9238,76 +9238,10 @@ static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* p
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createFunctionForDropCtbWithTSMA(const char* pFuncName, SFunctionNode** ppFunc) {
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
|
||||||
SFunctionNode* pFunc = NULL;
|
|
||||||
code = nodesMakeNode(QUERY_NODE_FUNCTION, (SNode**)&pFunc);
|
|
||||||
SColumnNode* pCol = NULL;
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
strcpy(pFunc->functionName, pFuncName);
|
|
||||||
code = nodesMakeNode(QUERY_NODE_COLUMN, (SNode**)&pCol);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
strcpy(((SColumnNode*)pCol)->colName, ROWTS_PSEUDO_COLUMN_NAME);
|
|
||||||
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
|
|
||||||
pCol->isPrimTs = true;
|
|
||||||
code = nodesListMakeStrictAppend(&pFunc->pParameterList, (SNode*)pCol);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
*ppFunc = pFunc;
|
|
||||||
} else {
|
|
||||||
nodesDestroyNode((SNode*)pFunc);
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t translateDropCtbWithTsma(STranslateContext* pCxt, SDropTableStmt* pStmt) {
|
|
||||||
if (!pStmt->withTsma || LIST_LENGTH(pStmt->pTables) == 0) return TSDB_CODE_SUCCESS;
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
|
||||||
SNode* pPrevQuery = NULL;
|
|
||||||
SNodeList* pProjectionList = NULL;
|
|
||||||
if (LIST_LENGTH(pStmt->pTables) > 1) return TSDB_CODE_FAILED;
|
|
||||||
SDropTableClause* pClause = (SDropTableClause*)nodesListGetNode(pStmt->pTables, 0);
|
|
||||||
|
|
||||||
// create select query stmt
|
|
||||||
code = nodesMakeList(&pProjectionList);
|
|
||||||
SFunctionNode* pFunc = NULL;
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = createFunctionForDropCtbWithTSMA("count", &pFunc);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = nodesListMakeStrictAppend(&pProjectionList, (SNode*)pFunc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = createFunctionForDropCtbWithTSMA("first", (SFunctionNode**)&pFunc);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = nodesListMakeStrictAppend(&pProjectionList, (SNode*)pFunc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = createFunctionForDropCtbWithTSMA("last", (SFunctionNode**)&pFunc);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = nodesListMakeStrictAppend(&pProjectionList, (SNode*)pFunc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = createSimpleSelectStmtFromProjList(pClause->dbName, pClause->tableName, pProjectionList,
|
|
||||||
(SSelectStmt**)&pPrevQuery);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
|
||||||
nodesDestroyList(pProjectionList);
|
|
||||||
} else {
|
|
||||||
TSWAP(pCxt->pPrevRoot, pPrevQuery);
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt) {
|
static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt) {
|
||||||
if (pStmt->withTsma) return translateDropCtbWithTsma(pCxt, pStmt);
|
|
||||||
|
|
||||||
SDropTableClause* pClause = (SDropTableClause*)nodesListGetNode(pStmt->pTables, 0);
|
SDropTableClause* pClause = (SDropTableClause*)nodesListGetNode(pStmt->pTables, 0);
|
||||||
SName tableName = {0};
|
SName tableName = {0};
|
||||||
|
if (pStmt->withTsma) return TSDB_CODE_SUCCESS;
|
||||||
toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &tableName);
|
toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &tableName);
|
||||||
return doTranslateDropSuperTable(pCxt, &tableName, pClause->ignoreNotExists);
|
return doTranslateDropSuperTable(pCxt, &tableName, pClause->ignoreNotExists);
|
||||||
}
|
}
|
||||||
|
@ -12813,10 +12747,6 @@ int32_t translatePostCreateTSMA(SParseContext* pParseCxt, SQuery* pQuery, SSData
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t translatePostDropCTbWithTsma(SParseContext* pCxt, SQuery* pQuery, SSDataBlock* pBlock) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t translateDropTSMA(STranslateContext* pCxt, SDropTSMAStmt* pStmt) {
|
static int32_t translateDropTSMA(STranslateContext* pCxt, SDropTSMAStmt* pStmt) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SMDropSmaReq dropReq = {0};
|
SMDropSmaReq dropReq = {0};
|
||||||
|
|
|
@ -324,10 +324,6 @@ int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, SSDataBlock
|
||||||
code = translatePostCreateTSMA(pCxt, pQuery, pBlock);
|
code = translatePostCreateTSMA(pCxt, pQuery, pBlock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QUERY_NODE_DROP_TABLE_STMT: {
|
|
||||||
translatePostDropCTbWithTsma(pCxt, pQuery, pBlock);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue