提交 ef18a45d 编写于 作者: D dapan1121

in data type convert

上级 bc7397a2
......@@ -112,9 +112,9 @@ typedef struct SExplainCtx {
#define EXPLAIN_ROW_NEW(level, ...) \
do { \
if (isVerboseLine) { \
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s", (level) * 2 + 3, ""); \
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s", (level) * 3 + 3, ""); \
} else { \
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s%s", (level) * 2, "", "-> "); \
tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s%s", (level) * 3, "", "-> "); \
} \
tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE - tlen, __VA_ARGS__); \
} while (0)
......
......@@ -652,7 +652,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
if (EXPLAIN_MODE_ANALYZE == ctx->mode) {
// sort key
EXPLAIN_ROW_NEW(level, "Sort Key: ");
EXPLAIN_ROW_NEW(level + 1, "Sort Key: ");
if (pResNode->pExecInfo) {
for (int32_t i = 0; i < LIST_LENGTH(pSortNode->pSortKeys); ++i) {
SOrderByExprNode *ptn = nodesListGetNode(pSortNode->pSortKeys, i);
......@@ -664,7 +664,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level));
// sort method
EXPLAIN_ROW_NEW(level, "Sort Method: ");
EXPLAIN_ROW_NEW(level + 1, "Sort Method: ");
int32_t nodeNum = taosArrayGetSize(pResNode->pExecInfo);
SExplainExecInfo *execInfo = taosArrayGet(pResNode->pExecInfo, 0);
......
......@@ -836,9 +836,13 @@ static EDealRes translateComparisonOperator(STranslateContext* pCxt, SOperatorNo
SDataType dt = ((SExprNode*)pNode)->resType;
if (first) {
targetDt = dt;
first = false;
} else if (!dataTypeEqual(&dt, &targetDt)) {
if (targetDt.type != TSDB_DATA_TYPE_NULL) {
first = false;
}
} else if (dt.type != targetDt.type && dt.type != TSDB_DATA_TYPE_NULL) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pNode)->aliasName);
} else if (dt.bytes > targetDt.bytes) {
targetDt.bytes = dt.bytes;
}
}
pRight->dataType = targetDt;
......
......@@ -879,11 +879,17 @@ int32_t vectorConvert(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam* p
}
if (type != GET_PARAM_TYPE(param1)) {
return vectorConvertScalarParam(param1, paramOut1, type);
code = vectorConvertScalarParam(param1, paramOut1, type);
if (code) {
return code;
}
}
if (type != GET_PARAM_TYPE(param2)) {
return vectorConvertScalarParam(param2, paramOut2, type);
code = vectorConvertScalarParam(param2, paramOut2, type);
if (code) {
return code;
}
}
return TSDB_CODE_SUCCESS;
......
......@@ -1066,9 +1066,7 @@ class TDTestCase:
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
# in
query_sql = f'select {select_elm} from {tb_name} where c5 in (1, 6.6)'
tdSql.query(query_sql)
tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 6) if select_elm == "*" else False
tdSql.error(query_sql)
# not in
query_sql = f'select {select_elm} from {tb_name} where c5 not in (2, 3)'
tdSql.query(query_sql)
......@@ -1076,14 +1074,10 @@ class TDTestCase:
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
# and
query_sql = f'select {select_elm} from {tb_name} where c5 > 0 and c5 >= 1 and c5 < 7 and c5 <= 6.6 and c5 != 2 and c5 <> 2 and c5 = 6.6 and c5 is not null and c5 between 2 and 6.6 and c5 not between 1 and 2 and c5 in (2,6.6) and c5 not in (1,2)'
tdSql.query(query_sql)
tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 6) if select_elm == "*" else False
tdSql.error(query_sql)
# or
query_sql = f'select {select_elm} from {tb_name} where c5 > 6 or c5 >= 6.6 or c5 < 1 or c5 <= 0 or c5 != 1.1 or c5 <> 1.1 or c5 = 5 or c5 is null or c5 between 4 and 5 or c5 not between 1 and 3 or c5 in (4,5) or c5 not in (1.1,3)'
tdSql.query(query_sql)
tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 6) if select_elm == "*" else False
tdSql.error(query_sql)
# and or
query_sql = f'select {select_elm} from {tb_name} where c5 > 0 and c5 >= 1 or c5 < 5 and c5 <= 6.6 and c5 != 2 and c5 <> 2 and c5 = 4 or c5 is not null and c5 between 2 and 4 and c5 not between 1 and 2 and c5 in (2,4) and c5 not in (1,2)'
tdSql.query(query_sql)
......@@ -1151,9 +1145,7 @@ class TDTestCase:
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
# in
query_sql = f'select {select_elm} from {tb_name} where c6 in (1, 7.7)'
tdSql.query(query_sql)
tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 7) if select_elm == "*" else False
tdSql.error(query_sql)
# not in
query_sql = f'select {select_elm} from {tb_name} where c6 not in (2, 3)'
tdSql.query(query_sql)
......@@ -1161,14 +1153,10 @@ class TDTestCase:
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
# and
query_sql = f'select {select_elm} from {tb_name} where c6 > 0 and c6 >= 1 and c6 < 8 and c6 <= 7.7 and c6 != 2 and c6 <> 2 and c6 = 7.7 and c6 is not null and c6 between 2 and 7.7 and c6 not between 1 and 2 and c6 in (2,7.7) and c6 not in (1,2)'
tdSql.query(query_sql)
tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 7) if select_elm == "*" else False
tdSql.error(query_sql)
# or
query_sql = f'select {select_elm} from {tb_name} where c6 > 7 or c6 >= 7.7 or c6 < 1 or c6 <= 0 or c6 != 1.1 or c6 <> 1.1 or c6 = 5 or c6 is null or c6 between 4 and 5 or c6 not between 1 and 3 or c6 in (4,5) or c6 not in (1.1,3)'
tdSql.query(query_sql)
tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 7) if select_elm == "*" else False
tdSql.error(query_sql)
# and or
query_sql = f'select {select_elm} from {tb_name} where c6 > 0 and c6 >= 1 or c6 < 5 and c6 <= 7.7 and c6 != 2 and c6 <> 2 and c6 = 4 or c6 is not null and c6 between 2 and 4 and c6 not between 1 and 2 and c6 in (2,4) and c6 not in (1,2)'
tdSql.query(query_sql)
......@@ -1410,9 +1398,7 @@ class TDTestCase:
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
# in
query_sql = f'select {select_elm} from {tb_name} where c9 in ("binar", false)'
tdSql.query(query_sql)
tdSql.checkRows(2)
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
tdSql.error(query_sql)
# # not in
query_sql = f'select {select_elm} from {tb_name} where c9 not in (true)'
tdSql.query(query_sql)
......@@ -1421,19 +1407,13 @@ class TDTestCase:
# # and
query_sql = f'select {select_elm} from {tb_name} where c9 = true and c9 != "false" and c9 <> "binary" and c9 is not null and c9 in ("binary", true) and c9 not in ("binary")'
tdSql.query(query_sql)
tdSql.checkRows(9)
tdSql.checkEqual(self.queryLastC10(query_sql), 9) if select_elm == "*" else False
tdSql.error(query_sql)
# # or
query_sql = f'select {select_elm} from {tb_name} where c9 = true or c9 != "false" or c9 <> "binary" or c9 = "true" or c9 is not null or c9 in ("binary", true) or c9 not in ("binary")'
tdSql.query(query_sql)
tdSql.checkRows(11)
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
tdSql.error(query_sql)
# # and or
query_sql = f'select {select_elm} from {tb_name} where c9 = true and c9 != "false" or c9 <> "binary" or c9 = "true" and c9 is not null or c9 in ("binary", true) or c9 not in ("binary")'
tdSql.query(query_sql)
tdSql.checkRows(11)
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False
tdSql.error(query_sql)
query_sql = f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c9 > "binary" and c9 >= "binary8" or c9 < "binary9" and c9 <= "binary" and c9 != 2 and c9 <> 2 and c9 = 4 or c9 is not null and c9 between 2 and 4 and c9 not between 1 and 2 and c9 in (2,4) and c9 not in (1,2)'
tdSql.query(query_sql)
tdSql.checkRows(9)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册