File tree Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 1
1
# jsonbc
2
2
3
- JSONB compression method for PostgreSQL
3
+ JSONB compression method for PostgreSQL.
4
4
5
- ## Using
5
+ ## Usage
6
6
7
- To use it the following patch should be applied to postgresql (git: master ):
7
+ To use it the following patch should be applied to PostgreSQL code (git: master ):
8
8
9
9
https://commitfest.postgresql.org/15/1294/
10
10
@@ -16,3 +16,5 @@ CREATE COMPRESSION METHOD cm1 HANDLER jsonbc_compression_handler;
16
16
CREATE TABLE t(a JSONB);
17
17
ALTER TABLE t ALTER COLUMN a SET COMPRESSED cm1;
18
18
```
19
+
20
+ This is very early version and should not be used in any real systems.
Original file line number Diff line number Diff line change @@ -207,21 +207,31 @@ jsonbc_compress(AttributeCompression *ac, const struct varlena *data)
207
207
it = JsonbIteratorInit (& ((Jsonb * ) data )-> root );
208
208
while ((r = JsonbIteratorNext (& it , & v , false)) != 0 )
209
209
{
210
- if (r == WJB_KEY )
210
+ switch (r )
211
211
{
212
- int len ;
213
- int32 key_id ;
214
- unsigned char * ptr = palloc0 (6 );
212
+ case WJB_BEGIN_OBJECT :
213
+ break ;
214
+ case WJB_KEY :
215
+ {
216
+ int len ;
217
+ int32 key_id ;
218
+ unsigned char * ptr = palloc0 (6 );
215
219
216
- Assert (v .type == jbvString );
217
- key_id = get_key_id (ac -> cmoptoid , v .val .string .val , v .val .string .len );
220
+ Assert (v .type == jbvString );
221
+ key_id = get_key_id (ac -> cmoptoid , v .val .string .val , v .val .string .len );
218
222
219
- encode_varbyte (key_id , ptr , & len );
220
- Assert (len <= 5 );
223
+ encode_varbyte (key_id , ptr , & len );
224
+ Assert (len <= 5 );
221
225
222
- v .type = jbvString ;
223
- v .val .string .val = (char * ) ptr ;
224
- v .val .string .len = len ;
226
+ v .type = jbvString ;
227
+ v .val .string .val = (char * ) ptr ;
228
+ v .val .string .len = len ;
229
+ break ;
230
+ }
231
+ case WJB_END_OBJECT :
232
+ break ;
233
+ default :
234
+ break ;
225
235
}
226
236
jbv = pushJsonbValue (& state , r , r < WJB_BEGIN_ARRAY ? & v : NULL );
227
237
}
You can’t perform that action at this time.
0 commit comments