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