提交 98fc185e 编写于 作者: X Xiaoyu Wang

fix: escape character problem in auto create table insert

上级 0383ff3d
......@@ -105,7 +105,7 @@ typedef enum ENodeType {
QUERY_NODE_COLUMN_REF,
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR,
QUERY_NODE_SET_OPERATOR = 100,
QUERY_NODE_SELECT_STMT,
QUERY_NODE_VNODE_MODIF_STMT,
QUERY_NODE_CREATE_DATABASE_STMT,
......@@ -198,7 +198,7 @@ typedef enum ENodeType {
QUERY_NODE_QUERY,
// logic plan node
QUERY_NODE_LOGIC_PLAN_SCAN,
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
QUERY_NODE_LOGIC_PLAN_JOIN,
QUERY_NODE_LOGIC_PLAN_AGG,
QUERY_NODE_LOGIC_PLAN_PROJECT,
......@@ -215,7 +215,7 @@ typedef enum ENodeType {
QUERY_NODE_LOGIC_PLAN,
// physical plan node
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN,
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN,
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN,
......
......@@ -133,7 +133,6 @@ typedef enum EOperatorType {
OP_TYPE_REM,
// unary arithmetic operator
OP_TYPE_MINUS,
OP_TYPE_ASSIGN,
// bitwise operator
OP_TYPE_BIT_AND,
......@@ -164,7 +163,10 @@ typedef enum EOperatorType {
// json operator
OP_TYPE_JSON_GET_VALUE,
OP_TYPE_JSON_CONTAINS
OP_TYPE_JSON_CONTAINS,
// internal operator
OP_TYPE_ASSIGN
} EOperatorType;
#define OP_TYPE_CALC_MAX OP_TYPE_BIT_OR
......
......@@ -88,7 +88,7 @@ static const SSysDbTableSchema userDBSchema[] = {
{.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT},
{.name = "precision", .bytes = 2 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
{.name = "retention", .bytes = 60 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
{.name = "retentions", .bytes = 60 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
{.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL},
{.name = "cachemodel", .bytes = TSDB_CACHE_MODEL_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR},
{.name = "cachesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
......
......@@ -205,7 +205,7 @@ typedef struct SExprSupp {
} SExprSupp;
typedef struct SOperatorInfo {
uint8_t operatorType;
uint16_t operatorType;
bool blocking; // block operator or not
uint8_t status; // denote if current operator is completed
char* name; // name, for debug purpose
......@@ -434,7 +434,7 @@ typedef struct SStreamAggSupporter {
typedef struct SessionWindowSupporter {
SStreamAggSupporter* pStreamAggSup;
int64_t gap;
uint8_t parentType;
uint16_t parentType;
SAggSupporter* pIntervalAggSup;
} SessionWindowSupporter;
......
......@@ -1780,7 +1780,7 @@ void increaseTs(SqlFunctionCtx* pCtx) {
}
}
void initIntervalDownStream(SOperatorInfo* downstream, uint8_t type, SAggSupporter* pSup) {
void initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SAggSupporter* pSup) {
if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
// Todo(liuyao) support partition by column
return;
......@@ -2644,7 +2644,6 @@ void destroyTimeSliceOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear(param);
}
SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo) {
STimeSliceOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STimeSliceOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
......
......@@ -21,36 +21,89 @@
#include "taoserror.h"
#include "thash.h"
char *gOperatorStr[] = {NULL,
"+",
"-",
"*",
"/",
"%",
"-",
"&",
"|",
">",
">=",
"<",
"<=",
"=",
"<>",
"IN",
"NOT IN",
"LIKE",
"NOT LIKE",
"MATCH",
"NMATCH",
"IS NULL",
"IS NOT NULL",
"IS TRUE",
"IS FALSE",
"IS UNKNOWN",
"IS NOT TRUE",
"IS NOT FALSE",
"IS NOT UNKNOWN"};
char *gLogicConditionStr[] = {"AND", "OR", "NOT"};
static const char *operatorTypeStr(EOperatorType type) {
switch (type) {
case OP_TYPE_ADD:
return "+";
case OP_TYPE_SUB:
return "-";
case OP_TYPE_MULTI:
return "*";
case OP_TYPE_DIV:
return "/";
case OP_TYPE_REM:
return "%";
case OP_TYPE_MINUS:
return "-";
case OP_TYPE_BIT_AND:
return "&";
case OP_TYPE_BIT_OR:
return "|";
case OP_TYPE_GREATER_THAN:
return ">";
case OP_TYPE_GREATER_EQUAL:
return ">=";
case OP_TYPE_LOWER_THAN:
return "<";
case OP_TYPE_LOWER_EQUAL:
return "<=";
case OP_TYPE_EQUAL:
return "=";
case OP_TYPE_NOT_EQUAL:
return "<>";
case OP_TYPE_IN:
return "IN";
case OP_TYPE_NOT_IN:
return "NOT IN";
case OP_TYPE_LIKE:
return "LIKE";
case OP_TYPE_NOT_LIKE:
return "NOT LIKE";
case OP_TYPE_MATCH:
return "MATCH";
case OP_TYPE_NMATCH:
return "NMATCH";
case OP_TYPE_IS_NULL:
return "IS NULL";
case OP_TYPE_IS_NOT_NULL:
return "IS NOT NULL";
case OP_TYPE_IS_TRUE:
return "IS TRUE";
case OP_TYPE_IS_FALSE:
return "IS FALSE";
case OP_TYPE_IS_UNKNOWN:
return "IS UNKNOWN";
case OP_TYPE_IS_NOT_TRUE:
return "IS NOT TRUE";
case OP_TYPE_IS_NOT_FALSE:
return "IS NOT FALSE";
case OP_TYPE_IS_NOT_UNKNOWN:
return "IS NOT UNKNOWN";
case OP_TYPE_JSON_GET_VALUE:
return "=>";
case OP_TYPE_JSON_CONTAINS:
return "CONTAINS";
case OP_TYPE_ASSIGN:
return "=";
default:
break;
}
return "UNKNOWN";
}
static const char *logicConditionTypeStr(ELogicConditionType type) {
switch (type) {
case LOGIC_COND_TYPE_AND:
return "AND";
case LOGIC_COND_TYPE_OR:
return "OR";
case LOGIC_COND_TYPE_NOT:
return "NOT";
default:
break;
}
return "UNKNOWN";
}
int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) {
switch (pNode->type) {
......@@ -94,12 +147,7 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) {
NODES_ERR_RET(nodesNodeToSQL(pOpNode->pLeft, buf, bufSize, len));
}
if (pOpNode->opType >= (sizeof(gOperatorStr) / sizeof(gOperatorStr[0]))) {
nodesError("unknown operation type:%d", pOpNode->opType);
NODES_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
}
*len += snprintf(buf + *len, bufSize - *len, " %s ", gOperatorStr[pOpNode->opType]);
*len += snprintf(buf + *len, bufSize - *len, " %s ", operatorTypeStr(pOpNode->opType));
if (pOpNode->pRight) {
NODES_ERR_RET(nodesNodeToSQL(pOpNode->pRight, buf, bufSize, len));
......@@ -118,7 +166,7 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) {
FOREACH(node, pLogicNode->pParameterList) {
if (!first) {
*len += snprintf(buf + *len, bufSize - *len, " %s ", gLogicConditionStr[pLogicNode->condType]);
*len += snprintf(buf + *len, bufSize - *len, " %s ", logicConditionTypeStr(pLogicNode->condType));
}
NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len));
first = false;
......
......@@ -143,9 +143,9 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
}
char name[TSDB_DB_FNAME_LEN] = {0};
strncpy(name, pTableName->z, dbLen);
dbLen = strdequote(name);
int32_t actualDbLen = strdequote(name);
code = tNameSetDbName(pName, acctId, name, dbLen);
code = tNameSetDbName(pName, acctId, name, actualDbLen);
if (code != TSDB_CODE_SUCCESS) {
return buildInvalidOperationMsg(pMsgBuf, msg1);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册