box: introduce JSON Indexes
New JSON indexes allows to index documents content. At first, introduced new key_part fields path and path_len representing JSON path string specified by user. Modified tuple_format_use_key_part routine constructs corresponding tuple_fields chain in tuple_format::fields tree to indexed data. The resulting tree is used for type checking and for alloctating indexed fields offset slots. Then refined tuple_init_field_map routine logic parses tuple msgpack in depth using stack allocated on region and initialize field map with corresponding tuple_format::field if any. Finally, to proceed memory allocation for vinyl's secondary key restored by extracted keys loaded from disc without fields tree traversal, introduced format::min_tuple_size field - the size of tuple_format tuple as if all leaf fields are zero. Example: To create a new JSON index specify path to document data as a part of key_part: parts = {{3, 'str', path = '.FIO.fname', is_nullable = false}} idx = s:create_index('json_idx', {parts = parse}) idx:select("Ivanov") Part of #1012
Showing
- src/box/alter.cc 1 addition, 1 deletionsrc/box/alter.cc
- src/box/index_def.c 8 additions, 2 deletionssrc/box/index_def.c
- src/box/key_def.c 134 additions, 23 deletionssrc/box/key_def.c
- src/box/key_def.h 29 additions, 5 deletionssrc/box/key_def.h
- src/box/lua/space.cc 5 additions, 0 deletionssrc/box/lua/space.cc
- src/box/memtx_engine.c 4 additions, 0 deletionssrc/box/memtx_engine.c
- src/box/sql.c 1 addition, 0 deletionssrc/box/sql.c
- src/box/sql/build.c 1 addition, 0 deletionssrc/box/sql/build.c
- src/box/sql/select.c 2 additions, 1 deletionsrc/box/sql/select.c
- src/box/sql/where.c 1 addition, 0 deletionssrc/box/sql/where.c
- src/box/tuple_compare.cc 4 additions, 3 deletionssrc/box/tuple_compare.cc
- src/box/tuple_extract_key.cc 29 additions, 6 deletionssrc/box/tuple_extract_key.cc
- src/box/tuple_format.c 311 additions, 63 deletionssrc/box/tuple_format.c
- src/box/tuple_format.h 46 additions, 14 deletionssrc/box/tuple_format.h
- src/box/tuple_hash.cc 1 addition, 1 deletionsrc/box/tuple_hash.cc
- src/box/vinyl.c 4 additions, 0 deletionssrc/box/vinyl.c
- src/box/vy_log.c 48 additions, 13 deletionssrc/box/vy_log.c
- src/box/vy_point_lookup.c 3 additions, 1 deletionsrc/box/vy_point_lookup.c
- src/box/vy_stmt.c 156 additions, 46 deletionssrc/box/vy_stmt.c
- test/engine/json.result 591 additions, 0 deletionstest/engine/json.result
Loading
Please register or sign in to comment