提交 7f53d257 编写于 作者: S shenglian zhou

(query):fix bugs of substr

上级 4da26e6b
...@@ -1610,7 +1610,7 @@ void vectorSubstrFunc(int16_t functionId, tExprOperandInfo *pInputs, int32_t num ...@@ -1610,7 +1610,7 @@ void vectorSubstrFunc(int16_t functionId, tExprOperandInfo *pInputs, int32_t num
continue; continue;
} }
int16_t strBytes = varDataLen(pInputs[0].data); int16_t strBytes = varDataLen(inputData);
int32_t resultStartBytes = 0; int32_t resultStartBytes = 0;
if (subPosChar > 0) { if (subPosChar > 0) {
int32_t subPosBytes = (pInputs[0].type == TSDB_DATA_TYPE_BINARY) ? subPosChar-1 : (subPosChar-1) * TSDB_NCHAR_SIZE; int32_t subPosBytes = (pInputs[0].type == TSDB_DATA_TYPE_BINARY) ? subPosChar-1 : (subPosChar-1) * TSDB_NCHAR_SIZE;
...@@ -1629,7 +1629,7 @@ void vectorSubstrFunc(int16_t functionId, tExprOperandInfo *pInputs, int32_t num ...@@ -1629,7 +1629,7 @@ void vectorSubstrFunc(int16_t functionId, tExprOperandInfo *pInputs, int32_t num
varDataSetLen(outputData, resultLenBytes); varDataSetLen(outputData, resultLenBytes);
if (resultLenBytes > 0) { if (resultLenBytes > 0) {
memcpy(varDataVal(outputData), varDataVal(inputData), resultLenBytes); memcpy(varDataVal(outputData), varDataVal(inputData) + resultStartBytes, resultLenBytes);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册