|
|
@ -118,7 +118,7 @@ static bool hasNormalColumnFilter(SQueryInfo* pQueryInfo);
|
|
|
|
|
|
|
|
|
|
|
|
static int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSqlObj* pSql);
|
|
|
|
static int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSqlObj* pSql);
|
|
|
|
static int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDbInfo* pCreateDbSql);
|
|
|
|
static int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDbInfo* pCreateDbSql);
|
|
|
|
static int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
|
|
|
|
static int32_t getColumnIndexByName(const SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex, char* msg);
|
|
|
|
static int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
|
|
|
|
static int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
|
|
|
|
|
|
|
|
|
|
|
|
static int32_t getTableIndexImpl(SStrToken* pTableToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
|
|
|
|
static int32_t getTableIndexImpl(SStrToken* pTableToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
|
|
|
@ -989,7 +989,7 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, col, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(col, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1055,7 +1055,7 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, col, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(col, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (index.columnIndex != PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
|
|
|
if (index.columnIndex != PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
|
|
@ -2024,7 +2024,7 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
|
|
|
|
} else if (optr == TK_ID) {
|
|
|
|
} else if (optr == TK_ID) {
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
|
|
if (getColumnIndexByName(pCmd, &pItem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pItem->pNode->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2209,7 +2209,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
|
|
|
|
pExpr = tscExprAppend(pQueryInfo, functionId, &index, TSDB_DATA_TYPE_BIGINT, size, getNewResColId(pCmd), size, false);
|
|
|
|
pExpr = tscExprAppend(pQueryInfo, functionId, &index, TSDB_DATA_TYPE_BIGINT, size, getNewResColId(pCmd), size, false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// count the number of table created according to the super table
|
|
|
|
// count the number of table created according to the super table
|
|
|
|
if (getColumnIndexByName(pCmd, pToken, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(pToken, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2282,7 +2282,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if ((getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS)) {
|
|
|
|
if ((getColumnIndexByName(&pParamElem->pNode->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS)) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2447,7 +2447,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pParamElem->pNode->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2519,7 +2519,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pParamElem->pNode->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pParamElem->pNode->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2631,7 +2631,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
|
|
|
|
tSqlExpr* pParam = pParamItem->pNode;
|
|
|
|
tSqlExpr* pParam = pParamItem->pNode;
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pParam->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pParam->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2781,7 +2781,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken
|
|
|
|
return columnIndex;
|
|
|
|
return columnIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex) {
|
|
|
|
int32_t doGetColumnIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex, char* msg) {
|
|
|
|
const char* msg0 = "ambiguous column name";
|
|
|
|
const char* msg0 = "ambiguous column name";
|
|
|
|
const char* msg1 = "invalid column name";
|
|
|
|
const char* msg1 = "invalid column name";
|
|
|
|
|
|
|
|
|
|
|
@ -2797,7 +2797,7 @@ int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQu
|
|
|
|
|
|
|
|
|
|
|
|
if (colIndex != COLUMN_INDEX_INITIAL_VAL) {
|
|
|
|
if (colIndex != COLUMN_INDEX_INITIAL_VAL) {
|
|
|
|
if (pIndex->columnIndex != COLUMN_INDEX_INITIAL_VAL) {
|
|
|
|
if (pIndex->columnIndex != COLUMN_INDEX_INITIAL_VAL) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0);
|
|
|
|
return invalidOperationMsg(msg, msg0);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pIndex->tableIndex = i;
|
|
|
|
pIndex->tableIndex = i;
|
|
|
|
pIndex->columnIndex = colIndex;
|
|
|
|
pIndex->columnIndex = colIndex;
|
|
|
@ -2812,7 +2812,7 @@ int32_t doGetColumnIndexByName(SSqlCmd* pCmd, SStrToken* pToken, SQueryInfo* pQu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pIndex->columnIndex == COLUMN_INDEX_INITIAL_VAL) {
|
|
|
|
if (pIndex->columnIndex == COLUMN_INDEX_INITIAL_VAL) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return invalidOperationMsg(msg, msg1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2862,7 +2862,7 @@ int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIn
|
|
|
|
return TSDB_CODE_SUCCESS;
|
|
|
|
return TSDB_CODE_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex) {
|
|
|
|
int32_t getColumnIndexByName(const SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex, char* msg) {
|
|
|
|
if (pQueryInfo->pTableMetaInfo == NULL || pQueryInfo->numOfTables == 0) {
|
|
|
|
if (pQueryInfo->pTableMetaInfo == NULL || pQueryInfo->numOfTables == 0) {
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2873,7 +2873,7 @@ int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo*
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return doGetColumnIndexByName(pCmd, &tmpToken, pQueryInfo, pIndex);
|
|
|
|
return doGetColumnIndexByName(&tmpToken, pQueryInfo, pIndex, msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
@ -3233,7 +3233,7 @@ int32_t validateGroupbyNode(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd
|
|
|
|
SStrToken token = {pVar->nLen, pVar->nType, pVar->pz};
|
|
|
|
SStrToken token = {pVar->nLen, pVar->nType, pVar->pz};
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &token, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&token, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3614,7 +3614,7 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSq
|
|
|
|
return getColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pRight, pExpr->tokenId);
|
|
|
|
return getColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pRight, pExpr->tokenId);
|
|
|
|
} else { // handle leaf node
|
|
|
|
} else { // handle leaf node
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pExpr->pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pExpr->pLeft->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3643,7 +3643,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pExpr->pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pExpr->pLeft->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3676,7 +3676,7 @@ static int32_t checkAndSetJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tS
|
|
|
|
int16_t leftIdx = index.tableIndex;
|
|
|
|
int16_t leftIdx = index.tableIndex;
|
|
|
|
|
|
|
|
|
|
|
|
index = (SColumnIndex)COLUMN_INDEX_INITIALIZER;
|
|
|
|
index = (SColumnIndex)COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pExpr->pRight->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pExpr->pRight->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3746,7 +3746,7 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSqlExpr* pExpr, SQueryInfo* pQuer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pExpr->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pExpr->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3938,7 +3938,7 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex rightIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex rightIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
|
|
if (getColumnIndexByName(pCmd, &pRight->colInfo, pQueryInfo, &rightIndex) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pRight->colInfo, pQueryInfo, &rightIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4048,7 +4048,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
|
|
|
|
int32_t ret = TSDB_CODE_SUCCESS;
|
|
|
|
int32_t ret = TSDB_CODE_SUCCESS;
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pLeft->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4091,7 +4091,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
|
|
|
|
|
|
|
|
|
|
|
|
int16_t leftIdx = index.tableIndex;
|
|
|
|
int16_t leftIdx = index.tableIndex;
|
|
|
|
|
|
|
|
|
|
|
|
if (getColumnIndexByName(pCmd, &pRight->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pRight->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4254,7 +4254,7 @@ static void doExtractExprForSTable(SSqlCmd* pCmd, tSqlExpr** pExpr, SQueryInfo*
|
|
|
|
tSqlExpr* pLeft = (*pExpr)->pLeft;
|
|
|
|
tSqlExpr* pLeft = (*pExpr)->pLeft;
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pLeft->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4421,7 +4421,7 @@ static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlE
|
|
|
|
return getTimeRangeFromExpr(pCmd, pQueryInfo, pExpr->pRight);
|
|
|
|
return getTimeRangeFromExpr(pCmd, pQueryInfo, pExpr->pRight);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if (getColumnIndexByName(pCmd, &pExpr->pLeft->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&pExpr->pLeft->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -5153,7 +5153,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
|
|
if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { // super table query
|
|
|
|
if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { // super table query
|
|
|
|
if (getColumnIndexByName(pCmd, &columnName, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&columnName, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -5248,7 +5248,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
|
|
|
|
pItem = taosArrayGet(pSqlNode->pSortOrder, 1);
|
|
|
|
pItem = taosArrayGet(pSqlNode->pSortOrder, 1);
|
|
|
|
tVariant* pVar2 = &pItem->pVar;
|
|
|
|
tVariant* pVar2 = &pItem->pVar;
|
|
|
|
SStrToken cname = {pVar2->nLen, pVar2->nType, pVar2->pz};
|
|
|
|
SStrToken cname = {pVar2->nLen, pVar2->nType, pVar2->pz};
|
|
|
|
if (getColumnIndexByName(pCmd, &cname, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&cname, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -5262,7 +5262,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else { // meter query
|
|
|
|
} else { // meter query
|
|
|
|
if (getColumnIndexByName(pCmd, &columnName, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&columnName, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (index.columnIndex != PRIMARYKEY_TIMESTAMP_COL_INDEX && !isTopBottomQuery(pQueryInfo)) {
|
|
|
|
if (index.columnIndex != PRIMARYKEY_TIMESTAMP_COL_INDEX && !isTopBottomQuery(pQueryInfo)) {
|
|
|
@ -5357,28 +5357,29 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
return code;
|
|
|
|
return code;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char* pMsg = tscGetErrorMsgPayload(pCmd);
|
|
|
|
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
|
|
|
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
|
|
|
|
|
|
|
|
|
|
|
|
if (pAlterSQL->tableType == TSDB_SUPER_TABLE && !(UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) {
|
|
|
|
if (pAlterSQL->tableType == TSDB_SUPER_TABLE && !(UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg20);
|
|
|
|
return invalidOperationMsg(pMsg, msg20);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN ||
|
|
|
|
if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN ||
|
|
|
|
pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) {
|
|
|
|
pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) {
|
|
|
|
if (!UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
|
|
|
|
if (!UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
|
|
|
return invalidOperationMsg(pMsg, msg3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ((pAlterSQL->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) && (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) {
|
|
|
|
} else if ((pAlterSQL->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) && (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
|
|
|
return invalidOperationMsg(pMsg, msg4);
|
|
|
|
} else if ((pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) &&
|
|
|
|
} else if ((pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) &&
|
|
|
|
UTIL_TABLE_IS_CHILD_TABLE(pTableMetaInfo)) {
|
|
|
|
UTIL_TABLE_IS_CHILD_TABLE(pTableMetaInfo)) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
|
|
|
|
return invalidOperationMsg(pMsg, msg6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) {
|
|
|
|
if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) {
|
|
|
|
SArray* pFieldList = pAlterSQL->pAddColumns;
|
|
|
|
SArray* pFieldList = pAlterSQL->pAddColumns;
|
|
|
|
if (taosArrayGetSize(pFieldList) > 1) {
|
|
|
|
if (taosArrayGetSize(pFieldList) > 1) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5);
|
|
|
|
return invalidOperationMsg(pMsg, msg5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TAOS_FIELD* p = taosArrayGet(pFieldList, 0);
|
|
|
|
TAOS_FIELD* p = taosArrayGet(pFieldList, 0);
|
|
|
@ -5389,31 +5390,31 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, p);
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, p);
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN) {
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN) {
|
|
|
|
if (tscGetNumOfTags(pTableMeta) == 1) {
|
|
|
|
if (tscGetNumOfTags(pTableMeta) == 1) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
|
|
|
|
return invalidOperationMsg(pMsg, msg7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// numOfTags == 1
|
|
|
|
// numOfTags == 1
|
|
|
|
if (taosArrayGetSize(pAlterSQL->varList) > 1) {
|
|
|
|
if (taosArrayGetSize(pAlterSQL->varList) > 1) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8);
|
|
|
|
return invalidOperationMsg(pMsg, msg8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pAlterSQL->varList, 0);
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pAlterSQL->varList, 0);
|
|
|
|
if (pItem->pVar.nLen >= TSDB_COL_NAME_LEN) {
|
|
|
|
if (pItem->pVar.nLen >= TSDB_COL_NAME_LEN) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg9);
|
|
|
|
return invalidOperationMsg(pMsg, msg9);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SStrToken name = {.z = pItem->pVar.pz, .n = pItem->pVar.nLen, .type = TK_STRING};
|
|
|
|
SStrToken name = {.z = pItem->pVar.pz, .n = pItem->pVar.nLen, .type = TK_STRING};
|
|
|
|
|
|
|
|
|
|
|
|
if (getColumnIndexByName(pCmd, &name, pQueryInfo, &index) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&name, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32_t numOfCols = tscGetNumOfColumns(pTableMeta);
|
|
|
|
int32_t numOfCols = tscGetNumOfColumns(pTableMeta);
|
|
|
|
if (index.columnIndex < numOfCols) {
|
|
|
|
if (index.columnIndex < numOfCols) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10);
|
|
|
|
return invalidOperationMsg(pMsg, msg10);
|
|
|
|
} else if (index.columnIndex == numOfCols) {
|
|
|
|
} else if (index.columnIndex == numOfCols) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg11);
|
|
|
|
return invalidOperationMsg(pMsg, msg11);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char name1[128] = {0};
|
|
|
|
char name1[128] = {0};
|
|
|
@ -5431,24 +5432,24 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
tVariantListItem* pDstItem = taosArrayGet(pAlterSQL->varList, 1);
|
|
|
|
tVariantListItem* pDstItem = taosArrayGet(pAlterSQL->varList, 1);
|
|
|
|
|
|
|
|
|
|
|
|
if (pSrcItem->pVar.nLen >= TSDB_COL_NAME_LEN || pDstItem->pVar.nLen >= TSDB_COL_NAME_LEN) {
|
|
|
|
if (pSrcItem->pVar.nLen >= TSDB_COL_NAME_LEN || pDstItem->pVar.nLen >= TSDB_COL_NAME_LEN) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg9);
|
|
|
|
return invalidOperationMsg(pMsg, msg9);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pSrcItem->pVar.nType != TSDB_DATA_TYPE_BINARY || pDstItem->pVar.nType != TSDB_DATA_TYPE_BINARY) {
|
|
|
|
if (pSrcItem->pVar.nType != TSDB_DATA_TYPE_BINARY || pDstItem->pVar.nType != TSDB_DATA_TYPE_BINARY) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10);
|
|
|
|
return invalidOperationMsg(pMsg, msg10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex srcIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex srcIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex destIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex destIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
|
|
SStrToken srcToken = {.z = pSrcItem->pVar.pz, .n = pSrcItem->pVar.nLen, .type = TK_STRING};
|
|
|
|
SStrToken srcToken = {.z = pSrcItem->pVar.pz, .n = pSrcItem->pVar.nLen, .type = TK_STRING};
|
|
|
|
if (getColumnIndexByName(pCmd, &srcToken, pQueryInfo, &srcIndex) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&srcToken, pQueryInfo, &srcIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17);
|
|
|
|
return invalidOperationMsg(pMsg, msg17);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SStrToken destToken = {.z = pDstItem->pVar.pz, .n = pDstItem->pVar.nLen, .type = TK_STRING};
|
|
|
|
SStrToken destToken = {.z = pDstItem->pVar.pz, .n = pDstItem->pVar.nLen, .type = TK_STRING};
|
|
|
|
if (getColumnIndexByName(pCmd, &destToken, pQueryInfo, &destIndex) == TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&destToken, pQueryInfo, &destIndex, tscGetErrorMsgPayload(pCmd)) == TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg19);
|
|
|
|
return invalidOperationMsg(pMsg, msg19);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pVarList, 0);
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pVarList, 0);
|
|
|
@ -5475,12 +5476,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = item->pVar.pz, .n = item->pVar.nLen};
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = item->pVar.pz, .n = item->pVar.nLen};
|
|
|
|
if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (columnIndex.columnIndex < tscGetNumOfColumns(pTableMeta)) {
|
|
|
|
if (columnIndex.columnIndex < tscGetNumOfColumns(pTableMeta)) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg12);
|
|
|
|
return invalidOperationMsg(pMsg, msg12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pVarList, 1);
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pVarList, 1);
|
|
|
@ -5488,7 +5489,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
pAlterSQL->tagData.data = calloc(1, pTagsSchema->bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE);
|
|
|
|
pAlterSQL->tagData.data = calloc(1, pTagsSchema->bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE);
|
|
|
|
|
|
|
|
|
|
|
|
if (tVariantDump(&pItem->pVar, pAlterSQL->tagData.data, pTagsSchema->type, true) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (tVariantDump(&pItem->pVar, pAlterSQL->tagData.data, pTagsSchema->type, true) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg13);
|
|
|
|
return invalidOperationMsg(pMsg, msg13);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pAlterSQL->tagData.dataLen = pTagsSchema->bytes;
|
|
|
|
pAlterSQL->tagData.dataLen = pTagsSchema->bytes;
|
|
|
@ -5496,14 +5497,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
// validate the length of binary
|
|
|
|
// validate the length of binary
|
|
|
|
if ((pTagsSchema->type == TSDB_DATA_TYPE_BINARY || pTagsSchema->type == TSDB_DATA_TYPE_NCHAR) &&
|
|
|
|
if ((pTagsSchema->type == TSDB_DATA_TYPE_BINARY || pTagsSchema->type == TSDB_DATA_TYPE_NCHAR) &&
|
|
|
|
varDataTLen(pAlterSQL->tagData.data) > pTagsSchema->bytes) {
|
|
|
|
varDataTLen(pAlterSQL->tagData.data) > pTagsSchema->bytes) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg14);
|
|
|
|
return invalidOperationMsg(pMsg, msg14);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32_t schemaLen = sizeof(STColumn) * numOfTags;
|
|
|
|
int32_t schemaLen = sizeof(STColumn) * numOfTags;
|
|
|
|
int32_t size = sizeof(SUpdateTableTagValMsg) + pTagsSchema->bytes + schemaLen + TSDB_EXTRA_PAYLOAD_SIZE;
|
|
|
|
int32_t size = sizeof(SUpdateTableTagValMsg) + pTagsSchema->bytes + schemaLen + TSDB_EXTRA_PAYLOAD_SIZE;
|
|
|
|
|
|
|
|
|
|
|
|
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, size)) {
|
|
|
|
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, size)) {
|
|
|
|
tscError("0x%"PRIx64" failed to malloc for alter table msg", pSql->self);
|
|
|
|
tscError("0x%"PRIx64" failed to malloc for alter table pMsg", pSql->self);
|
|
|
|
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
|
|
|
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -5518,7 +5519,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
pUpdateMsg->numOfTags = htons(numOfTags);
|
|
|
|
pUpdateMsg->numOfTags = htons(numOfTags);
|
|
|
|
pUpdateMsg->schemaLen = htonl(schemaLen);
|
|
|
|
pUpdateMsg->schemaLen = htonl(schemaLen);
|
|
|
|
|
|
|
|
|
|
|
|
// the schema is located after the msg body, then followed by true tag value
|
|
|
|
// the schema is located after the pMsg body, then followed by true tag value
|
|
|
|
char* d = pUpdateMsg->data;
|
|
|
|
char* d = pUpdateMsg->data;
|
|
|
|
SSchema* pTagCols = tscGetTableTagSchema(pTableMeta);
|
|
|
|
SSchema* pTagCols = tscGetTableTagSchema(pTableMeta);
|
|
|
|
for (int i = 0; i < numOfTags; ++i) {
|
|
|
|
for (int i = 0; i < numOfTags; ++i) {
|
|
|
@ -5531,7 +5532,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
d += sizeof(STColumn);
|
|
|
|
d += sizeof(STColumn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// copy the tag value to msg body
|
|
|
|
// copy the tag value to pMsg body
|
|
|
|
pItem = taosArrayGet(pVarList, 1);
|
|
|
|
pItem = taosArrayGet(pVarList, 1);
|
|
|
|
tVariantDump(&pItem->pVar, pUpdateMsg->data + schemaLen, pTagsSchema->type, true);
|
|
|
|
tVariantDump(&pItem->pVar, pUpdateMsg->data + schemaLen, pTagsSchema->type, true);
|
|
|
|
|
|
|
|
|
|
|
@ -5550,8 +5551,8 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN) {
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_COLUMN) {
|
|
|
|
SArray* pFieldList = pAlterSQL->pAddColumns;
|
|
|
|
SArray* pFieldList = pAlterSQL->pAddColumns;
|
|
|
|
if (taosArrayGetSize(pFieldList) > 1) {
|
|
|
|
if (taosArrayGetSize(pFieldList) > 1) {
|
|
|
|
const char* msg = "only support add one column";
|
|
|
|
const char* msgx = "only support add one column";
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg);
|
|
|
|
return invalidOperationMsg(pMsg, msgx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TAOS_FIELD* p = taosArrayGet(pFieldList, 0);
|
|
|
|
TAOS_FIELD* p = taosArrayGet(pFieldList, 0);
|
|
|
@ -5562,24 +5563,24 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, p);
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, p);
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN) {
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_DROP_COLUMN) {
|
|
|
|
if (tscGetNumOfColumns(pTableMeta) == TSDB_MIN_COLUMNS) { //
|
|
|
|
if (tscGetNumOfColumns(pTableMeta) == TSDB_MIN_COLUMNS) { //
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg15);
|
|
|
|
return invalidOperationMsg(pMsg, msg15);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t size = taosArrayGetSize(pAlterSQL->varList);
|
|
|
|
size_t size = taosArrayGetSize(pAlterSQL->varList);
|
|
|
|
if (size > 1) {
|
|
|
|
if (size > 1) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16);
|
|
|
|
return invalidOperationMsg(pMsg, msg16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pAlterSQL->varList, 0);
|
|
|
|
tVariantListItem* pItem = taosArrayGet(pAlterSQL->varList, 0);
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen};
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = pItem->pVar.pz, .n = pItem->pVar.nLen};
|
|
|
|
if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17);
|
|
|
|
return invalidOperationMsg(pMsg, msg17);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (columnIndex.columnIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
|
|
|
if (columnIndex.columnIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg18);
|
|
|
|
return invalidOperationMsg(pMsg, msg18);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char name1[TSDB_COL_NAME_LEN] = {0};
|
|
|
|
char name1[TSDB_COL_NAME_LEN] = {0};
|
|
|
@ -5588,79 +5589,79 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) {
|
|
|
|
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_COLUMN) {
|
|
|
|
if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) {
|
|
|
|
if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16);
|
|
|
|
return invalidOperationMsg(pMsg, msg16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0);
|
|
|
|
TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0);
|
|
|
|
if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21);
|
|
|
|
return invalidOperationMsg(pMsg, msg21);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)};
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)};
|
|
|
|
if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17);
|
|
|
|
return invalidOperationMsg(pMsg, msg17);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex);
|
|
|
|
SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex);
|
|
|
|
|
|
|
|
|
|
|
|
if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21);
|
|
|
|
return invalidOperationMsg(pMsg, msg21);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pItem->type != pColSchema->type) {
|
|
|
|
if (pItem->type != pColSchema->type) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23);
|
|
|
|
return invalidOperationMsg(pMsg, msg23);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) ||
|
|
|
|
if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) ||
|
|
|
|
(pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) {
|
|
|
|
(pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg24);
|
|
|
|
return invalidOperationMsg(pMsg, msg24);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pItem->bytes <= pColSchema->bytes) {
|
|
|
|
if (pItem->bytes <= pColSchema->bytes) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22);
|
|
|
|
return invalidOperationMsg(pMsg, msg22);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
|
|
|
|
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
|
|
|
|
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
|
|
|
|
}else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) {
|
|
|
|
}else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) {
|
|
|
|
if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) {
|
|
|
|
if (taosArrayGetSize(pAlterSQL->pAddColumns) >= 2) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg16);
|
|
|
|
return invalidOperationMsg(pMsg, msg16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0);
|
|
|
|
TAOS_FIELD* pItem = taosArrayGet(pAlterSQL->pAddColumns, 0);
|
|
|
|
if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
if (pItem->type != TSDB_DATA_TYPE_BINARY && pItem->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21);
|
|
|
|
return invalidOperationMsg(pMsg, msg21);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex columnIndex = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)};
|
|
|
|
SStrToken name = {.type = TK_STRING, .z = pItem->name, .n = (uint32_t)strlen(pItem->name)};
|
|
|
|
if (getColumnIndexByName(pCmd, &name, pQueryInfo, &columnIndex) != TSDB_CODE_SUCCESS) {
|
|
|
|
if (getColumnIndexByName(&name, pQueryInfo, &columnIndex, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg17);
|
|
|
|
return invalidOperationMsg(pMsg, msg17);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex);
|
|
|
|
SSchema* pColSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex);
|
|
|
|
|
|
|
|
|
|
|
|
if (columnIndex.columnIndex < tscGetNumOfColumns(pTableMetaInfo->pTableMeta)) {
|
|
|
|
if (columnIndex.columnIndex < tscGetNumOfColumns(pTableMetaInfo->pTableMeta)) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10);
|
|
|
|
return invalidOperationMsg(pMsg, msg10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
if (pColSchema->type != TSDB_DATA_TYPE_BINARY && pColSchema->type != TSDB_DATA_TYPE_NCHAR) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg21);
|
|
|
|
return invalidOperationMsg(pMsg, msg21);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pItem->type != pColSchema->type) {
|
|
|
|
if (pItem->type != pColSchema->type) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg23);
|
|
|
|
return invalidOperationMsg(pMsg, msg23);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) ||
|
|
|
|
if ((pItem->type == TSDB_DATA_TYPE_BINARY && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_BINARY_LEN)) ||
|
|
|
|
(pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) {
|
|
|
|
(pItem->type == TSDB_DATA_TYPE_NCHAR && (pItem->bytes <= 0 || pItem->bytes > TSDB_MAX_NCHAR_LEN))) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg24);
|
|
|
|
return invalidOperationMsg(pMsg, msg24);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pItem->bytes <= pColSchema->bytes) {
|
|
|
|
if (pItem->bytes <= pColSchema->bytes) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22);
|
|
|
|
return invalidOperationMsg(pMsg, msg22);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
|
|
|
|
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
|
|
|
@ -7241,7 +7242,7 @@ int32_t tscGetExprFilters(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelect
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
tSqlExprItem* pParamElem = taosArrayGet(pSqlExpr->pParam, 0);
|
|
|
|
tSqlExprItem* pParamElem = taosArrayGet(pSqlExpr->pParam, 0);
|
|
|
|
SStrToken* pToken = &pParamElem->pNode->colInfo;
|
|
|
|
SStrToken* pToken = &pParamElem->pNode->colInfo;
|
|
|
|
getColumnIndexByName(pCmd, pToken, pQueryInfo, &index);
|
|
|
|
getColumnIndexByName(pToken, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t numOfNodeInSel = tscNumOfExprs(pQueryInfo);
|
|
|
|
size_t numOfNodeInSel = tscNumOfExprs(pQueryInfo);
|
|
|
@ -7429,7 +7430,7 @@ int32_t getHavingExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pSelectNode
|
|
|
|
|
|
|
|
|
|
|
|
if (pExpr1->tokenId == TK_ID) {
|
|
|
|
if (pExpr1->tokenId == TK_ID) {
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
if ((getColumnIndexByName(pCmd, &pExpr1->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS)) {
|
|
|
|
if ((getColumnIndexByName(&pExpr1->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS)) {
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -7855,6 +7856,12 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
|
|
|
|
|
|
|
|
|
|
|
|
int32_t timeWindowQuery =
|
|
|
|
int32_t timeWindowQuery =
|
|
|
|
(TPARSER_HAS_TOKEN(pSqlNode->interval.interval) || TPARSER_HAS_TOKEN(pSqlNode->sessionVal.gap));
|
|
|
|
(TPARSER_HAS_TOKEN(pSqlNode->interval.interval) || TPARSER_HAS_TOKEN(pSqlNode->sessionVal.gap));
|
|
|
|
|
|
|
|
TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TABLE_QUERY);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// parse the group by clause in the first place
|
|
|
|
|
|
|
|
if (validateGroupbyNode(pQueryInfo, pSqlNode->pGroupby, pCmd) != TSDB_CODE_SUCCESS) {
|
|
|
|
|
|
|
|
return TSDB_CODE_TSC_INVALID_OPERATION;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (validateSelectNodeList(pCmd, pQueryInfo, pSqlNode->pSelNodeList, false, false, timeWindowQuery) !=
|
|
|
|
if (validateSelectNodeList(pCmd, pQueryInfo, pSqlNode->pSelNodeList, false, false, timeWindowQuery) !=
|
|
|
|
TSDB_CODE_SUCCESS) {
|
|
|
|
TSDB_CODE_SUCCESS) {
|
|
|
@ -8184,7 +8191,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (pSqlExpr->type == SQL_NODE_TABLE_COLUMN) { // column name, normal column arithmetic expression
|
|
|
|
} else if (pSqlExpr->type == SQL_NODE_TABLE_COLUMN) { // column name, normal column arithmetic expression
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
SColumnIndex index = COLUMN_INDEX_INITIALIZER;
|
|
|
|
int32_t ret = getColumnIndexByName(pCmd, &pSqlExpr->colInfo, pQueryInfo, &index);
|
|
|
|
int32_t ret = getColumnIndexByName(&pSqlExpr->colInfo, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd));
|
|
|
|
if (ret != TSDB_CODE_SUCCESS) {
|
|
|
|
if (ret != TSDB_CODE_SUCCESS) {
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|