Merge branch '3.0' into fix/initBackendHashmutex
This commit is contained in:
commit
f557d86609
|
@ -237,9 +237,9 @@ struct SScalarParam {
|
|||
int32_t numOfQualified; // number of qualified elements in the final results
|
||||
};
|
||||
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
||||
bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry);
|
||||
bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry);
|
||||
#define cleanupResultRowEntry(p) p->initialized = false
|
||||
#define isRowEntryCompleted(p) (p->complete)
|
||||
#define isRowEntryInitialized(p) (p->initialized)
|
||||
|
||||
typedef struct SPoint {
|
||||
int64_t key;
|
||||
|
|
|
@ -143,6 +143,7 @@ STSRow *tGetSubmitBlkNext(SSubmitBlkIter *pIter) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef BUILD_NO_CALL
|
||||
int32_t tPrintFixedSchemaSubmitReq(SSubmitReq *pReq, STSchema *pTschema) {
|
||||
SSubmitMsgIter msgIter = {0};
|
||||
if (tInitSubmitMsgIter(pReq, &msgIter) < 0) return -1;
|
||||
|
@ -161,6 +162,7 @@ int32_t tPrintFixedSchemaSubmitReq(SSubmitReq *pReq, STSchema *pTschema) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t tEncodeSEpSet(SEncoder *pEncoder, const SEpSet *pEp) {
|
||||
if (tEncodeI8(pEncoder, pEp->inUse) < 0) return -1;
|
||||
|
|
|
@ -17,6 +17,221 @@
|
|||
#include "trow.h"
|
||||
#include "tlog.h"
|
||||
|
||||
static bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal);
|
||||
static bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal);
|
||||
|
||||
void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
||||
pIter->pSchema = pSchema;
|
||||
pIter->maxColId = pSchema->columns[pSchema->numOfCols - 1].colId;
|
||||
}
|
||||
|
||||
void *tdGetBitmapAddr(STSRow *pRow, uint8_t rowType, uint32_t flen, col_id_t nKvCols) {
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
switch (rowType) {
|
||||
case TD_ROW_TP:
|
||||
return tdGetBitmapAddrTp(pRow, flen);
|
||||
case TD_ROW_KV:
|
||||
return tdGetBitmapAddrKv(pRow, nKvCols);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void tdSTSRowIterReset(STSRowIter *pIter, STSRow *pRow) {
|
||||
pIter->pRow = pRow;
|
||||
pIter->pBitmap = tdGetBitmapAddr(pRow, pRow->type, pIter->pSchema->flen, tdRowGetNCols(pRow));
|
||||
pIter->offset = 0;
|
||||
pIter->colIdx = 0; // PRIMARYKEY_TIMESTAMP_COL_ID;
|
||||
pIter->kvIdx = 0;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterFetch(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCellVal *pVal) {
|
||||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
pVal->val = &pIter->pRow->ts;
|
||||
pVal->valType = TD_VTYPE_NORM;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TD_IS_TP_ROW(pIter->pRow)) {
|
||||
STColumn *pCol = NULL;
|
||||
STSchema *pSchema = pIter->pSchema;
|
||||
while (pIter->colIdx < pSchema->numOfCols) {
|
||||
pCol = &pSchema->columns[pIter->colIdx]; // 1st column of schema is primary TS key
|
||||
if (colId == pCol->colId) {
|
||||
break;
|
||||
} else if (pCol->colId < colId) {
|
||||
++pIter->colIdx;
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||
++pIter->colIdx;
|
||||
} else if (TD_IS_KV_ROW(pIter->pRow)) {
|
||||
return tdSTSRowIterGetKvVal(pIter, colId, &pIter->kvIdx, pVal);
|
||||
} else {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
if (COL_REACH_END(colId, pIter->maxColId)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal) {
|
||||
STSRow *pRow = pIter->pRow;
|
||||
if (pRow->statis == 0) {
|
||||
pVal->valType = TD_VTYPE_NORM;
|
||||
if (IS_VAR_DATA_TYPE(colType)) {
|
||||
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
||||
} else {
|
||||
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->colIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pVal->valType == TD_VTYPE_NORM) {
|
||||
if (IS_VAR_DATA_TYPE(colType)) {
|
||||
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
||||
} else {
|
||||
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pValType = (((*pDestByte) & 0xC0) >> 6);
|
||||
break;
|
||||
case 1:
|
||||
*pValType = (((*pDestByte) & 0x30) >> 4);
|
||||
break;
|
||||
case 2:
|
||||
*pValType = (((*pDestByte) & 0x0C) >> 2);
|
||||
break;
|
||||
case 3:
|
||||
*pValType = ((*pDestByte) & 0x03);
|
||||
break;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS_I;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR_I;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pValType = (((*pDestByte) & 0x80) >> 7);
|
||||
break;
|
||||
case 1:
|
||||
*pValType = (((*pDestByte) & 0x40) >> 6);
|
||||
break;
|
||||
case 2:
|
||||
*pValType = (((*pDestByte) & 0x20) >> 5);
|
||||
break;
|
||||
case 3:
|
||||
*pValType = (((*pDestByte) & 0x10) >> 4);
|
||||
break;
|
||||
case 4:
|
||||
*pValType = (((*pDestByte) & 0x08) >> 3);
|
||||
break;
|
||||
case 5:
|
||||
*pValType = (((*pDestByte) & 0x04) >> 2);
|
||||
break;
|
||||
case 6:
|
||||
*pValType = (((*pDestByte) & 0x02) >> 1);
|
||||
break;
|
||||
case 7:
|
||||
*pValType = ((*pDestByte) & 0x01);
|
||||
break;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValType, int8_t bitmapMode) {
|
||||
switch (bitmapMode) {
|
||||
case 0:
|
||||
tdGetBitmapValTypeII(pBitmap, colIdx, pValType);
|
||||
break;
|
||||
case -1:
|
||||
case 1:
|
||||
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
||||
break;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal) {
|
||||
STSRow *pRow = pIter->pRow;
|
||||
SKvRowIdx *pKvIdx = NULL;
|
||||
bool colFound = false;
|
||||
col_id_t kvNCols = tdRowGetNCols(pRow) - 1;
|
||||
void *pColIdx = TD_ROW_COL_IDX(pRow);
|
||||
while (*nIdx < kvNCols) {
|
||||
pKvIdx = (SKvRowIdx *)POINTER_SHIFT(pColIdx, *nIdx * sizeof(SKvRowIdx));
|
||||
if (pKvIdx->colId == colId) {
|
||||
++(*nIdx);
|
||||
pVal->val = POINTER_SHIFT(pRow, pKvIdx->offset);
|
||||
colFound = true;
|
||||
break;
|
||||
} else if (pKvIdx->colId > colId) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
return true;
|
||||
} else {
|
||||
++(*nIdx);
|
||||
}
|
||||
}
|
||||
|
||||
if (!colFound) {
|
||||
if (colId <= pIter->maxColId) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->kvIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef BUILD_NO_CALL
|
||||
const uint8_t tdVTypeByte[2][3] = {{
|
||||
// 2 bits
|
||||
TD_VTYPE_NORM_BYTE_II,
|
||||
|
@ -34,8 +249,6 @@ const uint8_t tdVTypeByte[2][3] = {{
|
|||
|
||||
// declaration
|
||||
static uint8_t tdGetBitmapByte(uint8_t byte);
|
||||
static bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal);
|
||||
static bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal);
|
||||
static bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t flen, uint32_t offset,
|
||||
col_id_t colIdx, SCellVal *pVal);
|
||||
static bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, col_id_t colIdx, SCellVal *pVal);
|
||||
|
@ -199,38 +412,6 @@ bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t fl
|
|||
return true;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterFetch(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCellVal *pVal) {
|
||||
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
|
||||
pVal->val = &pIter->pRow->ts;
|
||||
pVal->valType = TD_VTYPE_NORM;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TD_IS_TP_ROW(pIter->pRow)) {
|
||||
STColumn *pCol = NULL;
|
||||
STSchema *pSchema = pIter->pSchema;
|
||||
while (pIter->colIdx < pSchema->numOfCols) {
|
||||
pCol = &pSchema->columns[pIter->colIdx]; // 1st column of schema is primary TS key
|
||||
if (colId == pCol->colId) {
|
||||
break;
|
||||
} else if (pCol->colId < colId) {
|
||||
++pIter->colIdx;
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal);
|
||||
++pIter->colIdx;
|
||||
} else if (TD_IS_KV_ROW(pIter->pRow)) {
|
||||
return tdSTSRowIterGetKvVal(pIter, colId, &pIter->kvIdx, pVal);
|
||||
} else {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
if (COL_REACH_END(colId, pIter->maxColId)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) {
|
||||
if (pIter->colIdx >= pIter->pSchema->numOfCols) {
|
||||
|
@ -258,71 +439,6 @@ bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterGetTpVal(STSRowIter *pIter, col_type_t colType, int32_t offset, SCellVal *pVal) {
|
||||
STSRow *pRow = pIter->pRow;
|
||||
if (pRow->statis == 0) {
|
||||
pVal->valType = TD_VTYPE_NORM;
|
||||
if (IS_VAR_DATA_TYPE(colType)) {
|
||||
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
||||
} else {
|
||||
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->colIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pVal->valType == TD_VTYPE_NORM) {
|
||||
if (IS_VAR_DATA_TYPE(colType)) {
|
||||
pVal->val = POINTER_SHIFT(pRow, *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(pRow), offset));
|
||||
} else {
|
||||
pVal->val = POINTER_SHIFT(TD_ROW_DATA(pRow), offset);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tdSTSRowIterGetKvVal(STSRowIter *pIter, col_id_t colId, col_id_t *nIdx, SCellVal *pVal) {
|
||||
STSRow *pRow = pIter->pRow;
|
||||
SKvRowIdx *pKvIdx = NULL;
|
||||
bool colFound = false;
|
||||
col_id_t kvNCols = tdRowGetNCols(pRow) - 1;
|
||||
void *pColIdx = TD_ROW_COL_IDX(pRow);
|
||||
while (*nIdx < kvNCols) {
|
||||
pKvIdx = (SKvRowIdx *)POINTER_SHIFT(pColIdx, *nIdx * sizeof(SKvRowIdx));
|
||||
if (pKvIdx->colId == colId) {
|
||||
++(*nIdx);
|
||||
pVal->val = POINTER_SHIFT(pRow, pKvIdx->offset);
|
||||
colFound = true;
|
||||
break;
|
||||
} else if (pKvIdx->colId > colId) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
return true;
|
||||
} else {
|
||||
++(*nIdx);
|
||||
}
|
||||
}
|
||||
|
||||
if (!colFound) {
|
||||
if (colId <= pIter->maxColId) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (tdGetBitmapValType(pIter->pBitmap, pIter->kvIdx - 1, &pVal->valType, 0) != TSDB_CODE_SUCCESS) {
|
||||
pVal->valType = TD_VTYPE_NONE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) {
|
||||
STColumn *pTColumn;
|
||||
SColVal *pColVal;
|
||||
|
@ -490,76 +606,6 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell
|
|||
return true;
|
||||
}
|
||||
|
||||
int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pValType = (((*pDestByte) & 0xC0) >> 6);
|
||||
break;
|
||||
case 1:
|
||||
*pValType = (((*pDestByte) & 0x30) >> 4);
|
||||
break;
|
||||
case 2:
|
||||
*pValType = (((*pDestByte) & 0x0C) >> 2);
|
||||
break;
|
||||
case 3:
|
||||
*pValType = ((*pDestByte) & 0x03);
|
||||
break;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
int16_t nBytes = colIdx / TD_VTYPE_PARTS_I;
|
||||
int16_t nOffset = colIdx & TD_VTYPE_OPTR_I;
|
||||
char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes);
|
||||
// use literal value directly and not use formula to simplify the codes
|
||||
switch (nOffset) {
|
||||
case 0:
|
||||
*pValType = (((*pDestByte) & 0x80) >> 7);
|
||||
break;
|
||||
case 1:
|
||||
*pValType = (((*pDestByte) & 0x40) >> 6);
|
||||
break;
|
||||
case 2:
|
||||
*pValType = (((*pDestByte) & 0x20) >> 5);
|
||||
break;
|
||||
case 3:
|
||||
*pValType = (((*pDestByte) & 0x10) >> 4);
|
||||
break;
|
||||
case 4:
|
||||
*pValType = (((*pDestByte) & 0x08) >> 3);
|
||||
break;
|
||||
case 5:
|
||||
*pValType = (((*pDestByte) & 0x04) >> 2);
|
||||
break;
|
||||
case 6:
|
||||
*pValType = (((*pDestByte) & 0x02) >> 1);
|
||||
break;
|
||||
case 7:
|
||||
*pValType = ((*pDestByte) & 0x01);
|
||||
break;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) {
|
||||
if (!pBitmap || colIdx < 0) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -944,21 +990,6 @@ int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols,
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValType, int8_t bitmapMode) {
|
||||
switch (bitmapMode) {
|
||||
case 0:
|
||||
tdGetBitmapValTypeII(pBitmap, colIdx, pValType);
|
||||
break;
|
||||
case -1:
|
||||
case 1:
|
||||
tdGetBitmapValTypeI(pBitmap, colIdx, pValType);
|
||||
break;
|
||||
default:
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
#if 0
|
||||
bool tdIsBitmapValTypeNorm(const void *pBitmap, int16_t idx, int8_t bitmapMode) {
|
||||
TDRowValT valType = 0;
|
||||
|
@ -1020,32 +1051,7 @@ int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void *tdGetBitmapAddr(STSRow *pRow, uint8_t rowType, uint32_t flen, col_id_t nKvCols) {
|
||||
#ifdef TD_SUPPORT_BITMAP
|
||||
switch (rowType) {
|
||||
case TD_ROW_TP:
|
||||
return tdGetBitmapAddrTp(pRow, flen);
|
||||
case TD_ROW_KV:
|
||||
return tdGetBitmapAddrKv(pRow, nKvCols);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void tdSTSRowIterReset(STSRowIter *pIter, STSRow *pRow) {
|
||||
pIter->pRow = pRow;
|
||||
pIter->pBitmap = tdGetBitmapAddr(pRow, pRow->type, pIter->pSchema->flen, tdRowGetNCols(pRow));
|
||||
pIter->offset = 0;
|
||||
pIter->colIdx = 0; // PRIMARYKEY_TIMESTAMP_COL_ID;
|
||||
pIter->kvIdx = 0;
|
||||
}
|
||||
|
||||
void tdSTSRowIterInit(STSRowIter *pIter, STSchema *pSchema) {
|
||||
pIter->pSchema = pSchema;
|
||||
pIter->maxColId = pSchema->columns[pSchema->numOfCols - 1].colId;
|
||||
}
|
||||
|
||||
void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColVal) {
|
||||
STColumn *pTColumn = &pTSchema->columns[iCol];
|
||||
|
@ -1079,3 +1085,4 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1875,7 +1875,7 @@ static int32_t lastIterOpen(SFSLastIter *iter, STFileSet *pFileSet, STsdb *pTsdb
|
|||
.backward = 1,
|
||||
.pSttFileBlockIterArray = pr->pLDataIterArray,
|
||||
.pCols = aCols,
|
||||
.numOfCols = nCols,
|
||||
.numOfCols = nCols + 1,
|
||||
.loadTombFn = loadSttTomb,
|
||||
.pReader = pr,
|
||||
.idstr = pr->idstr,
|
||||
|
|
|
@ -1266,6 +1266,7 @@ _exit:
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BUILD_NO_CALL
|
||||
static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock, SSubmitMsgIter *msgIter,
|
||||
const char *tags) {
|
||||
SSubmitBlkIter blkIter = {0};
|
||||
|
@ -1296,7 +1297,7 @@ static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock,
|
|||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
typedef struct SSubmitReqConvertCxt {
|
||||
SSubmitMsgIter msgIter;
|
||||
SSubmitBlk *pBlock;
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include "ttszip.h"
|
||||
#include "tudf.h"
|
||||
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo* pCell) { pCell->initialized = false; }
|
||||
|
||||
int32_t getNumOfResult(SqlFunctionCtx* pCtx, int32_t num, SSDataBlock* pResBlock) {
|
||||
int32_t maxRows = 0;
|
||||
|
||||
|
@ -59,9 +57,3 @@ int32_t getNumOfResult(SqlFunctionCtx* pCtx, int32_t num, SSDataBlock* pResBlock
|
|||
pResBlock->info.rows = maxRows;
|
||||
return maxRows;
|
||||
}
|
||||
|
||||
bool isRowEntryCompleted(struct SResultRowEntryInfo* pEntry) {
|
||||
return pEntry->complete;
|
||||
}
|
||||
|
||||
bool isRowEntryInitialized(struct SResultRowEntryInfo* pEntry) { return pEntry->initialized; }
|
||||
|
|
|
@ -64,7 +64,7 @@ class TwoClients:
|
|||
cursor2.execute("drop table t0")
|
||||
cursor2.execute("create table t0 using tb tags('beijing')")
|
||||
|
||||
tdSql.execute("insert into t0 values(now, 2, 'test')")
|
||||
tdSql.execute("insert into t0 values(now+1s, 2, 'test')")
|
||||
tdSql.query("select * from tb")
|
||||
tdSql.checkRows(1)
|
||||
|
||||
|
|
|
@ -52,10 +52,9 @@ class ConfigureyCluster:
|
|||
dnode.addExtraCfg("secondEp", f"{hostname}:{startPort_sec}")
|
||||
|
||||
# configure dnoe of independent mnodes
|
||||
if num <= self.mnodeNums and self.mnodeNums != 0 and independentMnode == True :
|
||||
if num <= self.mnodeNums and self.mnodeNums != 0 and independentMnode == "True" :
|
||||
tdLog.info(f"set mnode:{num} supportVnodes 0")
|
||||
dnode.addExtraCfg("supportVnodes", 0)
|
||||
# print(dnode)
|
||||
self.dnodes.append(dnode)
|
||||
return self.dnodes
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ class TDDnode:
|
|||
"locale": "en_US.UTF-8",
|
||||
"charset": "UTF-8",
|
||||
"asyncLog": "0",
|
||||
"DebugFlag": "131",
|
||||
"mDebugFlag": "143",
|
||||
"dDebugFlag": "143",
|
||||
"vDebugFlag": "143",
|
||||
|
|
|
@ -52,7 +52,7 @@ class TDTestCase:
|
|||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 0, i + 1)
|
||||
tdSql.checkData(0, 1, 'debugFlag')
|
||||
tdSql.checkData(0, 2, 0)
|
||||
tdSql.checkData(0, 2, 131)
|
||||
|
||||
tdSql.query("show dnode 1 variables like '%debugFlag'")
|
||||
tdSql.checkRows(23)
|
||||
|
|
|
@ -88,12 +88,12 @@ class TDTestCase:
|
|||
tdSql.execute(
|
||||
f"create table {dbname}.ntb_null(ts timestamp,c1 int,c2 double,c3 float,c4 bool)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, 1, 1.0, NULL, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, NULL, 2.0, 2.0, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, 2, NULL, NULL, false)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, NULL, 1.0, 1.0, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, NULL, 3.0, NULL, true)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, 3, NULL, 3.0, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now, 1, NULL, NULL, true)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now+1s, NULL, 2.0, 2.0, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now+2s, 2, NULL, NULL, false)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now+3s, NULL, 1.0, 1.0, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now+4s, NULL, 3.0, NULL, true)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now+5s, 3, NULL, 3.0, NULL)")
|
||||
tdSql.execute(f"insert into {dbname}.ntb_null values(now+6s, 1, NULL, NULL, true)")
|
||||
|
||||
tdSql.query(f"select diff(c1) from {dbname}.ntb_null")
|
||||
tdSql.checkRows(6)
|
||||
|
|
|
@ -1113,157 +1113,106 @@ class TDTestCase:
|
|||
tdLog.debug("test insert data into stable")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 100);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
tdSql.checkData(0, 1, 100)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname) values(now,'stable_1_1');")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 101);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
tdSql.checkData(0, 1, 101)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_int) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bigint) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_smallint) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_tinyint) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_float) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_double) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bool) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_binary) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_nchar) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_ts) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
qlist = ['q_int', 'q_bigint', 'q_smallint', 'q_tinyint', 'q_float', 'q_double', 'q_bool', 'q_binary', 'q_nchar', 'q_ts']
|
||||
for i in range(10):
|
||||
coulmn_name = qlist[i]
|
||||
tdSql.execute(f"insert into nested.stable_1 (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_1_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;",queryTimes=5)
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 111);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_int_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bigint_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_smallint_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_tinyint_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_float_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_double_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bool_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_binary_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_nchar_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_ts_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkData(0, 1, 111)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
q_null_list = ['q_int_null', 'q_bigint_null', 'q_smallint_null', 'q_tinyint_null', 'q_float_null', 'q_double_null', 'q_bool_null', 'q_binary_null', 'q_nchar_null', 'q_ts_null']
|
||||
for i in range(10):
|
||||
coulmn_name = q_null_list[i]
|
||||
tdSql.execute(f"insert into nested.stable_1 (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_1_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;",queryTimes=5)
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 121);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
tdSql.checkData(0, 1, 121)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname) values(now,'stable_null_data_1');")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 1);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_int) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bigint) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_smallint) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_tinyint) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_float) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_double) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bool) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_binary) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_nchar) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_ts) values(now,'stable_null_data_1',1);")
|
||||
tdSql.checkData(0, 1, 1)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = qlist[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_data (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_data_1',1);")
|
||||
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data group by tbname order by tbname;",queryTimes=5)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 11)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = q_null_list[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_data (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_data_1',1);")
|
||||
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 11);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_int_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bigint_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_smallint_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_tinyint_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_float_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_double_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bool_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_binary_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_nchar_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_ts_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 21);
|
||||
|
||||
tdSql.checkData(0, 1, 21)
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname) values(now,'stable_null_childtable_1');")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_childtable group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 1);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_int) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bigint) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_smallint) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_tinyint) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_float) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_double) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bool) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_binary) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_nchar) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_ts) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.checkData(0, 1, 1)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = qlist[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_childtable (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_childtable group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 11);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_int_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bigint_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_smallint_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_tinyint_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_float_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_double_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bool_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_binary_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_nchar_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_ts_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.checkData(0, 1, 11)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = q_null_list[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_childtable (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_childtable group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 21);
|
||||
tdSql.checkData(0, 1, 21)
|
||||
|
||||
def TS_3932_flushdb(self):
|
||||
tdLog.debug("test flush db and insert data into stable")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 121);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
|
||||
tdSql.checkData(0, 1, 121)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
qlist = ['q_int', 'q_bigint', 'q_smallint', 'q_tinyint', 'q_float', 'q_double', 'q_bool', 'q_binary', 'q_nchar', 'q_ts']
|
||||
q_null_list = ['q_int_null', 'q_bigint_null', 'q_smallint_null', 'q_tinyint_null', 'q_float_null', 'q_double_null', 'q_bool_null', 'q_binary_null', 'q_nchar_null', 'q_ts_null']
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname) values(now,'stable_1_1');")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 122);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_int) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bigint) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_smallint) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_tinyint) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_float) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_double) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bool) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_binary) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_nchar) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_ts) values(now,'stable_1_1',1);")
|
||||
tdSql.checkData(0, 1, 122)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = qlist[i]
|
||||
tdSql.execute(f"insert into nested.stable_1 (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_1_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 132);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_int_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bigint_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_smallint_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_tinyint_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_float_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_double_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_bool_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_binary_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_nchar_null) values(now,'stable_1_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_ts_null) values(now,'stable_1_1',1);")
|
||||
tdSql.checkData(0, 1, 132)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = q_null_list[i]
|
||||
tdSql.execute(f"insert into nested.stable_1 (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_1_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 1, 142);
|
||||
tdSql.checkData(1, 1, 200);
|
||||
tdSql.checkData(0, 1, 142)
|
||||
tdSql.checkData(1, 1, 200)
|
||||
|
||||
tdSql.query(f"insert into nested.stable_1 (ts,tbname,q_int) values(now,'stable_1_1',1) \
|
||||
tdSql.execute(f"insert into nested.stable_1 (ts,tbname,q_int) values(now,'stable_1_1',1) \
|
||||
nested.stable_1 (ts,tbname,q_bigint) values(now+1a,'stable_1_1',1)\
|
||||
nested.stable_1 (ts,tbname,q_smallint) values(now+2a,'stable_1_1',1)\
|
||||
nested.stable_1 (ts,tbname,q_tinyint) values(now+3a,'stable_1_1',1)\
|
||||
|
@ -1282,34 +1231,21 @@ class TDTestCase:
|
|||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data_1 group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 22);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_int) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bigint) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_smallint) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_tinyint) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_float) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_double) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bool) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_binary) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_nchar) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_ts) values(now,'stable_null_data_1',1);")
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = qlist[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_data (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_data_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 32);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_int_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bigint_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_smallint_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_tinyint_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_float_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_double_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_bool_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_binary_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_nchar_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_ts_null) values(now,'stable_null_data_1',1);")
|
||||
tdSql.checkData(0, 1, 32)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = q_null_list[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_data (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_data_1',1);")
|
||||
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_data group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 42);
|
||||
tdSql.checkData(0, 1, 42)
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_data (ts,tbname,q_int) values(now,'stable_null_data_1',1) \
|
||||
nested.stable_null_data (ts,tbname,q_bigint) values(now+1a,'stable_null_data_1',1)\
|
||||
|
@ -1330,32 +1266,18 @@ class TDTestCase:
|
|||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname) values(now,'stable_null_childtable_1');")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_childtable group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 22);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_int) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bigint) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_smallint) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_tinyint) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_float) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_double) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bool) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_binary) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_nchar) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_ts) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.checkData(0, 1, 22)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = qlist[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_childtable (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_childtable group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 32);
|
||||
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_int_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bigint_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_smallint_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_tinyint_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_float_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_double_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_bool_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_binary_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_nchar_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"insert into nested.stable_null_childtable (ts,tbname,q_ts_null) values(now,'stable_null_childtable_1',1);")
|
||||
tdSql.checkData(0, 1, 32)
|
||||
|
||||
for i in range(10):
|
||||
coulmn_name = q_null_list[i]
|
||||
tdSql.execute(f"insert into nested.stable_null_childtable (ts, tbname, {coulmn_name}) values(now+{i}s,'stable_null_childtable_1',1);")
|
||||
tdSql.query(f"select tbname,count(*) from nested.stable_null_childtable group by tbname order by tbname;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 1, 42);
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
//
|
||||
// The prefix search tree is a efficient storage words and search words tree, it support 95 visible ascii code character
|
||||
//
|
||||
#define FIRST_ASCII 40 // first visible char is '0'
|
||||
#define LAST_ASCII 122 // last visilbe char is 'z'
|
||||
#define FIRST_ASCII 32 // first visible char is '0'
|
||||
#define LAST_ASCII 126 // last visilbe char is 'z'
|
||||
|
||||
// capacity save char is 95
|
||||
#define CHAR_CNT (LAST_ASCII - FIRST_ASCII + 1)
|
||||
|
|
|
@ -95,7 +95,7 @@ bool insertToTree(STire* tire, char* word, int len) {
|
|||
STireNode** nodes = tire->root.d;
|
||||
for (int i = 0; i < len; i++) {
|
||||
m = word[i] - FIRST_ASCII;
|
||||
if (m < 0 || m > CHAR_CNT) {
|
||||
if (m < 0 || m >= CHAR_CNT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue