Merge remote-tracking branch 'origin/feat/TS-4243-3.0' into feat/TS-4243-3.0
This commit is contained in:
commit
1b30d214eb
|
@ -766,6 +766,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_PAR_SECOND_COL_PK TAOS_DEF_ERROR_CODE(0, 0x2672)
|
||||
#define TSDB_CODE_PAR_COL_PK_TYPE TAOS_DEF_ERROR_CODE(0, 0x2673)
|
||||
#define TSDB_CODE_PAR_INVALID_PK_OP TAOS_DEF_ERROR_CODE(0, 0x2674)
|
||||
#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x2675)
|
||||
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
|
||||
|
||||
//planner
|
||||
|
|
|
@ -217,6 +217,11 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
|
|||
case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY
|
||||
ASSERT(pColInfoData->info.type == pCol->type);
|
||||
if (colDataIsNull_s(pColInfoData, j)) {
|
||||
if ((pCol->flags & COL_IS_KEY)) {
|
||||
qError("Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type);
|
||||
terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL;
|
||||
goto _end;
|
||||
}
|
||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||
taosArrayPush(pVals, &cv);
|
||||
} else {
|
||||
|
@ -240,10 +245,15 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
|
|||
if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) {
|
||||
if (colDataIsNull_s(pColInfoData, j)) {
|
||||
if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) {
|
||||
qError("NULL value for primary key");
|
||||
qError("Primary timestamp column should not be null");
|
||||
terrno = TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL;
|
||||
goto _end;
|
||||
}
|
||||
if ((pCol->flags & COL_IS_KEY)) {
|
||||
qError("Primary key column should not be null, colId:%" PRIi16 ", colType:%" PRIi8, pCol->colId, pCol->type);
|
||||
terrno = TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type); // should use pCol->type
|
||||
taosArrayPush(pVals, &cv);
|
||||
|
|
|
@ -121,6 +121,7 @@ static int32_t columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) {
|
|||
COPY_SCALAR_FIELD(slotId);
|
||||
COPY_SCALAR_FIELD(tableHasPk);
|
||||
COPY_SCALAR_FIELD(isPk);
|
||||
COPY_SCALAR_FIELD(numOfPKs);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -3618,6 +3618,7 @@ static const char* jkColumnDataBlockId = "DataBlockId";
|
|||
static const char* jkColumnSlotId = "SlotId";
|
||||
static const char* jkColumnTableHasPk = "TableHasPk";
|
||||
static const char* jkColumnIsPk = "IsPk";
|
||||
static const char* jkColumnNumOfPKs = "NumOfPKs";
|
||||
|
||||
static int32_t columnNodeToJson(const void* pObj, SJson* pJson) {
|
||||
const SColumnNode* pNode = (const SColumnNode*)pObj;
|
||||
|
@ -3662,6 +3663,9 @@ static int32_t columnNodeToJson(const void* pObj, SJson* pJson) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddBoolToObject(pJson, jkColumnIsPk, pNode->isPk);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonAddIntegerToObject(pJson, jkColumnNumOfPKs, pNode->numOfPKs);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -3707,7 +3711,10 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
|
|||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetBoolValue(pJson, jkColumnIsPk, &pNode->isPk);
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tjsonGetSmallIntValue(pJson, jkColumnNumOfPKs, &pNode->numOfPKs);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -731,6 +731,9 @@ static int32_t columnNodeInlineToMsg(const void* pObj, STlvEncoder* pEncoder) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvEncodeValueBool(pEncoder, pNode->isPk);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvEncodeValueI16(pEncoder, pNode->numOfPKs);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -778,6 +781,9 @@ static int32_t msgToColumnNodeInline(STlvDecoder* pDecoder, void* pObj) {
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvDecodeValueBool(pDecoder, &pNode->isPk);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = tlvDecodeValueI16(pDecoder, &pNode->numOfPKs);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -5088,7 +5088,7 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns
|
|||
SNode* pPrimaryKeyExpr = NULL;
|
||||
SNode* pBoundCol = NULL;
|
||||
SNode* pProj = NULL;
|
||||
int16_t numOfPKs = 0;
|
||||
int16_t numOfTargetPKs = 0;
|
||||
int16_t numOfBoundPKs = 0;
|
||||
FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) {
|
||||
SColumnNode* pCol = (SColumnNode*)pBoundCol;
|
||||
|
@ -5105,7 +5105,7 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns
|
|||
snprintf(pExpr->aliasName, sizeof(pExpr->aliasName), "%s", pCol->colName);
|
||||
if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) {
|
||||
pPrimaryKeyExpr = (SNode*)pExpr;
|
||||
numOfPKs = pCol->numOfPKs;
|
||||
numOfTargetPKs = pCol->numOfPKs;
|
||||
}
|
||||
if (pCol->isPk) ++numOfBoundPKs;
|
||||
}
|
||||
|
@ -5115,7 +5115,7 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns
|
|||
"Primary timestamp column should not be null");
|
||||
}
|
||||
|
||||
if (numOfBoundPKs != numOfPKs) {
|
||||
if (numOfBoundPKs != numOfTargetPKs) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Primary key column should not be none");
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
|
|||
case TSDB_CODE_PAR_VALUE_TOO_LONG:
|
||||
return "Value too long for column/tag: %s";
|
||||
case TSDB_CODE_PAR_INVALID_DELETE_WHERE:
|
||||
return "The DELETE statement must have a definite time window range";
|
||||
return "The DELETE statement must only have a definite time window range";
|
||||
case TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG:
|
||||
return "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes";
|
||||
case TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC:
|
||||
|
|
|
@ -601,7 +601,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not su
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DROP_COL, "No columns can be dropped")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be json type")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must have a definite time window range")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DELETE_WHERE, "The DELETE statement must only have a definite time window range")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_REDISTRIBUTE_VG, "The REDISTRIBUTE VGROUP statement only support 1 to 3 dnodes")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_FILL_NOT_ALLOWED_FUNC, "Fill not allowed")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WINDOW_PC, "Invalid windows pc")
|
||||
|
@ -628,6 +628,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY, "tag can not be prim
|
|||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SECOND_COL_PK, "primary key must be second column")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_PK_TYPE, "primary key column must be of type int, uint, bigint, ubigint, and varchar")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_PK_OP, "primary key column can not be added, modified, and dropped")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL, "Primary key column should not be null")
|
||||
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
|
||||
|
||||
//planner
|
||||
|
|
Loading…
Reference in New Issue