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

TD-6129<feature> add tag?'key' in where logic

上级 ad25a756
...@@ -4464,7 +4464,9 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_ ...@@ -4464,7 +4464,9 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_
} }
SSchema* pSchema = tscGetTableSchema(pTableMeta); SSchema* pSchema = tscGetTableSchema(pTableMeta);
if ((pLeft->tokenId != TK_ARROW) && (!isTablenameToken(&pLeft->columnName)) && (pSchema[index].type != TSDB_DATA_TYPE_BINARY)) { if ((pLeft->tokenId != TK_ARROW) && (!isTablenameToken(&pLeft->columnName))
&& (pSchema[index].type != TSDB_DATA_TYPE_BINARY)
&& (pSchema[index].type == TSDB_DATA_TYPE_JSON && !JSON_TYPE_BINARY)) {
return invalidOperationMsg(msgBuf, msg2); return invalidOperationMsg(msgBuf, msg2);
} }
......
...@@ -94,6 +94,20 @@ class TDTestCase: ...@@ -94,6 +94,20 @@ class TDTestCase:
tdSql.query("select *,tbname from db_json_tag_test.jsons1 where jtag->'num'=5 or jtag?'sex'") tdSql.query("select *,tbname from db_json_tag_test.jsons1 where jtag->'num'=5 or jtag?'sex'")
tdSql.checkRows(2) tdSql.checkRows(2)
# test with tbname
tdSql.query("select * from db_json_tag_test.jsons1 where tbname = 'jsons1_1'")
tdSql.checkRows(1)
tdSql.query("select * from db_json_tag_test.jsons1 where tbname = 'jsons1_1' or jtag?'num'")
tdSql.checkRows(3)
tdSql.query("select * from db_json_tag_test.jsons1 where tbname = 'jsons1_1' and jtag?'num'")
tdSql.checkRows(0)
tdSql.query("select * from db_json_tag_test.jsons1 where tbname = 'jsons1_1' or jtag->'num'=5")
tdSql.checkRows(2)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册