[TD-5578]<fix> the max length of like condition can be configured
This commit is contained in:
parent
5bc82ffc3f
commit
1c0cc17ea6
|
@ -144,6 +144,9 @@ keepColumnName 1
|
||||||
# max length of an SQL
|
# max length of an SQL
|
||||||
# maxSQLLength 65480
|
# maxSQLLength 65480
|
||||||
|
|
||||||
|
# max length of like
|
||||||
|
# maxLikeLength 100
|
||||||
|
|
||||||
# the maximum number of records allowed for super table time sorting
|
# the maximum number of records allowed for super table time sorting
|
||||||
# maxNumOfOrderedRes 100000
|
# maxNumOfOrderedRes 100000
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,6 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta* pChild, const char* name, v
|
||||||
STableMeta* tscTableMetaDup(STableMeta* pTableMeta);
|
STableMeta* tscTableMetaDup(STableMeta* pTableMeta);
|
||||||
SVgroupsInfo* tscVgroupsInfoDup(SVgroupsInfo* pVgroupsInfo);
|
SVgroupsInfo* tscVgroupsInfoDup(SVgroupsInfo* pVgroupsInfo);
|
||||||
|
|
||||||
int32_t tscGetTagFilterSerializeLen(SQueryInfo* pQueryInfo);
|
|
||||||
int32_t tscGetColFilterSerializeLen(SQueryInfo* pQueryInfo);
|
int32_t tscGetColFilterSerializeLen(SQueryInfo* pQueryInfo);
|
||||||
int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr, void* addr);
|
int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr, void* addr);
|
||||||
void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGroupInfo, SOperatorInfo* pOperator, char* sql, void* addr, int32_t stage, uint64_t qId);
|
void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGroupInfo, SOperatorInfo* pOperator, char* sql, void* addr, int32_t stage, uint64_t qId);
|
||||||
|
|
|
@ -4394,7 +4394,7 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, char* msgBuf) {
|
||||||
|
|
||||||
// check for like expression
|
// check for like expression
|
||||||
static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t index, char* msgBuf) {
|
static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t index, char* msgBuf) {
|
||||||
const char* msg1 = "wildcard string should be less than 20 characters";
|
const char* msg1 = "wildcard string should be less than %d characters";
|
||||||
const char* msg2 = "illegal column name";
|
const char* msg2 = "illegal column name";
|
||||||
|
|
||||||
tSqlExpr* pLeft = pExpr->pLeft;
|
tSqlExpr* pLeft = pExpr->pLeft;
|
||||||
|
@ -4402,7 +4402,9 @@ static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t
|
||||||
|
|
||||||
if (pExpr->tokenId == TK_LIKE) {
|
if (pExpr->tokenId == TK_LIKE) {
|
||||||
if (pRight->value.nLen > tsMaxLikeStringLen) {
|
if (pRight->value.nLen > tsMaxLikeStringLen) {
|
||||||
return invalidOperationMsg(msgBuf, msg1);
|
char tmp[64] = {0};
|
||||||
|
sprintf(tmp, msg1, tsMaxLikeStringLen);
|
||||||
|
return invalidOperationMsg(msgBuf, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
SSchema* pSchema = tscGetTableSchema(pTableMeta);
|
SSchema* pSchema = tscGetTableSchema(pTableMeta);
|
||||||
|
|
|
@ -678,8 +678,6 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql) {
|
||||||
|
|
||||||
int32_t srcColListSize = (int32_t)(taosArrayGetSize(pQueryInfo->colList) * sizeof(SColumnInfo));
|
int32_t srcColListSize = (int32_t)(taosArrayGetSize(pQueryInfo->colList) * sizeof(SColumnInfo));
|
||||||
int32_t srcColFilterSize = tscGetColFilterSerializeLen(pQueryInfo);
|
int32_t srcColFilterSize = tscGetColFilterSerializeLen(pQueryInfo);
|
||||||
int32_t srcTagFilterSize = tscGetTagFilterSerializeLen(pQueryInfo);
|
|
||||||
|
|
||||||
size_t numOfExprs = tscNumOfExprs(pQueryInfo);
|
size_t numOfExprs = tscNumOfExprs(pQueryInfo);
|
||||||
int32_t exprSize = (int32_t)(sizeof(SSqlExpr) * numOfExprs * 2);
|
int32_t exprSize = (int32_t)(sizeof(SSqlExpr) * numOfExprs * 2);
|
||||||
|
|
||||||
|
@ -700,8 +698,8 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql) {
|
||||||
tableSerialize = totalTables * sizeof(STableIdInfo);
|
tableSerialize = totalTables * sizeof(STableIdInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + srcColFilterSize + srcTagFilterSize +
|
return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + srcColFilterSize + exprSize + tsBufSize +
|
||||||
exprSize + tsBufSize + tableSerialize + sqlLen + 4096 + pQueryInfo->bufLen;
|
tableSerialize + sqlLen + 4096 + pQueryInfo->bufLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STableMetaInfo *pTableMetaInfo, char *pMsg,
|
static char *doSerializeTableInfo(SQueryTableMsg *pQueryMsg, SSqlObj *pSql, STableMetaInfo *pTableMetaInfo, char *pMsg,
|
||||||
|
@ -1037,7 +1035,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
SCond *pCond = tsGetSTableQueryCond(pTagCond, pTableMeta->id.uid);
|
SCond *pCond = tsGetSTableQueryCond(pTagCond, pTableMeta->id.uid);
|
||||||
if (pCond != NULL && pCond->cond != NULL) {
|
if (pCond != NULL && pCond->cond != NULL) {
|
||||||
pQueryMsg->tagCondLen = htonl(pCond->len);
|
pQueryMsg->tagCondLen = htons(pCond->len);
|
||||||
memcpy(pMsg, pCond->cond, pCond->len);
|
memcpy(pMsg, pCond->cond, pCond->len);
|
||||||
|
|
||||||
pMsg += pCond->len;
|
pMsg += pCond->len;
|
||||||
|
|
|
@ -4684,21 +4684,6 @@ int32_t tscGetColFilterSerializeLen(SQueryInfo* pQueryInfo) {
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tscGetTagFilterSerializeLen(SQueryInfo* pQueryInfo) {
|
|
||||||
// serialize tag column query condition
|
|
||||||
if (pQueryInfo->tagCond.pCond != NULL && taosArrayGetSize(pQueryInfo->tagCond.pCond) > 0) {
|
|
||||||
STagCond* pTagCond = &pQueryInfo->tagCond;
|
|
||||||
|
|
||||||
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
|
|
||||||
STableMeta * pTableMeta = pTableMetaInfo->pTableMeta;
|
|
||||||
SCond *pCond = tsGetSTableQueryCond(pTagCond, pTableMeta->id.uid);
|
|
||||||
if (pCond != NULL && pCond->cond != NULL) {
|
|
||||||
return pCond->len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr, void* addr) {
|
int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAttr, void* addr) {
|
||||||
memset(pQueryAttr, 0, sizeof(SQueryAttr));
|
memset(pQueryAttr, 0, sizeof(SQueryAttr));
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,7 @@ typedef struct {
|
||||||
int16_t numOfCols; // the number of columns will be load from vnode
|
int16_t numOfCols; // the number of columns will be load from vnode
|
||||||
SInterval interval;
|
SInterval interval;
|
||||||
SSessionWindow sw; // session window
|
SSessionWindow sw; // session window
|
||||||
uint32_t tagCondLen; // tag length in current query
|
uint16_t tagCondLen; // tag length in current query
|
||||||
uint32_t tbnameCondLen; // table name filter condition string length
|
uint32_t tbnameCondLen; // table name filter condition string length
|
||||||
int16_t numOfGroupCols; // num of group by columns
|
int16_t numOfGroupCols; // num of group by columns
|
||||||
int16_t orderByIdx;
|
int16_t orderByIdx;
|
||||||
|
|
|
@ -6898,7 +6898,7 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) {
|
||||||
pQueryMsg->numOfCols = htons(pQueryMsg->numOfCols);
|
pQueryMsg->numOfCols = htons(pQueryMsg->numOfCols);
|
||||||
pQueryMsg->numOfOutput = htons(pQueryMsg->numOfOutput);
|
pQueryMsg->numOfOutput = htons(pQueryMsg->numOfOutput);
|
||||||
pQueryMsg->numOfGroupCols = htons(pQueryMsg->numOfGroupCols);
|
pQueryMsg->numOfGroupCols = htons(pQueryMsg->numOfGroupCols);
|
||||||
pQueryMsg->tagCondLen = htonl(pQueryMsg->tagCondLen);
|
pQueryMsg->tagCondLen = htons(pQueryMsg->tagCondLen);
|
||||||
pQueryMsg->tsBuf.tsOffset = htonl(pQueryMsg->tsBuf.tsOffset);
|
pQueryMsg->tsBuf.tsOffset = htonl(pQueryMsg->tsBuf.tsOffset);
|
||||||
pQueryMsg->tsBuf.tsLen = htonl(pQueryMsg->tsBuf.tsLen);
|
pQueryMsg->tsBuf.tsLen = htonl(pQueryMsg->tsBuf.tsLen);
|
||||||
pQueryMsg->tsBuf.tsNumOfBlocks = htonl(pQueryMsg->tsBuf.tsNumOfBlocks);
|
pQueryMsg->tsBuf.tsNumOfBlocks = htonl(pQueryMsg->tsBuf.tsNumOfBlocks);
|
||||||
|
|
Loading…
Reference in New Issue