Skip to content

Commit 237fd55

Browse files
authored
Merge pull request #1037 from ClickHouse/json_string_column
fix: expose underlying string column for json
2 parents 22981da + 607dc71 commit 237fd55

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

proto/col_json_str.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ const JSONStringSerializationVersion uint64 = 1
1010
//
1111
// Use ColJSONBytes for []bytes ColumnOf implementation.
1212
type ColJSONStr struct {
13-
str ColStr
13+
Str ColStr
1414
}
1515

1616
// Append string to column.
1717
func (c *ColJSONStr) Append(v string) {
18-
c.str.Append(v)
18+
c.Str.Append(v)
1919
}
2020

2121
// AppendBytes append byte slice as string to column.
2222
func (c *ColJSONStr) AppendBytes(v []byte) {
23-
c.str.AppendBytes(v)
23+
c.Str.AppendBytes(v)
2424
}
2525

2626
func (c *ColJSONStr) AppendArr(v []string) {
27-
c.str.AppendArr(v)
27+
c.Str.AppendArr(v)
2828
}
2929

3030
// Compile-time assertions for ColJSONStr.
@@ -43,19 +43,19 @@ func (ColJSONStr) Type() ColumnType {
4343

4444
// Rows returns count of rows in column.
4545
func (c ColJSONStr) Rows() int {
46-
return c.str.Rows()
46+
return c.Str.Rows()
4747
}
4848

4949
// Reset resets data in row, preserving capacity for efficiency.
5050
func (c *ColJSONStr) Reset() {
51-
c.str.Reset()
51+
c.Str.Reset()
5252
}
5353

5454
// EncodeColumn encodes String rows to *Buffer.
5555
func (c ColJSONStr) EncodeColumn(b *Buffer) {
5656
b.PutUInt64(JSONStringSerializationVersion)
5757

58-
c.str.EncodeColumn(b)
58+
c.Str.EncodeColumn(b)
5959
}
6060

6161
// WriteColumn writes JSON rows to *Writer.
@@ -64,32 +64,32 @@ func (c ColJSONStr) WriteColumn(w *Writer) {
6464
b.PutUInt64(JSONStringSerializationVersion)
6565
})
6666

67-
c.str.WriteColumn(w)
67+
c.Str.WriteColumn(w)
6868
}
6969

7070
// ForEach calls f on each string from column.
7171
func (c ColJSONStr) ForEach(f func(i int, s string) error) error {
72-
return c.str.ForEach(f)
72+
return c.Str.ForEach(f)
7373
}
7474

7575
// First returns the first row of the column.
7676
func (c ColJSONStr) First() string {
77-
return c.str.First()
77+
return c.Str.First()
7878
}
7979

8080
// Row returns row with number i.
8181
func (c ColJSONStr) Row(i int) string {
82-
return c.str.Row(i)
82+
return c.Str.Row(i)
8383
}
8484

8585
// RowBytes returns row with number i as byte slice.
8686
func (c ColJSONStr) RowBytes(i int) []byte {
87-
return c.str.RowBytes(i)
87+
return c.Str.RowBytes(i)
8888
}
8989

9090
// ForEachBytes calls f on each string from column as byte slice.
9191
func (c ColJSONStr) ForEachBytes(f func(i int, b []byte) error) error {
92-
return c.str.ForEachBytes(f)
92+
return c.Str.ForEachBytes(f)
9393
}
9494

9595
// DecodeColumn decodes String rows from *Reader.
@@ -103,22 +103,22 @@ func (c *ColJSONStr) DecodeColumn(r *Reader, rows int) error {
103103
return errors.Errorf("received invalid JSON string serialization version %d. Setting \"output_format_native_write_json_as_string\" must be enabled.", jsonSerializationVersion)
104104
}
105105

106-
return c.str.DecodeColumn(r, rows)
106+
return c.Str.DecodeColumn(r, rows)
107107
}
108108

109109
// LowCardinality returns LowCardinality(JSON).
110110
func (c *ColJSONStr) LowCardinality() *ColLowCardinality[string] {
111-
return c.str.LowCardinality()
111+
return c.Str.LowCardinality()
112112
}
113113

114114
// Array is helper that creates Array(JSON).
115115
func (c *ColJSONStr) Array() *ColArr[string] {
116-
return c.str.Array()
116+
return c.Str.Array()
117117
}
118118

119119
// Nullable is helper that creates Nullable(JSON).
120120
func (c *ColJSONStr) Nullable() *ColNullable[string] {
121-
return c.str.Nullable()
121+
return c.Str.Nullable()
122122
}
123123

124124
// ColJSONBytes is ColJSONStr wrapper to be ColumnOf for []byte.

0 commit comments

Comments
 (0)