fix: float and double tsz check
This commit is contained in:
parent
b4621bb37c
commit
0029c348c5
|
@ -35,8 +35,8 @@
|
|||
"start_timestamp":"now-12d",
|
||||
"columns": [
|
||||
{ "type": "bool", "name": "bc"},
|
||||
{ "type": "float", "name": "fc" },
|
||||
{ "type": "double", "name": "dc"},
|
||||
{ "type": "float", "name": "fc", "min": 100, "min": 100},
|
||||
{ "type": "double", "name": "dc", "min": 200, "min": 200},
|
||||
{ "type": "tinyint", "name": "ti"},
|
||||
{ "type": "smallint", "name": "si" },
|
||||
{ "type": "int", "name": "ic" },
|
||||
|
|
|
@ -52,6 +52,16 @@ class TDTestCase(TBase):
|
|||
sql = f"create table {self.db}.ta(ts timestamp, age int) tags(area int)"
|
||||
tdSql.execute(sql)
|
||||
|
||||
def checkFloatDouble(self):
|
||||
sql = f"select count(*) from {self.db}.{self.stb} where fc!=100"
|
||||
tdSql.checkFirstValue(sql, 0)
|
||||
sql = f"select count(*) from {self.db}.{self.stb} where dc!=200"
|
||||
tdSql.checkFirstValue(sql, 0)
|
||||
sql = f"select avg(fc) from {self.db}.{self.stb}"
|
||||
tdSql.checkFirstValue(sql, 100)
|
||||
sql = f"select avg(dc) from {self.db}.{self.stb}"
|
||||
tdSql.checkFirstValue(sql, 200)
|
||||
|
||||
def doAction(self):
|
||||
tdLog.info(f"do action.")
|
||||
self.flushDb()
|
||||
|
@ -89,6 +99,9 @@ class TDTestCase(TBase):
|
|||
# check insert data correct
|
||||
self.checkInsertCorrect()
|
||||
|
||||
# check float double value ok
|
||||
tdSql.checkFloatDouble()
|
||||
|
||||
# save
|
||||
self.snapshotAgg()
|
||||
|
||||
|
@ -101,6 +114,10 @@ class TDTestCase(TBase):
|
|||
# check insert correct again
|
||||
self.checkInsertCorrect()
|
||||
|
||||
# check float double value ok
|
||||
tdSql.checkFloatDouble()
|
||||
|
||||
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
|
||||
|
|
|
@ -385,9 +385,11 @@ unsigned int optimize_intervals_double_1D_opt(double *oriData, size_t dataLength
|
|||
totalSampleSize++;
|
||||
pred_value = data_pos[-1];
|
||||
pred_err = fabs(pred_value - *data_pos);
|
||||
radiusIndex = (unsigned long)((pred_err/realPrecision+1)/2);
|
||||
if(radiusIndex>=confparams_cpr->maxRangeRadius)
|
||||
double dbri = (unsigned long)((pred_err/realPrecision+1)/2);
|
||||
if(dbri >= (double)confparams_cpr->maxRangeRadius)
|
||||
radiusIndex = confparams_cpr->maxRangeRadius - 1;
|
||||
else
|
||||
radiusIndex = dbri;
|
||||
intervals[radiusIndex]++;
|
||||
|
||||
data_pos += confparams_cpr->sampleDistance;
|
||||
|
|
Loading…
Reference in New Issue