more code

This commit is contained in:
Hongze Cheng 2022-11-21 14:33:50 +08:00
parent dc2d5e3603
commit e4df975a7f
1 changed files with 14 additions and 7 deletions

View File

@ -52,11 +52,14 @@ static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson);
#define KV_TYPE_LIT 0 #define KV_TYPE_LIT 0
#define KV_TYPE_MID 1 #define KV_TYPE_MID 1
#define KV_TYPE_BIG 2 #define KV_TYPE_BIG 2
#pragma pack(push, 1)
typedef struct { typedef struct {
int8_t kvType; int8_t kvType;
int16_t nidx; int16_t nidx;
uint8_t idx[]; char idx[];
} SKVIdx; } SKVIdx;
#pragma pack(pop)
int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) {
int32_t code = 0; int32_t code = 0;
@ -93,7 +96,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) {
flag |= HAS_NONE; flag |= HAS_NONE;
} else if (COL_VAL_IS_NULL(pColVal)) { // NULL } else if (COL_VAL_IS_NULL(pColVal)) { // NULL
flag |= HAS_NULL; flag |= HAS_NULL;
nkv += tPutI16v(NULL, pTColumn->colId); nkv += tPutI16v(NULL, -pTColumn->colId);
nidx++; nidx++;
} else { } else {
ASSERT(0); ASSERT(0);
@ -125,9 +128,11 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) {
case HAS_VALUE: case HAS_VALUE:
nRow = ntp; nRow = ntp;
break; break;
case HAS_NULL | HAS_NONE: case (HAS_NULL | HAS_NONE):
case HAS_VALUE | HAS_NONE: // TODO
case HAS_VALUE | HAS_NULL: break;
case (HAS_VALUE | HAS_NONE):
case (HAS_VALUE | HAS_NULL):
ntp = ntp + BIT1_SIZE(pTSchema->numOfCols); ntp = ntp + BIT1_SIZE(pTSchema->numOfCols);
nkv = nkv + sizeof(int32_t) * nidx; nkv = nkv + sizeof(int32_t) * nidx;
if (ntp <= nkv) { if (ntp <= nkv) {
@ -137,7 +142,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) {
flag |= ROW_FLG_KV; flag |= ROW_FLG_KV;
} }
break; break;
case HAS_VALUE | HAS_NULL | HAS_NONE: case (HAS_VALUE | HAS_NULL | HAS_NONE):
ntp = ntp + BIT2_SIZE(pTSchema->numOfCols); ntp = ntp + BIT2_SIZE(pTSchema->numOfCols);
nkv = nkv + sizeof(int32_t) * nidx; nkv = nkv + sizeof(int32_t) * nidx;
if (ntp <= nkv) { if (ntp <= nkv) {
@ -205,7 +210,9 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) {
uint8_t *pv = NULL; uint8_t *pv = NULL;
int32_t nv = 0; int32_t nv = 0;
// todo if (flag == HAS_VALUE) {
} else if (flag == HAS_VALUE) {
}
// build impl // build impl
while (pTColumn) { while (pTColumn) {