提交 851ffe49 编写于 作者: D dapan1121

enh: support set tag value with expr

上级 4a563b6d
...@@ -6603,32 +6603,21 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS ...@@ -6603,32 +6603,21 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
} }
pReq->colId = pSchema->colId; pReq->colId = pSchema->colId;
SValueNode *pVal = NULL;
SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema); SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema);
pCxt->errCode = createTagValFromExpr(pCxt, targetDt, (SNode*)pStmt->pVal, &pVal);
if (pCxt->errCode) {
return pCxt->errCode;
}
/* if (QUERY_NODE_VALUE != pStmt->pVal->node.type) {
if (QUERY_NODE_FUNCTION == pStmt->pVal->node.type) { SValueNode *pVal = NULL;
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pStmt->pVal); pCxt->errCode = createTagValFromExpr(pCxt, targetDt, (SNode*)pStmt->pVal, &pVal);
if (pCxt->errCode) { if (pCxt->errCode) {
return pCxt->errCode; return pCxt->errCode;
} }
if (DEAL_RES_ERROR == translateFunctionImpl(pCxt, (SFunctionNode**)&pStmt->pVal)) { nodesDestroyNode((SNode*)pStmt->pVal);
return pCxt->errCode; pStmt->pVal = pVal;
}
} else if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt, true)) { } else if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt, true)) {
return pCxt->errCode; return pCxt->errCode;
} }
*/
nodesDestroyNode((SNode*)pStmt->pVal);
pStmt->pVal = pVal;
pReq->tagType = targetDt.type; pReq->tagType = targetDt.type;
if (targetDt.type == TSDB_DATA_TYPE_JSON) { if (targetDt.type == TSDB_DATA_TYPE_JSON) {
if (pStmt->pVal->literal && if (pStmt->pVal->literal &&
......
...@@ -23,9 +23,9 @@ void simpleTest() { ...@@ -23,9 +23,9 @@ void simpleTest() {
ASSERT_EQ(getTotalBufSize(pBuf), 1024); ASSERT_EQ(getTotalBufSize(pBuf), 1024);
SIDList list = getDataBufPagesIdList(pBuf, groupId); SIDList list = getDataBufPagesIdList(pBuf);
ASSERT_EQ(taosArrayGetSize(list), 1); ASSERT_EQ(taosArrayGetSize(list), 1);
ASSERT_EQ(getNumOfBufGroupId(pBuf), 1); //ASSERT_EQ(getNumOfBufGroupId(pBuf), 1);
releaseBufPage(pBuf, pBufPage); releaseBufPage(pBuf, pBufPage);
...@@ -98,7 +98,7 @@ void writeDownTest() { ...@@ -98,7 +98,7 @@ void writeDownTest() {
SFilePage* pBufPagex = static_cast<SFilePage*>(getBufPage(pBuf, writePageId)); SFilePage* pBufPagex = static_cast<SFilePage*>(getBufPage(pBuf, writePageId));
ASSERT_EQ(*(int32_t*)pBufPagex->data, nx); ASSERT_EQ(*(int32_t*)pBufPagex->data, nx);
SArray* pa = getDataBufPagesIdList(pBuf, groupId); SArray* pa = getDataBufPagesIdList(pBuf);
ASSERT_EQ(taosArrayGetSize(pa), 5); ASSERT_EQ(taosArrayGetSize(pa), 5);
destroyDiskbasedBuf(pBuf); destroyDiskbasedBuf(pBuf);
...@@ -152,7 +152,7 @@ void recyclePageTest() { ...@@ -152,7 +152,7 @@ void recyclePageTest() {
SFilePage* pBufPagex1 = static_cast<SFilePage*>(getBufPage(pBuf, 1)); SFilePage* pBufPagex1 = static_cast<SFilePage*>(getBufPage(pBuf, 1));
SArray* pa = getDataBufPagesIdList(pBuf, groupId); SArray* pa = getDataBufPagesIdList(pBuf);
ASSERT_EQ(taosArrayGetSize(pa), 6); ASSERT_EQ(taosArrayGetSize(pa), 6);
destroyDiskbasedBuf(pBuf); destroyDiskbasedBuf(pBuf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册