fix TD-645, TD-660

This commit is contained in:
Bomin Zhang 2020-06-17 11:54:18 +08:00
parent d1417b88d0
commit ff25ab6b14
3 changed files with 28 additions and 9 deletions

View File

@ -256,11 +256,30 @@ static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) {
SDataRow trow = (SDataRow)pBlk->data;
tdInitDataRow(trow, pSchema);
union {
char buf[sizeof(int64_t)];
tstr str;
} nullVal;
for (int32_t i = 0; i < pSchema->numOfCols; i++) {
STColumn *c = pSchema->columns + i;
char* val = (char*)row[i];
if (IS_VAR_DATA_TYPE(c->type)) {
val -= sizeof(VarDataLenT);
if (val == NULL) {
val = nullVal.buf;
if (c->type == TSDB_DATA_TYPE_BINARY) {
setNull(nullVal.str.data, TSDB_DATA_TYPE_BINARY, 1);
nullVal.str.len = 1;
} else {
setNull(nullVal.str.data, TSDB_DATA_TYPE_NCHAR, 4);
nullVal.str.len = 4;
}
} else {
val -= sizeof(VarDataLenT);
}
} else if (val == NULL) {
val = nullVal.buf;
setNull(val, c->type, c->bytes);
}
tdAppendColVal(trow, val, c->type, c->bytes, c->offset);
}

View File

@ -55,7 +55,7 @@ typedef enum {
typedef struct taosField {
char name[65];
uint8_t type;
short bytes;
uint16_t bytes;
} TAOS_FIELD;
#ifdef _TD_GO_DLL_

View File

@ -137,7 +137,7 @@ sleep 6000
sql insert into tb1 values (now, 2, 'taos')
sleep 3000
sql select * from strm
if $rows != 1 then
if $rows != 2 then
return -1
endi
if $data04 != 1 then
@ -148,7 +148,7 @@ sleep 6000
sql insert into tb1 values (now, 3, 'taos', 3);
sleep 3000
sql select * from strm
if $rows != 1 then
if $rows != 3 then
return -1
endi
if $data04 != 1 then
@ -188,9 +188,9 @@ sql create table tb using mt tags(1)
sleep 3000
sql insert into tb values ('2018-11-01 16:30:00.000', 1, 'insert', 1)
sql alter table mt drop column c3
# the below query should be deleted after bug fix
sql insert into tb values ('2018-11-01 16:29:59.000', 1, 'insert')
sql_error import into tb values ('2018-11-01 16:29:59.000', 1, 'import')
sql import into tb values ('2018-11-01 16:29:59.000', 1, 'import')
sql select * from tb order by ts desc
if $data01 != 1 then
return -1
@ -203,13 +203,13 @@ sql select * from tb order by ts desc
if $data03 != NULL then
return -1
endi
# the query below should be deleted after bug fix
sql reset query cache
sql insert into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3)
sql_error import into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3)
sql import into tb values ('2018-11-01 16:29:58.000', 2, 'import', 3)
sql import into tb values ('2018-11-01 16:39:58.000', 2, 'import', 3)
sql select * from tb order by ts desc
if $rows != 2 then
if $rows != 4 then
return -1
endi
if $data03 != 3 then