fix: keep backward compatibility

This commit is contained in:
Hongze Cheng 2024-01-25 16:49:10 +08:00
parent 96af7972fa
commit d33676942b
2 changed files with 8 additions and 4 deletions

View File

@ -446,7 +446,6 @@ typedef struct SField {
uint8_t type; uint8_t type;
int8_t flags; int8_t flags;
int32_t bytes; int32_t bytes;
int8_t is_pk;
} SField; } SField;
typedef struct SRetention { typedef struct SRetention {
@ -524,7 +523,6 @@ struct SSchema {
int8_t flags; int8_t flags;
col_id_t colId; col_id_t colId;
int32_t bytes; int32_t bytes;
int8_t is_pk;
char name[TSDB_COL_NAME_LEN]; char name[TSDB_COL_NAME_LEN];
}; };
@ -582,6 +580,7 @@ void tFreeSSubmitRsp(SSubmitRsp* pRsp);
#define COL_SMA_ON ((int8_t)0x1) #define COL_SMA_ON ((int8_t)0x1)
#define COL_IDX_ON ((int8_t)0x2) #define COL_IDX_ON ((int8_t)0x2)
#define COL_IS_KEY ((int8_t)0x4)
#define COL_SET_NULL ((int8_t)0x10) #define COL_SET_NULL ((int8_t)0x10)
#define COL_SET_VAL ((int8_t)0x20) #define COL_SET_VAL ((int8_t)0x20)
#define COL_IS_SYSINFO ((int8_t)0x40) #define COL_IS_SYSINFO ((int8_t)0x40)

View File

@ -5695,11 +5695,14 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) {
SNode* pNode; SNode* pNode;
FOREACH(pNode, pList) { FOREACH(pNode, pList) {
SColumnDefNode* pCol = (SColumnDefNode*)pNode; SColumnDefNode* pCol = (SColumnDefNode*)pNode;
SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType), .is_pk = pCol->is_pk}; SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)};
strcpy(field.name, pCol->colName); strcpy(field.name, pCol->colName);
if (pCol->sma) { if (pCol->sma) {
field.flags |= COL_SMA_ON; field.flags |= COL_SMA_ON;
} }
if (pCol->is_pk) {
field.flags != COL_IS_KEY;
}
taosArrayPush(*pArray, &field); taosArrayPush(*pArray, &field);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -6079,11 +6082,13 @@ static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchem
if (pCol->sma) { if (pCol->sma) {
flags |= COL_SMA_ON; flags |= COL_SMA_ON;
} }
if (pCol->is_pk) {
flags != COL_IS_KEY;
}
pSchema->colId = colId; pSchema->colId = colId;
pSchema->type = pCol->dataType.type; pSchema->type = pCol->dataType.type;
pSchema->bytes = calcTypeBytes(pCol->dataType); pSchema->bytes = calcTypeBytes(pCol->dataType);
pSchema->flags = flags; pSchema->flags = flags;
pSchema->is_pk = pCol->is_pk;
strcpy(pSchema->name, pCol->colName); strcpy(pSchema->name, pCol->colName);
} }