From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Serge Petrenko Subject: [PATCH 0/5] Decimal indices Date: Wed, 17 Jul 2019 18:33:41 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: vdavydov.dev@gmail.com Cc: tarantool-patches@freelists.org, Serge Petrenko List-ID: https://github.com/tarantool/tarantool/issues/4333 https://github.com/tarantool/tarantool/tree/sp/gh-4333-decimal-index This patchset adds the ability to insert decimal values into spaces and to build indices over decimal fields. The first patch fixes a bug in decimal.round() found during working on the patchset. This bug prevented correct hint calculations for some decimal values. The second patch updates msgpack library with the ability to encode/decode decimals as msgpack The third patch propagates the msgpack changes to msgpack Lua module. This allows to insert decimals into spaces, but only into unindexed fields. The fourth patch updates the decNumber library with new ToUInt64 and ToInt64 functions and adds the corresponding wrappers to our decimal module. These functions are needed for hint calculation. The fifth patch adds a new field type, 'decimal', allows to store decimal values in 'decimal', 'scalar' and 'number' fields, and adds all the code necessary for hint calculations over decimal fields. Serge Petrenko (5): decimal: fix decimal.round() when scale == 0 decimal: allow to encode/decode decimals as MsgPack lua: allow to encode and decode decimals as msgpack decimal: add conversions to (u)int64_t decimal: allow to index decimals extra/exports | 4 + src/box/field_def.c | 43 ++++-- src/box/field_def.h | 16 +- src/box/key_def.h | 2 +- src/box/tuple_compare.cc | 160 +++++++++++++++++++- src/box/tuple_format.c | 2 +- src/lib/core/CMakeLists.txt | 1 + src/lib/core/decimal.c | 81 ++++++++-- src/lib/core/decimal.h | 20 +++ src/lib/core/mp_decimal.c | 72 +++++++++ src/lib/core/mp_decimal.h | 70 +++++++++ src/lib/core/mp_user_types.h | 39 +++++ src/lib/core/mpstream.c | 11 ++ src/lib/core/mpstream.h | 4 + src/lua/decimal.c | 10 +- src/lua/decimal.h | 5 + src/lua/msgpack.c | 52 +++++-- src/lua/msgpackffi.lua | 33 +++++ src/lua/utils.c | 16 +- src/lua/utils.h | 8 +- test/app/decimal.result | 116 +++++++++------ test/app/decimal.test.lua | 6 + test/app/msgpack.result | 41 +++++ test/app/msgpack.test.lua | 15 ++ test/engine/decimal.result | 226 ++++++++++++++++++++++++++++ test/engine/decimal.test.lua | 65 ++++++++ test/unit/decimal.c | 124 +++++++++++++++- test/unit/decimal.result | 272 +++++++++++++++++++++++++++++++++- third_party/decNumber | 2 +- third_party/lua-yaml/lyaml.cc | 6 + 30 files changed, 1420 insertions(+), 102 deletions(-) create mode 100644 src/lib/core/mp_decimal.c create mode 100644 src/lib/core/mp_decimal.h create mode 100644 src/lib/core/mp_user_types.h create mode 100644 test/engine/decimal.result create mode 100644 test/engine/decimal.test.lua -- 2.20.1 (Apple Git-117)