提交 ec6f7d25 编写于 作者: wmmhello's avatar wmmhello

add json->'key'=null support

上级 18160eb4
...@@ -4574,12 +4574,12 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t ...@@ -4574,12 +4574,12 @@ static int32_t validateNullExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t
const char* msg = "only support is [not] null"; const char* msg = "only support is [not] null";
tSqlExpr* pRight = pExpr->pRight; tSqlExpr* pRight = pExpr->pRight;
if (pRight->tokenId == TK_NULL && (!(pExpr->tokenId == TK_ISNULL || pExpr->tokenId == TK_NOTNULL))) { SSchema* pSchema = tscGetTableSchema(pTableMeta);
if (pRight->tokenId == TK_NULL && pSchema[index].type != TSDB_DATA_TYPE_JSON && (!(pExpr->tokenId == TK_ISNULL || pExpr->tokenId == TK_NOTNULL))) {
return invalidOperationMsg(msgBuf, msg); return invalidOperationMsg(msgBuf, msg);
} }
if (pRight->tokenId == TK_STRING) { if (pRight->tokenId == TK_STRING) {
SSchema* pSchema = tscGetTableSchema(pTableMeta);
if (IS_VAR_DATA_TYPE(pSchema[index].type) || pSchema[index].type == TSDB_DATA_TYPE_JSON) { if (IS_VAR_DATA_TYPE(pSchema[index].type) || pSchema[index].type == TSDB_DATA_TYPE_JSON) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -4728,6 +4728,11 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql ...@@ -4728,6 +4728,11 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
SStrToken* colName = NULL; SStrToken* colName = NULL;
if(pLeft->tokenId == TK_ARROW){ if(pLeft->tokenId == TK_ARROW){
colName = &(pLeft->pLeft->columnName); colName = &(pLeft->pLeft->columnName);
// transform for json->'key'=null
pRight->tokenId = TK_STRING;
pRight->value.nType = TSDB_DATA_TYPE_BINARY;
pRight->value.nLen = INT_BYTES;
*(uint32_t*)pRight->value.pz = TSDB_DATA_JSON_null;
}else{ }else{
colName = &(pLeft->columnName); colName = &(pLeft->columnName);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册