Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"sync/atomic"
"time"

"github.com/kshvakov/clickhouse/lib/leakypool"
"github.com/segmentio/clickhouse/lib/leakypool"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/kshvakov/clickhouse/lib/data"
"github.com/kshvakov/clickhouse/lib/protocol"
"github.com/segmentio/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/data"
"github.com/segmentio/clickhouse/lib/protocol"
)

const (
Expand Down Expand Up @@ -173,6 +173,9 @@ func open(dsn string) (*clickhouse, error) {
if debug, err := strconv.ParseBool(url.Query().Get("debug")); err == nil && debug {
ch.logf = logger.Printf
}
ch.logf = func(format string, v ...interface{}) {
fmt.Printf("debug output: "+format+"\n", v...)
}
ch.logf("host(s)=%s, database=%s, username=%s",
strings.Join(hosts, ", "),
database,
Expand Down
10 changes: 5 additions & 5 deletions clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"sync"
"time"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/kshvakov/clickhouse/lib/column"
"github.com/kshvakov/clickhouse/lib/data"
"github.com/kshvakov/clickhouse/lib/protocol"
"github.com/kshvakov/clickhouse/lib/types"
"github.com/segmentio/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/column"
"github.com/segmentio/clickhouse/lib/data"
"github.com/segmentio/clickhouse/lib/protocol"
"github.com/segmentio/clickhouse/lib/types"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions clickhouse_columnar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

"github.com/kshvakov/clickhouse"
"github.com/kshvakov/clickhouse/lib/data"
"github.com/segmentio/clickhouse"
"github.com/segmentio/clickhouse/lib/data"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions clickhouse_direct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"testing"
"time"

"github.com/kshvakov/clickhouse"
"github.com/kshvakov/clickhouse/lib/column"
"github.com/kshvakov/clickhouse/lib/types"
"github.com/segmentio/clickhouse"
"github.com/segmentio/clickhouse/lib/column"
"github.com/segmentio/clickhouse/lib/types"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 2 additions & 0 deletions clickhouse_exception.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Exception struct {
Name string
Message string
StackTrace string
Host string
nested error
}

Expand Down Expand Up @@ -43,5 +44,6 @@ func (ch *clickhouse) exception() error {
if hasNested {
e.nested = ch.exception()
}
e.Host = ch.conn.hostname
return &e
}
2 changes: 1 addition & 1 deletion clickhouse_negative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

"github.com/kshvakov/clickhouse"
"github.com/segmentio/clickhouse"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion clickhouse_ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"database/sql/driver"

"github.com/kshvakov/clickhouse/lib/protocol"
"github.com/segmentio/clickhouse/lib/protocol"
)

func (ch *clickhouse) Ping(ctx context.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion clickhouse_read_block.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package clickhouse

import (
"github.com/kshvakov/clickhouse/lib/data"
"github.com/segmentio/clickhouse/lib/data"
)

func (ch *clickhouse) readBlock() (*data.Block, error) {
Expand Down
4 changes: 2 additions & 2 deletions clickhouse_read_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package clickhouse
import (
"fmt"

"github.com/kshvakov/clickhouse/lib/data"
"github.com/kshvakov/clickhouse/lib/protocol"
"github.com/segmentio/clickhouse/lib/data"
"github.com/segmentio/clickhouse/lib/protocol"
)

func (ch *clickhouse) readMeta() (*data.Block, error) {
Expand Down
4 changes: 2 additions & 2 deletions clickhouse_send_query.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package clickhouse

import (
"github.com/kshvakov/clickhouse/lib/data"
"github.com/kshvakov/clickhouse/lib/protocol"
"github.com/segmentio/clickhouse/lib/data"
"github.com/segmentio/clickhouse/lib/protocol"
)

func (ch *clickhouse) sendQuery(query string) error {
Expand Down
6 changes: 3 additions & 3 deletions clickhouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"testing"
"time"

"github.com/kshvakov/clickhouse"
"github.com/kshvakov/clickhouse/lib/column"
"github.com/kshvakov/clickhouse/lib/types"
"github.com/segmentio/clickhouse"
"github.com/segmentio/clickhouse/lib/column"
"github.com/segmentio/clickhouse/lib/types"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions clickhouse_write_block.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package clickhouse

import (
"github.com/kshvakov/clickhouse/lib/data"
"github.com/kshvakov/clickhouse/lib/protocol"
"github.com/segmentio/clickhouse/lib/data"
"github.com/segmentio/clickhouse/lib/protocol"
)

func (ch *clickhouse) writeBlock(block *data.Block) error {
Expand Down
2 changes: 2 additions & 0 deletions connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func dial(options connOptions) (*connect, error) {
buffer: bufio.NewReader(conn),
readTimeout: options.readTimeout,
writeTimeout: options.writeTimeout,
hostname: options.hosts[num],
}, nil
} else {
options.logf(
Expand All @@ -119,6 +120,7 @@ type connect struct {
net.Conn
logf func(string, ...interface{})
ident int
hostname string
buffer *bufio.Reader
closed bool
readTimeout time.Duration
Expand Down
4 changes: 2 additions & 2 deletions examples/columnar.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"sync"
"time"

"github.com/kshvakov/clickhouse"
data "github.com/kshvakov/clickhouse/lib/data"
"github.com/segmentio/clickhouse"
data "github.com/segmentio/clickhouse/lib/data"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/kshvakov/clickhouse"
"github.com/segmentio/clickhouse"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"time"

"github.com/kshvakov/clickhouse"
"github.com/segmentio/clickhouse"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"time"

"github.com/kshvakov/clickhouse"
"github.com/segmentio/clickhouse"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/jmoiron/sqlx"
"github.com/kshvakov/clickhouse"
"github.com/segmentio/clickhouse"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module github.com/kshvakov/clickhouse
module github.com/segmentio/clickhouse

go 1.12

require (
github.com/bkaradzic/go-lz4 v1.0.0
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58
github.com/jmoiron/sqlx v1.2.0
github.com/pierrec/lz4 v2.0.5+incompatible
github.com/stretchr/testify v1.3.0
)
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
2 changes: 1 addition & 1 deletion lib/binary/compress_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"io"

"github.com/kshvakov/clickhouse/lib/lz4"
"github.com/segmentio/clickhouse/lib/lz4"
)

type compressReader struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/binary/compress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

bklz4 "github.com/bkaradzic/go-lz4"
cflz4 "github.com/cloudflare/golz4"
ownlz4 "github.com/kshvakov/clickhouse/lib/lz4"
pilz4 "github.com/pierrec/lz4"
ownlz4 "github.com/segmentio/clickhouse/lib/lz4"
)

func Test_CompressCorrect(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions lib/binary/compress_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/binary"
"io"

"github.com/kshvakov/clickhouse/lib/cityhash102"
"github.com/kshvakov/clickhouse/lib/lz4"
"github.com/segmentio/clickhouse/lib/cityhash102"
"github.com/segmentio/clickhouse/lib/lz4"
)

type compressWriter struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/binary/compress_writer_clz4.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"io"

lz4 "github.com/cloudflare/golz4"
"github.com/kshvakov/clickhouse/lib/cityhash102"
"github.com/segmentio/clickhouse/lib/cityhash102"
)

type compressWriter struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Array struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Column interface {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/column_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

func Benchmark_Column_Int8(b *testing.B) {
Expand Down
4 changes: 2 additions & 2 deletions lib/column/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"
"time"

"github.com/kshvakov/clickhouse/lib/binary"
columns "github.com/kshvakov/clickhouse/lib/column"
"github.com/segmentio/clickhouse/lib/binary"
columns "github.com/segmentio/clickhouse/lib/column"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/column/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package column
import (
"time"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Date struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/datetime.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package column
import (
"time"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type DateTime struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"strings"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

// Table of powers of 10 for fast casting from floating types to decimal type
Expand Down
2 changes: 1 addition & 1 deletion lib/column/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"strings"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Enum struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/fixed_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"reflect"

"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type FixedString struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/column/float32.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package column

import (
"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Float32 struct{ base }
Expand Down
2 changes: 1 addition & 1 deletion lib/column/float64.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package column

import (
"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Float64 struct{ base }
Expand Down
2 changes: 1 addition & 1 deletion lib/column/int16.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package column

import (
"github.com/kshvakov/clickhouse/lib/binary"
"github.com/segmentio/clickhouse/lib/binary"
)

type Int16 struct{ base }
Expand Down
Loading