未验证 提交 004f6d95 编写于 作者: S shenglian-zhou 提交者: GitHub

Merge pull request #12297 from taosdata/feature/udf

fix: block extraction null set error
...@@ -493,7 +493,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3 ...@@ -493,7 +493,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
for (int32_t j = startIndex; j < (startIndex + rowCount); ++j) { for (int32_t j = startIndex; j < (startIndex + rowCount); ++j) {
bool isNull = false; bool isNull = false;
if (pBlock->pBlockAgg == NULL) { if (pBlock->pBlockAgg == NULL) {
isNull = colDataIsNull_s(pColData, pBlock->info.rows); isNull = colDataIsNull_s(pColData, j);
} else { } else {
isNull = colDataIsNull(pColData, pBlock->info.rows, j, pBlock->pBlockAgg[i]); isNull = colDataIsNull(pColData, pBlock->info.rows, j, pBlock->pBlockAgg[i]);
} }
......
...@@ -409,7 +409,7 @@ void udfdPipeCloseCb(uv_handle_t *pipe) { ...@@ -409,7 +409,7 @@ void udfdPipeCloseCb(uv_handle_t *pipe) {
void udfdUvHandleError(SUdfdUvConn *conn) { uv_close((uv_handle_t *)conn->client, udfdPipeCloseCb); } void udfdUvHandleError(SUdfdUvConn *conn) { uv_close((uv_handle_t *)conn->client, udfdPipeCloseCb); }
void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) {
fnDebug("udf read %zu bytes from client", nread); fnDebug("udf read %zd bytes from client", nread);
if (nread == 0) return; if (nread == 0) return;
SUdfdUvConn *conn = client->data; SUdfdUvConn *conn = client->data;
......
...@@ -64,7 +64,7 @@ if $data00 != 1.414213562 then ...@@ -64,7 +64,7 @@ if $data00 != 1.414213562 then
return -1 return -1
endi endi
#sql insert into t2 values(now+2s, 1, null)(now+3s, null, 2); sql insert into t2 values(now+2s, 1, null)(now+3s, null, 2);
#sql select udf1(f1, f2) from t2; #sql select udf1(f1, f2) from t2;
#print $rows , $data00 , $data10 , $data20 , $data30 #print $rows , $data00 , $data10 , $data20 , $data30
#if $rows != 4 then #if $rows != 4 then
...@@ -84,15 +84,15 @@ endi ...@@ -84,15 +84,15 @@ endi
#if $data30 != NULL then #if $data30 != NULL then
# return -1 # return -1
#endi #endi
#
#sql select udf2(f1, f2) from t2; sql select udf2(f1, f2) from t2;
#print $rows, $data00 print $rows, $data00
#if $rows != 1 then if $rows != 1 then
# return -1 return -1
#endi endi
#if $data00 != 2.645751311 then if $data00 != 2.645751311 then
# return -1 return -1
#endi endi
sql drop function udf1; sql drop function udf1;
sql show functions; sql show functions;
if $rows != 1 then if $rows != 1 then
......
...@@ -1242,11 +1242,11 @@ class TDTestCase: ...@@ -1242,11 +1242,11 @@ class TDTestCase:
# and or # and or
query_sql = f'select {select_elm} from {tb_name} where c7 > "binary" and c7 >= "binary8" or c7 < "binary9" and c7 <= "binary" and c7 != 2 and c7 <> 2 and c7 = 4 or c7 is not null and c7 between 2 and 4 and c7 not between 1 and 2 and c7 in (2,4) and c7 not in (1,2) or c7 match "binary[28]" or c7 nmatch "binary"' query_sql = f'select {select_elm} from {tb_name} where c7 > "binary" and c7 >= "binary8" or c7 < "binary9" and c7 <= "binary" and c7 != 2 and c7 <> 2 and c7 = 4 or c7 is not null and c7 between 2 and 4 and c7 not between 1 and 2 and c7 in (2,4) and c7 not in (1,2) or c7 match "binary[28]" or c7 nmatch "binary"'
tdSql.query(query_sql) tdSql.query(query_sql)
tdSql.checkRows(11) tdSql.checkRows(1)
tdSql.checkEqual(self.queryLastC10(query_sql), 11) if select_elm == "*" else False tdSql.checkEqual(self.queryLastC10(query_sql), 8) if select_elm == "*" else False
query_sql = f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c7 > "binary" and c7 >= "binary8" or c7 < "binary9" and c7 <= "binary" and c7 != 2 and c7 <> 2 and c7 = 4 or c7 is not null and c7 between 2 and 4 and c7 not between 1 and 2 and c7 in (2,4) and c7 not in (1,2) or c7 match "binary[28]" or c7 nmatch "binary"' query_sql = f'select c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 from {tb_name} where c7 > "binary" and c7 >= "binary8" or c7 < "binary9" and c7 <= "binary" and c7 != 2 and c7 <> 2 and c7 = 4 or c7 is not null and c7 between 2 and 4 and c7 not between 1 and 2 and c7 in (2,4) and c7 not in (1,2) or c7 match "binary[28]" or c7 nmatch "binary"'
tdSql.query(query_sql) tdSql.query(query_sql)
tdSql.checkRows(11) tdSql.checkRows(1)
def queryNcharCol(self, tb_name, check_elm=None): def queryNcharCol(self, tb_name, check_elm=None):
select_elm = "*" if check_elm is None else check_elm select_elm = "*" if check_elm is None else check_elm
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册