commit
043776caab
|
@ -260,7 +260,6 @@ typedef struct {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
// TODO: use varchar(0) to represent NULL type
|
||||
#define IS_VAR_NULL_TYPE(_t, _b) ((_t) == TSDB_DATA_TYPE_VARCHAR && (_b) == 0)
|
||||
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
|
||||
|
|
|
@ -95,7 +95,7 @@ typedef struct SMetaFltParam {
|
|||
tb_uid_t suid;
|
||||
int16_t cid;
|
||||
int16_t type;
|
||||
char *val;
|
||||
void *val;
|
||||
bool reverse;
|
||||
int (*filterFunc)(void *a, void *b, int16_t type);
|
||||
|
||||
|
|
|
@ -315,7 +315,8 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL
|
|||
return 1;
|
||||
} else if (!pTagIdxKey1->isNull && !pTagIdxKey2->isNull) {
|
||||
// all not NULL, compr tag vals
|
||||
c = doCompare(pTagIdxKey1->data, pTagIdxKey2->data, pTagIdxKey1->type, 0);
|
||||
__compar_fn_t func = getComparFunc(pTagIdxKey1->type, 0);
|
||||
c = func(pTagIdxKey1->data, pTagIdxKey2->data);
|
||||
if (c) return c;
|
||||
}
|
||||
|
||||
|
|
|
@ -793,9 +793,6 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
goto _err;
|
||||
}
|
||||
|
||||
if (iCol == 0) {
|
||||
// TODO : need to update tag index
|
||||
}
|
||||
ctbEntry.version = version;
|
||||
if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) {
|
||||
ctbEntry.ctbEntry.pTags = taosMemoryMalloc(pAlterTbReq->nTagVal);
|
||||
|
@ -849,6 +846,10 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
// save to uid.idx
|
||||
tdbTbUpsert(pMeta->pUidIdx, &ctbEntry.uid, sizeof(tb_uid_t), &version, sizeof(version), &pMeta->txn);
|
||||
|
||||
if (iCol == 0) {
|
||||
metaUpdateTagIdx(pMeta, &ctbEntry);
|
||||
}
|
||||
|
||||
tDecoderClear(&dc1);
|
||||
tDecoderClear(&dc2);
|
||||
if (ctbEntry.ctbEntry.pTags) taosMemoryFree((void *)ctbEntry.ctbEntry.pTags);
|
||||
|
@ -1131,7 +1132,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
|||
pCtbEntry->uid, &pTagIdxKey, &nTagIdxKey) < 0) {
|
||||
return -1;
|
||||
}
|
||||
tdbTbInsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, &pMeta->txn);
|
||||
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, &pMeta->txn);
|
||||
metaDestroyTagIdxKey(pTagIdxKey);
|
||||
tDecoderClear(&dc);
|
||||
tdbFree(pData);
|
||||
|
|
|
@ -385,6 +385,37 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
|
|||
.reverse = reverse,
|
||||
.filterFunc = filterFunc};
|
||||
|
||||
char buf[128] = {0};
|
||||
float f = 0.0;
|
||||
double d = 0.0;
|
||||
if (IS_VAR_DATA_TYPE(left->colValType)) {
|
||||
if (!IS_VAR_DATA_TYPE(right->colValType)) {
|
||||
NUM_TO_STRING(right->colValType, right->condValue, sizeof(buf) - 2, buf + VARSTR_HEADER_SIZE);
|
||||
varDataSetLen(buf, strlen(buf + VARSTR_HEADER_SIZE));
|
||||
param.val = buf;
|
||||
}
|
||||
} else {
|
||||
if (left->colValType == TSDB_DATA_TYPE_FLOAT) {
|
||||
if (right->colValType == TSDB_DATA_TYPE_DOUBLE) {
|
||||
f = GET_DOUBLE_VAL(right->condValue);
|
||||
param.val = &f;
|
||||
} else if (right->colValType == TSDB_DATA_TYPE_BIGINT) {
|
||||
f = *(int64_t *)(right->condValue);
|
||||
param.val = &f;
|
||||
} else {
|
||||
f = *(int32_t *)(right->condValue);
|
||||
param.val = &f;
|
||||
}
|
||||
} else if (left->colValType == TSDB_DATA_TYPE_DOUBLE) {
|
||||
if (right->colValType == TSDB_DATA_TYPE_DOUBLE) {
|
||||
d = GET_DOUBLE_VAL(right->condValue);
|
||||
param.val = &d;
|
||||
} else if (right->colValType == TSDB_DATA_TYPE_BIGINT) {
|
||||
d = *(int64_t *)(right->condValue);
|
||||
param.val = &d;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = metaFilterTableIds(arg->metaEx, ¶m, output->result);
|
||||
}
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue