提交 f28a29a8 编写于 作者: W wenzhouwww

[TD-5661]<test> : let the test case about nano support for connector runing on CI !

上级 8db12cdf
......@@ -234,11 +234,16 @@ pipeline {
cd ${WKC}/tests/examples/nodejs
npm install td2.0-connector > /dev/null 2>&1
node nodejsChecker.js host=localhost
node ../../connectorTest/nodejsTest/nanosupport/nanosecondTest.js
'''
sh '''
cd ${WKC}/tests/examples/C#/taosdemo
mcs -out:taosdemo *.cs > /dev/null 2>&1
echo '' |./taosdemo
cd ${WKC}/tests/connectorTest/C#Test/nanosupport
mcs -out:nano *.cs > /dev/null 2>&1
echo '' |./nano
'''
sh '''
cd ${WKC}/tests/gotest
......
const taos = require('../tdengine');
var conn = taos.connect({config:"/etc/taos"});
const taos = require('td2.0-connector');
var conn = taos.connect({host:"localhost", user:"root", password:"taosdata", config:"/etc/taos",port:6030})
var c1 = conn.cursor();
......@@ -16,8 +16,8 @@ function checkData(sql,row,col,data){
}
else{
console.log('check failed')
console.log(checkdata)
console.log(data)
console.log('checked is :',checkdata)
console.log("expected is :",data)
}
......
......@@ -19,3 +19,6 @@ go env -w GOPROXY=https://goproxy.io,direct
bash ./case001/case001.sh $severIp $serverPort
#bash ./case002/case002.sh $severIp $serverPort
#bash ./case003/case003.sh $severIp $serverPort
cd nanosupport
go run main.go
......@@ -3,12 +3,13 @@ package connector
import (
"context"
"fmt"
"reflect"
"time"
"github.com/taosdata/go-utils/log"
"github.com/taosdata/go-utils/tdengine/config"
"github.com/taosdata/go-utils/tdengine/connector"
tdengineExecutor "github.com/taosdata/go-utils/tdengine/executor"
"reflect"
"time"
)
type Executor struct {
......@@ -34,6 +35,7 @@ func (e *Executor) Execute(sql string) (int64, error) {
return e.executor.DoExec(e.ctx, sql)
}
func (e *Executor) Query(sql string) (*connector.Data, error) {
fmt.Println("query :", sql)
return e.executor.DoQuery(e.ctx, sql)
}
func (e *Executor) CheckData(row, col int, value interface{}, data *connector.Data) (bool, error) {
......@@ -101,109 +103,106 @@ func (e *Executor) CheckData(row, col int, value interface{}, data *connector.Da
return true, nil
}
func (e *Executor) CheckData2(row, col int, value interface{}, data *connector.Data) {
match ,err := e.CheckData(row, col,value, data)
func (e *Executor) CheckData2(row, col int, value interface{}, data *connector.Data) {
match, err := e.CheckData(row, col, value, data)
fmt.Println("expect data is :", value)
fmt.Println("go got data is :", data.Data[row][col])
if err != nil {
fmt.Println(err)
fmt.Println("expect data is :" , value)
fmt.Println("go got data is :" , data.Data[row][col])
}
if !match {
fmt.Println(" data not match")
}
/*
fmt.Println(value)
if data == nil {
// return false, fmt.Errorf("data is nil")
// fmt.Println("check failed")
}
if col >= len(data.Head) {
// return false, fmt.Errorf("col out of data")
// fmt.Println("check failed")
}
if row >= len(data.Data) {
// return false, fmt.Errorf("row out of data")
// fmt.Println("check failed")
}
dataValue := data.Data[row][col]
if dataValue == nil && value != nil {
// return false, fmt.Errorf("dataValue is nil but value is not nil")
// fmt.Println("check failed")
}
if dataValue == nil && value == nil {
// return true, nil
fmt.Println("check pass")
}
if reflect.TypeOf(dataValue) != reflect.TypeOf(value) {
// return false, fmt.Errorf("type not match expect %s got %s", reflect.TypeOf(value), reflect.TypeOf(dataValue))
fmt.Println("check failed")
}
switch value.(type) {
case time.Time:
t, _ := dataValue.(time.Time)
if value.(time.Time).Nanosecond() != t.Nanosecond() {
// return false, fmt.Errorf("value not match expect %d got %d", value.(time.Time).Nanosecond(), t.Nanosecond())
// fmt.Println("check failed")
}
case string:
if value.(string) != dataValue.(string) {
// return false, fmt.Errorf("value not match expect %s got %s", value.(string), dataValue.(string))
// fmt.Println("check failed")
}
case int8:
if value.(int8) != dataValue.(int8) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int8), dataValue.(int8))
// fmt.Println("check failed")
}
case int16:
if value.(int16) != dataValue.(int16) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int16), dataValue.(int16))
/*
fmt.Println(value)
if data == nil {
// return false, fmt.Errorf("data is nil")
// fmt.Println("check failed")
}
case int32:
if value.(int32) != dataValue.(int32) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int32), dataValue.(int32))
if col >= len(data.Head) {
// return false, fmt.Errorf("col out of data")
// fmt.Println("check failed")
}
case int64:
if value.(int64) != dataValue.(int64) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int64), dataValue.(int64))
if row >= len(data.Data) {
// return false, fmt.Errorf("row out of data")
// fmt.Println("check failed")
}
case float32:
if value.(float32) != dataValue.(float32) {
// return false, fmt.Errorf("value not match expect %f got %f", value.(float32), dataValue.(float32))
// fmt.Println("check failed")
}
case float64:
if value.(float64) != dataValue.(float64) {
// return false, fmt.Errorf("value not match expect %f got %f", value.(float32), dataValue.(float32))
dataValue := data.Data[row][col]
if dataValue == nil && value != nil {
// return false, fmt.Errorf("dataValue is nil but value is not nil")
// fmt.Println("check failed")
}
case bool:
if value.(bool) != dataValue.(bool) {
// return false, fmt.Errorf("value not match expect %t got %t", value.(bool), dataValue.(bool))
if dataValue == nil && value == nil {
// return true, nil
fmt.Println("check pass")
}
if reflect.TypeOf(dataValue) != reflect.TypeOf(value) {
// return false, fmt.Errorf("type not match expect %s got %s", reflect.TypeOf(value), reflect.TypeOf(dataValue))
fmt.Println("check failed")
}
switch value.(type) {
case time.Time:
t, _ := dataValue.(time.Time)
if value.(time.Time).Nanosecond() != t.Nanosecond() {
// return false, fmt.Errorf("value not match expect %d got %d", value.(time.Time).Nanosecond(), t.Nanosecond())
// fmt.Println("check failed")
}
case string:
if value.(string) != dataValue.(string) {
// return false, fmt.Errorf("value not match expect %s got %s", value.(string), dataValue.(string))
// fmt.Println("check failed")
}
case int8:
if value.(int8) != dataValue.(int8) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int8), dataValue.(int8))
// fmt.Println("check failed")
}
case int16:
if value.(int16) != dataValue.(int16) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int16), dataValue.(int16))
// fmt.Println("check failed")
}
case int32:
if value.(int32) != dataValue.(int32) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int32), dataValue.(int32))
// fmt.Println("check failed")
}
case int64:
if value.(int64) != dataValue.(int64) {
// return false, fmt.Errorf("value not match expect %d got %d", value.(int64), dataValue.(int64))
// fmt.Println("check failed")
}
case float32:
if value.(float32) != dataValue.(float32) {
// return false, fmt.Errorf("value not match expect %f got %f", value.(float32), dataValue.(float32))
// fmt.Println("check failed")
}
case float64:
if value.(float64) != dataValue.(float64) {
// return false, fmt.Errorf("value not match expect %f got %f", value.(float32), dataValue.(float32))
// fmt.Println("check failed")
}
case bool:
if value.(bool) != dataValue.(bool) {
// return false, fmt.Errorf("value not match expect %t got %t", value.(bool), dataValue.(bool))
// fmt.Println("check failed")
}
default:
// return false, fmt.Errorf("unsupport type %v", reflect.TypeOf(value))
// fmt.Println("check failed")
}
default:
// return false, fmt.Errorf("unsupport type %v", reflect.TypeOf(value))
// fmt.Println("check failed")
}
// return true, nil
// fmt.Println("check pass")
// return true, nil
// fmt.Println("check pass")
*/
}
func (e *Executor) CheckRow(count int, data *connector.Data) {
func (e *Executor) CheckRow(count int, data *connector.Data) {
if len(data.Data) != count{
fmt.Println("check failed !")
if len(data.Data) != count {
fmt.Println("check failed !")
}
}
......@@ -2,10 +2,11 @@ package main
import (
"fmt"
"github.com/taosdata/go-utils/tdengine/config"
"log"
"taos/connector"
"time"
"github.com/taosdata/go-utils/tdengine/config"
)
func main() {
......@@ -31,87 +32,85 @@ func main() {
t3, _ := time.Parse(layout, "2021-06-10 00:00:00.300000000")
t4, _ := time.Parse(layout, "2021-06-10 00:00:00.300000001")
t5, _ := time.Parse(layout, "2021-06-10 00:00:00.999999999")
e.CheckData2(0, 0, t0, data)
e.CheckData2(1, 0, t1, data)
e.CheckData2(2, 0, t2, data)
e.CheckData2(3, 0, t3, data)
e.CheckData2(4, 0, t4, data)
e.CheckData2(5, 0, t5, data)
e.CheckData2(3 ,1 , int32(3), data)
e.CheckData2(4, 1, int32(5), data)
e.CheckData2(5, 1, int32(7), data)
e.CheckData2(3, 1, int32(3), data)
e.CheckData2(4, 1, int32(5), data)
e.CheckData2(5, 1, int32(7), data)
fmt.Println(" start check nano support!")
data, _= e.Query("select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400100000002;")
e.CheckData2(0,0,int64(1),data)
data, _= e.Query("select count(*) from tb where ts > \"2021-06-10 0:00:00.100000001\" and ts < \"2021-06-10 0:00:00.160000000\";")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400100000002;")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400150000000;")
e.CheckData2(0,0,int64(1),data)
data, _= e.Query("select count(*) from tb where ts > \"2021-06-10 0:00:00.100000000\" and ts < \"2021-06-10 0:00:00.150000000\";")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb where ts > \"2021-06-10 0:00:00.100000001\" and ts < \"2021-06-10 0:00:00.160000000\";")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb where ts > 1623254400400000000;")
e.CheckData2(0,0,int64(1),data)
data, _= e.Query("select count(*) from tb where ts < \"2021-06-10 00:00:00.400000000\";")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400150000000;")
e.CheckData2(0, 0, int64(1), data)
data, _ = e.Query("select count(*) from tb where ts > \"2021-06-10 0:00:00.100000000\" and ts < \"2021-06-10 0:00:00.150000000\";")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb where ts < now + 400000000b;")
e.CheckData2(0,0,int64(6),data)
data, _ = e.Query("select count(*) from tb where ts > 1623254400400000000;")
e.CheckData2(0, 0, int64(1), data)
data, _ = e.Query("select count(*) from tb where ts < \"2021-06-10 00:00:00.400000000\";")
e.CheckData2(0, 0, int64(5), data)
data, _= e.Query("select count(*) from tb where ts >= \"2021-06-10 0:00:00.100000001\";")
e.CheckData2(0,0,int64(6),data)
data, _ = e.Query("select count(*) from tb where ts < now + 400000000b;")
e.CheckData2(0, 0, int64(6), data)
data, _= e.Query("select count(*) from tb where ts <= 1623254400300000000;")
e.CheckData2(0,0,int64(4),data)
data, _ = e.Query("select count(*) from tb where ts >= \"2021-06-10 0:00:00.100000001\";")
e.CheckData2(0, 0, int64(6), data)
data, _= e.Query("select count(*) from tb where ts = \"2021-06-10 0:00:00.000000000\";")
data, _ = e.Query("select count(*) from tb where ts <= 1623254400300000000;")
e.CheckData2(0, 0, int64(4), data)
data, _= e.Query("select count(*) from tb where ts = 1623254400150000000;")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb where ts = \"2021-06-10 0:00:00.000000000\";")
data, _= e.Query("select count(*) from tb where ts = \"2021-06-10 0:00:00.100000001\";")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb where ts = 1623254400150000000;")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb where ts between 1623254400000000000 and 1623254400400000000;")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb where ts = \"2021-06-10 0:00:00.100000001\";")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb where ts between \"2021-06-10 0:00:00.299999999\" and \"2021-06-10 0:00:00.300000001\";")
e.CheckData2(0,0,int64(3),data)
data, _ = e.Query("select count(*) from tb where ts between 1623254400000000000 and 1623254400400000000;")
e.CheckData2(0, 0, int64(5), data)
data, _ = e.Query("select count(*) from tb where ts between \"2021-06-10 0:00:00.299999999\" and \"2021-06-10 0:00:00.300000001\";")
e.CheckData2(0, 0, int64(3), data)
data, _ = e.Query("select avg(speed) from tb interval(5000000000b);")
e.CheckRow(1, data)
data, _= e.Query("select avg(speed) from tb interval(5000000000b);")
e.CheckRow(1,data)
data, _ = e.Query("select avg(speed) from tb interval(100000000b)")
e.CheckRow(4, data)
data, _= e.Query("select avg(speed) from tb interval(100000000b)")
e.CheckRow(4,data)
data, _ = e.Query("select avg(speed) from tb interval(1000b);")
e.CheckRow(5, data)
data, _= e.Query("select avg(speed) from tb interval(1000b);")
e.CheckRow(5,data)
data, _= e.Query("select avg(speed) from tb interval(1u);")
e.CheckRow(5,data)
data, _ = e.Query("select avg(speed) from tb interval(1u);")
e.CheckRow(5, data)
data, _= e.Query("select avg(speed) from tb interval(100000000b) sliding (100000000b);")
e.CheckRow(4,data)
data, _ = e.Query("select avg(speed) from tb interval(100000000b) sliding (100000000b);")
e.CheckRow(4, data)
data, _= e.Query("select last(*) from tb")
data, _ = e.Query("select last(*) from tb")
tt, _ := time.Parse(layout, "2021-06-10 0:00:00.999999999")
e.CheckData2(0,0,tt,data)
e.CheckData2(0, 0, tt, data)
data, _= e.Query("select first(*) from tb")
data, _ = e.Query("select first(*) from tb")
tt1, _ := time.Parse(layout, "2021-06-10 0:00:00.100000001")
e.CheckData2(0,0,tt1,data)
e.CheckData2(0, 0, tt1, data)
e.Execute("insert into tb values(now + 500000000b, 6);")
data, _= e.Query("select * from tb;")
e.CheckRow(7,data)
data, _ = e.Query("select * from tb;")
e.CheckRow(7, data)
e.Execute("create table tb2 (ts timestamp, speed int, ts2 timestamp);")
e.Execute("insert into tb2 values(\"2021-06-10 0:00:00.100000001\", 1, \"2021-06-11 0:00:00.100000001\");")
e.Execute("insert into tb2 values(1623254400150000000, 2, 1623340800150000000);")
......@@ -120,124 +119,120 @@ func main() {
e.Execute("insert into tb2 values(1623254400300000001, 5, 1623340800300000001);")
e.Execute("insert into tb2 values(1623254400999999999, 7, 1623513600999999999);")
data, _= e.Query("select * from tb2;")
data, _ = e.Query("select * from tb2;")
tt2, _ := time.Parse(layout, "2021-06-10 0:00:00.100000001")
tt3, _ := time.Parse(layout, "2021-06-10 0:00:00.150000000")
e.CheckData2(0,0,tt2,data)
e.CheckData2(1,0,tt3,data)
e.CheckData2(2,1,int32(4),data)
e.CheckData2(3,1,int32(3),data)
e.CheckData2(0, 0, tt2, data)
e.CheckData2(1, 0, tt3, data)
e.CheckData2(2, 1, int32(4), data)
e.CheckData2(3, 1, int32(3), data)
tt4, _ := time.Parse(layout, "2021-06-11 00:00:00.300000001")
e.CheckData2(4,2,tt4,data)
e.CheckRow(6,data)
e.CheckData2(4, 2, tt4, data)
e.CheckRow(6, data)
data, _= e.Query("select count(*) from tb2 where ts2 > 1623340800000000000 and ts2 < 1623340800150000000;")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb2 where ts2 > 1623340800000000000 and ts2 < 1623340800150000000;")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb2 where ts2 > \"2021-06-11 0:00:00.100000000\" and ts2 < \"2021-06-11 0:00:00.100000002\";")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb2 where ts2 > \"2021-06-11 0:00:00.100000000\" and ts2 < \"2021-06-11 0:00:00.100000002\";")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb2 where ts2 > 1623340800500000000;")
e.CheckData2(0,0,int64(1),data)
data, _= e.Query("select count(*) from tb2 where ts2 < \"2021-06-11 0:00:00.400000000\";")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 > 1623340800500000000;")
e.CheckData2(0, 0, int64(1), data)
data, _ = e.Query("select count(*) from tb2 where ts2 < \"2021-06-11 0:00:00.400000000\";")
e.CheckData2(0, 0, int64(5), data)
data, _= e.Query("select count(*) from tb2 where ts2 < now + 400000000b;")
e.CheckData2(0,0,int64(6),data)
data, _= e.Query("select count(*) from tb2 where ts2 >= \"2021-06-11 0:00:00.100000001\";")
e.CheckData2(0,0,int64(6),data)
data, _ = e.Query("select count(*) from tb2 where ts2 < now + 400000000b;")
e.CheckData2(0, 0, int64(6), data)
data, _= e.Query("select count(*) from tb2 where ts2 <= 1623340800400000000;")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 >= \"2021-06-11 0:00:00.100000001\";")
e.CheckData2(0, 0, int64(6), data)
data, _= e.Query("select count(*) from tb2 where ts2 = \"2021-06-11 0:00:00.000000000\";")
data, _= e.Query("select count(*) from tb2 where ts2 = \"2021-06-11 0:00:00.300000001\";")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb2 where ts2 <= 1623340800400000000;")
e.CheckData2(0, 0, int64(5), data)
data, _= e.Query("select count(*) from tb2 where ts2 = 1623340800300000001;")
e.CheckData2(0,0,int64(1),data)
data, _ = e.Query("select count(*) from tb2 where ts2 = \"2021-06-11 0:00:00.000000000\";")
data, _= e.Query("select count(*) from tb2 where ts2 between 1623340800000000000 and 1623340800450000000;")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 = \"2021-06-11 0:00:00.300000001\";")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb2 where ts2 between \"2021-06-11 0:00:00.299999999\" and \"2021-06-11 0:00:00.300000001\";")
e.CheckData2(0,0,int64(3),data)
data, _ = e.Query("select count(*) from tb2 where ts2 = 1623340800300000001;")
e.CheckData2(0, 0, int64(1), data)
data, _= e.Query("select count(*) from tb2 where ts2 <> 1623513600999999999;")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 between 1623340800000000000 and 1623340800450000000;")
e.CheckData2(0, 0, int64(5), data)
data, _= e.Query("select count(*) from tb2 where ts2 <> \"2021-06-11 0:00:00.100000001\";")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 between \"2021-06-11 0:00:00.299999999\" and \"2021-06-11 0:00:00.300000001\";")
e.CheckData2(0, 0, int64(3), data)
data, _= e.Query("select count(*) from tb2 where ts2 <> \"2021-06-11 0:00:00.100000000\";")
e.CheckData2(0,0,int64(6),data)
data, _ = e.Query("select count(*) from tb2 where ts2 <> 1623513600999999999;")
e.CheckData2(0, 0, int64(5), data)
data, _= e.Query("select count(*) from tb2 where ts2 != 1623513600999999999;")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 <> \"2021-06-11 0:00:00.100000001\";")
e.CheckData2(0, 0, int64(5), data)
data, _= e.Query("select count(*) from tb2 where ts2 != \"2021-06-11 0:00:00.100000001\";")
e.CheckData2(0,0,int64(5),data)
data, _ = e.Query("select count(*) from tb2 where ts2 <> \"2021-06-11 0:00:00.100000000\";")
e.CheckData2(0, 0, int64(6), data)
data, _= e.Query("select count(*) from tb2 where ts2 != \"2021-06-11 0:00:00.100000000\";")
e.CheckData2(0,0,int64(6),data)
data, _ = e.Query("select count(*) from tb2 where ts2 != 1623513600999999999;")
e.CheckData2(0, 0, int64(5), data)
data, _ = e.Query("select count(*) from tb2 where ts2 != \"2021-06-11 0:00:00.100000001\";")
e.CheckData2(0, 0, int64(5), data)
data, _ = e.Query("select count(*) from tb2 where ts2 != \"2021-06-11 0:00:00.100000000\";")
e.CheckData2(0, 0, int64(6), data)
e.Execute("insert into tb2 values(now + 500000000b, 6, now +2d);")
data, _= e.Query("select * from tb2;")
e.CheckRow(7,data)
data, _ = e.Query("select * from tb2;")
e.CheckRow(7, data)
e.Execute("create table tb3 (ts timestamp, speed int);")
_,err=e.Execute("insert into tb3 values(16232544001500000, 2);")
if err != nil{
_, err = e.Execute("insert into tb3 values(16232544001500000, 2);")
if err != nil {
fmt.Println("check pass! ")
}
e.Execute("insert into tb3 values(\"2021-06-10 0:00:00.123456\", 2);")
data, _= e.Query("select * from tb3 where ts = \"2021-06-10 0:00:00.123456000\";")
data, _ = e.Query("select * from tb3 where ts = \"2021-06-10 0:00:00.123456000\";")
e.CheckRow(1, data)
e.Execute("insert into tb3 values(\"2021-06-10 0:00:00.123456789000\", 2);")
data, _= e.Query("select * from tb3 where ts = \"2021-06-10 0:00:00.123456789\";")
data, _ = e.Query("select * from tb3 where ts = \"2021-06-10 0:00:00.123456789\";")
e.CheckRow(1, data)
// check timezone support
// check timezone support
e.Execute("drop database if exists nsdb;")
e.Execute("create database nsdb precision 'ns';")
e.Execute("use nsdb;")
e.Execute("create stable st (ts timestamp ,speed float ) tags(time timestamp ,id int);")
e.Execute("insert into tb1 using st tags('2021-06-10 0:00:00.123456789' , 1 ) values('2021-06-10T0:00:00.123456789+07:00' , 1.0);" )
data, _= e.Query("select first(*) from tb1;")
e.Execute("insert into tb1 using st tags('2021-06-10 0:00:00.123456789' , 1 ) values('2021-06-10T0:00:00.123456789+07:00' , 1.0);")
data, _ = e.Query("select first(*) from tb1;")
ttt, _ := time.Parse(layout, "2021-06-10 01:00:00.123456789")
e.CheckData2(0,0,ttt,data)
e.CheckData2(0, 0, ttt, data)
e.Execute("create database usdb precision 'us';")
e.Execute("use usdb;")
e.Execute("create stable st (ts timestamp ,speed float ) tags(time timestamp ,id int);")
e.Execute("insert into tb1 using st tags('2021-06-10 0:00:00.123456' , 1 ) values('2021-06-10T0:00:00.123456+07:00' , 1.0);" )
data, _= e.Query("select first(*) from tb1;")
e.Execute("insert into tb1 using st tags('2021-06-10 0:00:00.123456' , 1 ) values('2021-06-10T0:00:00.123456+07:00' , 1.0);")
data, _ = e.Query("select first(*) from tb1;")
ttt2, _ := time.Parse(layout, "2021-06-10 01:00:00.123456")
e.CheckData2(0,0,ttt2,data)
e.CheckData2(0, 0, ttt2, data)
e.Execute("drop database if exists msdb;")
e.Execute("create database msdb precision 'ms';")
e.Execute("use msdb;")
e.Execute("create stable st (ts timestamp ,speed float ) tags(time timestamp ,id int);")
e.Execute("insert into tb1 using st tags('2021-06-10 0:00:00.123' , 1 ) values('2021-06-10T0:00:00.123+07:00' , 1.0);" )
data, _= e.Query("select first(*) from tb1;")
e.Execute("insert into tb1 using st tags('2021-06-10 0:00:00.123' , 1 ) values('2021-06-10T0:00:00.123+07:00' , 1.0);")
data, _ = e.Query("select first(*) from tb1;")
ttt3, _ := time.Parse(layout, "2021-06-10 01:00:00.123")
e.CheckData2(0,0,ttt3,data)
e.CheckData2(0, 0, ttt3, data)
fmt.Println("all test done!")
}
func prepareData(e *connector.Executor) {
sqlList := []string{
"reset query cache;",
......@@ -272,4 +267,3 @@ func executeSql(e *connector.Executor, sql string) error {
}
return nil
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册