Skip to content

Commit

Permalink
add plug for aggregate function
Browse files Browse the repository at this point in the history
when doing bulk insert into table with materialised column that has
aggregatefunction type it errors since it's unknown type, add plug for
that type so we can ignore it when inserting into specific columns
  • Loading branch information
iyuroch committed Feb 28, 2024
1 parent 34af932 commit e4e293f
Show file tree
Hide file tree
Showing 250 changed files with 758 additions and 568 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ClickHouse [![run-tests](https://github.com/ClickHouse/clickhouse-go/actions/workflows/run-tests.yml/badge.svg?branch=v2)](https://github.com/ClickHouse/clickhouse-go/actions/workflows/run-tests.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/ClickHouse/clickhouse-go/v2.svg)](https://pkg.go.dev/github.com/ClickHouse/clickhouse-go/v2)
# ClickHouse [![run-tests](https://github.com/ClickHouse/clickhouse-go/actions/workflows/run-tests.yml/badge.svg?branch=v2)](https://github.com/ClickHouse/clickhouse-go/actions/workflows/run-tests.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/perfectscale/clickhouse-go/v2.svg)](https://pkg.go.dev/github.com/perfectscale/clickhouse-go/v2)

Golang SQL database client for [ClickHouse](https://clickhouse.com/).

Expand Down Expand Up @@ -306,7 +306,7 @@ Available options:
## Install

```sh
go get -u github.com/ClickHouse/clickhouse-go/v2
go get -u github.com/perfectscale/clickhouse-go/v2
```

## Examples
Expand Down
3 changes: 2 additions & 1 deletion benchmark/v2/read-native/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ package main
import (
"context"
"fmt"
"github.com/ClickHouse/clickhouse-go/v2"
"log"
"testing"
"time"

"github.com/perfectscale/clickhouse-go/v2"
)

func getConnection() clickhouse.Conn {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/read-native/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
"github.com/perfectscale/clickhouse-go/v2"
)

func benchmarkRead(conn clickhouse.Conn) error {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/read/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

_ "github.com/ClickHouse/clickhouse-go/v2"
_ "github.com/perfectscale/clickhouse-go/v2"
)

func benchmarkRead(conn *sql.DB) error {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/write-async-std/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"log"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
"github.com/perfectscale/clickhouse-go/v2"
)

const ddl = `
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/write-async/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
"github.com/perfectscale/clickhouse-go/v2"
)

const ddl = `
Expand Down
3 changes: 2 additions & 1 deletion benchmark/v2/write-compress-buffer-limit/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ package main
import (
"context"
"fmt"
"github.com/ClickHouse/clickhouse-go/v2"
"log"
"runtime"
"testing"
"time"

"github.com/perfectscale/clickhouse-go/v2"
)

func bToMb(b uint64) uint64 {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/write-native-columnar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
"github.com/perfectscale/clickhouse-go/v2"
)

const ddl = `
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/write-native-struct/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
"github.com/perfectscale/clickhouse-go/v2"
)

const ddl = `
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/write-native/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
"github.com/perfectscale/clickhouse-go/v2"
)

const ddl = `
Expand Down
3 changes: 2 additions & 1 deletion benchmark/v2/write-native/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ package main

import (
"context"
"github.com/ClickHouse/clickhouse-go/v2"
"log"
"testing"
"time"

"github.com/perfectscale/clickhouse-go/v2"
)

func getConnection() clickhouse.Conn {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/v2/write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"log"
"time"

_ "github.com/ClickHouse/clickhouse-go/v2"
_ "github.com/perfectscale/clickhouse-go/v2"
)

const ddl = `
Expand Down
4 changes: 2 additions & 2 deletions bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"strings"
"time"

"github.com/ClickHouse/clickhouse-go/v2/lib/column"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/perfectscale/clickhouse-go/v2/lib/column"
"github.com/perfectscale/clickhouse-go/v2/lib/driver"
)

func Named(name string, value any) driver.NamedValue {
Expand Down
8 changes: 4 additions & 4 deletions clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
_ "time/tzdata"

chproto "github.com/ClickHouse/ch-go/proto"
"github.com/ClickHouse/clickhouse-go/v2/contributors"
"github.com/ClickHouse/clickhouse-go/v2/lib/column"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/contributors"
"github.com/perfectscale/clickhouse-go/v2/lib/column"
"github.com/perfectscale/clickhouse-go/v2/lib/driver"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

type Conn = driver.Conn
Expand Down
2 changes: 1 addition & 1 deletion clickhouse_rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"database/sql"
"io"

"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

type rows struct {
Expand Down
4 changes: 2 additions & 2 deletions clickhouse_rows_column_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package clickhouse
import (
"reflect"

"github.com/ClickHouse/clickhouse-go/v2/lib/column"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/perfectscale/clickhouse-go/v2/lib/column"
"github.com/perfectscale/clickhouse-go/v2/lib/driver"
)

type columnType struct {
Expand Down
5 changes: 3 additions & 2 deletions clickhouse_rows_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package clickhouse

import (
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/stretchr/testify/assert"
"strconv"
"testing"

"github.com/perfectscale/clickhouse-go/v2/lib/proto"
"github.com/stretchr/testify/assert"
)

func TestReadWithEmptyBlock(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions clickhouse_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"sync/atomic"
"syscall"

"github.com/ClickHouse/clickhouse-go/v2/lib/column"
ldriver "github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/perfectscale/clickhouse-go/v2/lib/column"
ldriver "github.com/perfectscale/clickhouse-go/v2/lib/driver"
)

var globalConnID int64
Expand Down
3 changes: 2 additions & 1 deletion client_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ package clickhouse

import (
"fmt"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"runtime"
"sort"
"strings"

"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

const ClientName = "clickhouse-go"
Expand Down
4 changes: 2 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import (
"syscall"
"time"

"github.com/ClickHouse/clickhouse-go/v2/resources"
"github.com/perfectscale/clickhouse-go/v2/resources"
"github.com/pkg/errors"

"github.com/ClickHouse/ch-go/compress"
chproto "github.com/ClickHouse/ch-go/proto"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

func dial(ctx context.Context, addr string, num int, opt *Options) (*connect, error) {
Expand Down
3 changes: 2 additions & 1 deletion conn_async_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ package clickhouse

import (
"context"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"

"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

func (c *connect) asyncInsert(ctx context.Context, query string, wait bool, args ...any) error {
Expand Down
6 changes: 3 additions & 3 deletions conn_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (

"github.com/pkg/errors"

"github.com/ClickHouse/clickhouse-go/v2/lib/column"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/column"
"github.com/perfectscale/clickhouse-go/v2/lib/driver"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

var splitInsertRe = regexp.MustCompile(`(?i)\sVALUES\s*\(`)
Expand Down
3 changes: 2 additions & 1 deletion conn_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package clickhouse

import (
"context"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"time"

"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

func (c *connect) exec(ctx context.Context, query string, args ...any) error {
Expand Down
2 changes: 1 addition & 1 deletion conn_handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"time"

"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

func (c *connect) handshake(database, username, password string) error {
Expand Down
4 changes: 2 additions & 2 deletions conn_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ import (
"sync"
"time"

"github.com/ClickHouse/clickhouse-go/v2/resources"
"github.com/perfectscale/clickhouse-go/v2/resources"

"github.com/ClickHouse/ch-go/compress"
chproto "github.com/ClickHouse/ch-go/proto"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/andybalholm/brotli"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
"github.com/pkg/errors"
)

Expand Down
7 changes: 4 additions & 3 deletions conn_http_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import (
"context"
"errors"
"fmt"
"github.com/ClickHouse/clickhouse-go/v2/lib/column"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"io"
"io/ioutil"
"regexp"
"strings"

"github.com/perfectscale/clickhouse-go/v2/lib/column"
"github.com/perfectscale/clickhouse-go/v2/lib/driver"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

// \x60 represents a backtick
Expand Down
5 changes: 3 additions & 2 deletions conn_http_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"bytes"
"context"
"errors"
chproto "github.com/ClickHouse/ch-go/proto"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"io"

chproto "github.com/ClickHouse/ch-go/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

// release is ignored, because http used by std with empty release function
Expand Down
2 changes: 1 addition & 1 deletion conn_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"context"
"time"

"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

type Log struct {
Expand Down
2 changes: 1 addition & 1 deletion conn_ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"time"

"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

// Connection::ping
Expand Down
3 changes: 2 additions & 1 deletion conn_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ package clickhouse
import (
"context"
"fmt"
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"io"

"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

type onProcess struct {
Expand Down
2 changes: 1 addition & 1 deletion conn_profile_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"reflect"
"time"

"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

type ProfileEvent struct {
Expand Down
2 changes: 1 addition & 1 deletion conn_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"context"
"time"

"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

func (c *connect) query(ctx context.Context, release func(*connect, error), query string, args ...any) (*rows, error) {
Expand Down
2 changes: 1 addition & 1 deletion conn_send_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package clickhouse

import (
"github.com/ClickHouse/clickhouse-go/v2/lib/proto"
"github.com/perfectscale/clickhouse-go/v2/lib/proto"
)

// Connection::sendQuery
Expand Down
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"context"
"time"

"github.com/ClickHouse/clickhouse-go/v2/ext"
"github.com/perfectscale/clickhouse-go/v2/ext"
"go.opentelemetry.io/otel/trace"
)

Expand Down
3 changes: 2 additions & 1 deletion examples/clickhouse_api/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ package clickhouse_api

import (
"context"
clickhouse_tests "github.com/ClickHouse/clickhouse-go/v2/tests"

clickhouse_tests "github.com/perfectscale/clickhouse-go/v2/tests"
)

func AsyncInsert() error {
Expand Down
3 changes: 2 additions & 1 deletion examples/clickhouse_api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ package clickhouse_api

import (
"fmt"
"github.com/ClickHouse/clickhouse-go/v2"

"github.com/perfectscale/clickhouse-go/v2"
)

func Auth() error {
Expand Down
Loading

0 comments on commit e4e293f

Please sign in to comment.