提交 e6534051 编写于 作者: K kailixu

refactor

上级 f24dca54
......@@ -111,6 +111,8 @@ typedef struct SParsedDataColInfo {
int8_t orderStatus; // bounded columns:
} SParsedDataColInfo;
#define IS_DATA_COL_ORDERED(s) (((s)->orderStatus) == (int8_t)ORDER_STATUS_ORDERED)
typedef struct {
SSchema * pSchema;
int16_t sversion;
......
......@@ -867,7 +867,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i
TDRowLenT kvRowColLen = 0;
TDRowLenT colValAppended = 0;
if (spd->orderStatus == ORDER_STATUS_DISORDERED) {
if (!IS_DATA_COL_ORDERED(spd)) {
ASSERT(spd->colIdxInfo != NULL);
if(!isPrimaryKey) {
kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN);
......@@ -1020,7 +1020,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn
void tscSetBoundColumnInfo(SParsedDataColInfo *pColInfo, SSchema *pSchema, int32_t numOfCols) {
pColInfo->numOfCols = numOfCols;
pColInfo->numOfBound = numOfCols;
pColInfo->orderStatus = ORDER_STATUS_UNKNOWN;
pColInfo->orderStatus = ORDER_STATUS_ORDERED;
pColInfo->boundedColumns = calloc(pColInfo->numOfCols, sizeof(int32_t));
pColInfo->cols = calloc(pColInfo->numOfCols, sizeof(SBoundColumn));
pColInfo->colIdxInfo = NULL;
......
......@@ -370,7 +370,7 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) {
bool isPrimaryKey = (colIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX);
// the primary key locates in 1st column
if (spd->orderStatus == ORDER_STATUS_DISORDERED) {
if (!IS_DATA_COL_ORDERED(spd)) {
ASSERT(spd->colIdxInfo != NULL);
if (!isPrimaryKey) {
kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN);
......@@ -406,7 +406,7 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) {
kvRowLen += TYPE_BYTES[pSchema->type];
}
if (spd->orderStatus == ORDER_STATUS_ORDERED) {
if (IS_DATA_COL_ORDERED(spd)) {
kvStart += PAYLOAD_COL_HEAD_LEN; // move to next column
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册