Skip to content

Commit

Permalink
Remove test coverage for deprecated Object('JSON') type (#1377)
Browse files Browse the repository at this point in the history
* Remove test coverage for deprecated Object('JSON') type

ClickHouse has deprecated support for (https://clickhouse.com/docs/en/sql-reference/data-types/object-data-type. Object('JSON') has been aliased with JSON for a long time in ClickHouse as an experimental type. It's replaced by a new JSON type: https://clickhouse.com/docs/en/sql-reference/data-types/newjson (still experimental)

clickhouse-go implements support for Object('JSON'), but not for a new JSON type. To avoid confusion, all test coverage and mentions are removed for the deprecated type.

New JSON type support needs to be implemented in clickhouse-go.

* Add JSON column implementation comment

* Remove function calls
  • Loading branch information
jkaflik authored Aug 21, 2024
1 parent a2fde5f commit a192162
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 2,951 deletions.
172 changes: 0 additions & 172 deletions examples/clickhouse_api/json.go

This file was deleted.

5 changes: 0 additions & 5 deletions examples/clickhouse_api/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ func TestMain(m *testing.M) {

// ClickHouse API tests

func TestJSON(t *testing.T) {
require.NoError(t, InsertReadJSON())
require.NoError(t, ReadComplexJSON())
}

func TestOpenTelemetry(t *testing.T) {
require.NoError(t, OpenTelemetry())
}
Expand Down
131 changes: 0 additions & 131 deletions examples/std/json.go

This file was deleted.

4 changes: 0 additions & 4 deletions examples/std/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ func TestStdMapInsertRead(t *testing.T) {
require.NoError(t, MapInsertRead())
}

func TestStdJSON(t *testing.T) {
require.NoError(t, JSONInsertRead())
}

func TestStdCompression(t *testing.T) {
require.NoError(t, CompressOpenDB())
require.NoError(t, CompressOpen())
Expand Down
12 changes: 11 additions & 1 deletion lib/column/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@ package column

import (
"fmt"
"github.com/ClickHouse/ch-go/proto"
"reflect"
"strings"
"time"

"github.com/ClickHouse/ch-go/proto"
)

// This JSON type implementation was done for an experimental Object('JSON') type:
// https://clickhouse.com/docs/en/sql-reference/data-types/object-data-type
// It's already deprecated in ClickHouse and will be removed in the future.
// Since ClickHouse 24.8, the Object('JSON') type is no longer alias for JSON type.
// The new JSON type has been introduced: https://clickhouse.com/docs/en/sql-reference/data-types/newjson
// However, the new JSON type is not supported by the driver yet.
//
// This implementation is kept for backward compatibility and will be removed in the future. TODO: remove this

// inverse mapping - go types to clickhouse types
var kindMappings = map[reflect.Kind]string{
reflect.String: "String",
Expand Down
3 changes: 2 additions & 1 deletion tests/issues/1072_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
)

func Test1072(t *testing.T) {
clickhouse_tests.SkipOnCloud(t, "The JSON data type is an obsolete feature on Cloud.")
t.Skip("Object JSON type is deprecated. Test is kept for a historical reference.")

var (
conn, err = clickhouse_tests.GetConnection("issues", clickhouse.Settings{
"max_execution_time": 60,
Expand Down
3 changes: 2 additions & 1 deletion tests/issues/1113_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
)

func Test1113(t *testing.T) {
clickhouse_tests.SkipOnCloud(t, "The JSON data type is an obsolete feature on Cloud.")
t.Skip("Object JSON type is deprecated. Test is kept for a historical reference.")

var (
conn, err = clickhouse_tests.GetConnection("issues", clickhouse.Settings{
"max_execution_time": 60,
Expand Down
3 changes: 2 additions & 1 deletion tests/issues/1119_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
)

func Test1119(t *testing.T) {
clickhouse_tests.SkipOnCloud(t, "The JSON data type is an obsolete feature on Cloud.")
t.Skip("Object JSON type is deprecated. Test is kept for a historical reference.")

var (
conn, err = clickhouse_tests.GetConnection("issues", clickhouse.Settings{
"max_execution_time": 60,
Expand Down
Loading

0 comments on commit a192162

Please sign in to comment.