Merge pull request #26333 from taosdata/fix/3.0/TS-5103

fix fill wrong timestamp value
This commit is contained in:
dapan1121 2024-07-01 16:42:21 +08:00 committed by GitHub
commit b16bf11280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -84,7 +84,9 @@ static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32
GET_TYPED_DATA(v, uint64_t, pVar->nType, &pVar->u);
colDataSetVal(pDst, rowIndex, (char*)&v, isNull);
} else if (pDst->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
colDataSetVal(pDst, rowIndex, (const char*)&currentKey, isNull);
int64_t v = 0;
GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->u);
colDataSetVal(pDst, rowIndex, (const char*)&v, isNull);
} else if (pDst->info.type == TSDB_DATA_TYPE_NCHAR || pDst->info.type == TSDB_DATA_TYPE_VARCHAR ||
pDst->info.type == TSDB_DATA_TYPE_VARBINARY) {
colDataSetVal(pDst, rowIndex, pVar->pz, isNull);

View File

@ -649,8 +649,8 @@ class TDTestCase:
tdSql.checkData(0,1,None)
tdSql.query(f"select ts , last_row(c1) ,c1 from (select ts , max(c1) c1 ,t1 from {dbname}.stb1 where ts >now -1h and ts <now+1h interval(10s) fill(value ,10, 10, 10))")
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,10)
tdSql.checkData(0,1,9)
tdSql.checkData(0,1,9)
tdSql.error(f"select ts , last_row(c1) ,c1 from (select count(c1) c1 from {dbname}.stb1 where ts >now -1h and ts <now+1h interval(10s) fill(value ,10, 10, 10))")