diff --git a/LICENSE-binary b/LICENSE-binary index 6620f9a..f9228d7 100644 --- a/LICENSE-binary +++ b/LICENSE-binary @@ -215,4 +215,4 @@ following license. See licenses/ for text of these licenses. Apache Software Foundation License 2.0 -------------------------------------- -github.com/apache/thrift@v0.14.1 +github.com/apache/thrift@v0.15.0 diff --git a/Makefile b/Makefile index 9109054..461311f 100644 --- a/Makefile +++ b/Makefile @@ -24,12 +24,12 @@ generate: fi @if ! command -v thrift &> /dev/null; then \ - echo "thrift could not be found, please install thrift 0.14.1"; \ + echo "thrift could not be found, please install thrift 0.15.0"; \ exit 1; \ fi - @if [[ "`thrift --version|grep -o '0.14.[0-9]'`" == "" ]]; then \ - echo "please install thrift 0.14.1"; \ + @if [[ "`thrift --version|grep -o '0.15.[0-9]'`" == "" ]]; then \ + echo "please install thrift 0.15.0"; \ exit 1; \ fi diff --git a/README.md b/README.md index 372c42a..d44b66d 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,6 @@ # Apache IoTDB -[![E2E Tests](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml/badge.svg)](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml) -[![GitHub release](https://img.shields.io/github/release/apache/iotdb-client-go.svg)](https://github.com/apache/iotdb-client-go/releases) -[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) -![](https://github-size-badge.herokuapp.com/apache/iotdb-client-go.svg) -![](https://img.shields.io/badge/platform-win10%20%7C%20macos%20%7C%20linux-yellow.svg) -[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/) - - Apache IoTDB (Database for Internet of Things) is an IoT native database with high performance for data management and analysis, deployable on the edge and the cloud. Due to its light-weight architecture, high performance and rich feature set together with its deep integration with @@ -38,6 +30,13 @@ high-speed data ingestion and complex data analysis in the IoT industrial fields # Apache IoTDB Client for Go +[![E2E Tests](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml/badge.svg)](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml) +[![GitHub release](https://img.shields.io/github/release/apache/iotdb-client-go.svg)](https://github.com/apache/iotdb-client-go/releases) +[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +![](https://github-size-badge.herokuapp.com/apache/iotdb-client-go.svg) +![](https://img.shields.io/badge/platform-win10%20%7C%20macos%20%7C%20linux-yellow.svg) +[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/) + ## Overview This is the GoLang client of Apache IoTDB. @@ -68,10 +67,10 @@ go run session_example.go Without go mod ```sh -# get thrift 0.14.1 +# get thrift 0.15.0 go get github.com/apache/thrift cd $GOPATH/src/github.com/apache/thrift -git checkout 0.14.1 +git checkout 0.15.0 mkdir -p $GOPATH/src/iotdb-client-go-example/session_example cd $GOPATH/src/iotdb-client-go-example/session_example @@ -92,4 +91,4 @@ go run session_example.go * golang >= 1.13 * make >= 3.0 * curl >= 7.1.1 -* thrift 0.14.1 +* thrift 0.15.0 diff --git a/README_ZH.md b/README_ZH.md index 953d7d7..371dd7f 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -20,8 +20,21 @@ --> [English](./README.md) | [中文](./README_ZH.md) +# Apache IoTDB + +Apache IoTDB(物联网数据库)是一个物联网原生数据库,在数据管理和分析方面表现良好,可部署在边缘设备和云上。 +由于其轻量级架构、高性能和丰富的功能集,以及与Apache Hadoop、Spark和Flink的深度集成, +Apache IoTDB可以满足物联网工业领域的海量数据存储、高速数据摄取和复杂数据分析的要求。 + # Apache IoTDB Go语言客户端 +[![E2E Tests](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml/badge.svg)](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml) +[![GitHub release](https://img.shields.io/github/release/apache/iotdb-client-go.svg)](https://github.com/apache/iotdb-client-go/releases) +[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +![](https://github-size-badge.herokuapp.com/apache/iotdb-client-go.svg) +![](https://img.shields.io/badge/platform-win10%20%7C%20macos%20%7C%20linux-yellow.svg) +[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/) + ## 概览 本仓库是Apache IoTDB的Go语言客户端. @@ -52,10 +65,10 @@ go run session_example.go 不使用go mod,采用GOPATH ```sh -# get thrift 0.14.1 +# get thrift 0.15.0 go get github.com/apache/thrift cd $GOPATH/src/github.com/apache/thrift -git checkout 0.14.1 +git checkout 0.15.0 mkdir -p $GOPATH/src/iotdb-client-go-example/session_example cd $GOPATH/src/iotdb-client-go-example/session_example @@ -75,4 +88,4 @@ go run session_example.go * golang >= 1.13 * make >= 3.0 * curl >= 7.1.1 -* thrift 0.14.1 +* thrift 0.15.0 diff --git a/client/session.go b/client/session.go index 36f2b38..7bac275 100644 --- a/client/session.go +++ b/client/session.go @@ -79,13 +79,16 @@ func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) err var protocolFactory thrift.TProtocolFactory var err error - s.trans, err = thrift.NewTSocketConf(net.JoinHostPort(s.config.Host, s.config.Port), &thrift.TConfiguration{ + // in thrift 0.14.1, this func returns two values; in thrift 0.15.0, it returns one. + s.trans = thrift.NewTSocketConf(net.JoinHostPort(s.config.Host, s.config.Port), &thrift.TConfiguration{ ConnectTimeout: time.Duration(connectionTimeoutInMs), // Use 0 for no timeout }) if err != nil { return err } - s.trans = thrift.NewTFramedTransport(s.trans) + // s.trans = thrift.NewTFramedTransport(s.trans) // deprecated + var tmp_conf = thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE} + s.trans = thrift.NewTFramedTransportConf(s.trans, &tmp_conf) if !s.trans.IsOpen() { err = s.trans.Open() if err != nil { @@ -813,11 +816,13 @@ func NewClusterSession(ClusterConfig *ClusterConfig) Session { } var err error for e := endPointList.Front(); e != nil; e = e.Next() { - session.trans, err = thrift.NewTSocketConf(net.JoinHostPort(e.Value.(endPoint).Host, e.Value.(endPoint).Port), &thrift.TConfiguration{ + session.trans = thrift.NewTSocketConf(net.JoinHostPort(e.Value.(endPoint).Host, e.Value.(endPoint).Port), &thrift.TConfiguration{ ConnectTimeout: time.Duration(0), // Use 0 for no timeout }) if err == nil { - session.trans = thrift.NewTFramedTransport(session.trans) + // session.trans = thrift.NewTFramedTransport(session.trans) // deprecated + var tmp_conf = thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE} + session.trans = thrift.NewTFramedTransportConf(session.trans, &tmp_conf) if !session.trans.IsOpen() { err = session.trans.Open() if err != nil { @@ -839,11 +844,13 @@ func NewClusterSession(ClusterConfig *ClusterConfig) Session { func (s *Session) initClusterConn(node endPoint) error { var err error - s.trans, err = thrift.NewTSocketConf(net.JoinHostPort(node.Host, node.Port), &thrift.TConfiguration{ + s.trans = thrift.NewTSocketConf(net.JoinHostPort(node.Host, node.Port), &thrift.TConfiguration{ ConnectTimeout: time.Duration(0), // Use 0 for no timeout }) if err == nil { - s.trans = thrift.NewTFramedTransport(s.trans) + // s.trans = thrift.NewTFramedTransport(s.trans) // deprecated + var tmp_conf = thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE} + s.trans = thrift.NewTFramedTransportConf(s.trans, &tmp_conf) if !s.trans.IsOpen() { err = s.trans.Open() if err != nil { diff --git a/client/sessiondataset.go b/client/sessiondataset.go index 2651630..dc4ed37 100644 --- a/client/sessiondataset.go +++ b/client/sessiondataset.go @@ -19,7 +19,9 @@ package client -import "github.com/apache/iotdb-client-go/rpc" +import ( + "github.com/apache/iotdb-client-go/rpc" +) const ( TimestampColumnName = "Time" diff --git a/go.mod b/go.mod index 3d9c57b..2571dd1 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/apache/iotdb-client-go go 1.13 require ( - github.com/apache/thrift v0.14.1 + github.com/apache/thrift v0.15.0 github.com/stretchr/testify v1.8.0 ) diff --git a/go.sum b/go.sum index 510321b..a2e600f 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,9 @@ -github.com/apache/thrift v0.14.1 h1:Yh8v0hpCj63p5edXOLaqTJW0IJ1p+eMW6+YSOqw1d6s= -github.com/apache/thrift v0.14.1/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.15.0 h1:aGvdaR0v1t9XLgjtBYwxcBvBOTMqClzwE26CHOgjW1Y= +github.com/apache/thrift v0.15.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -10,6 +11,18 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=