Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Decimal indices
@ 2019-08-08 11:55 Serge Petrenko
  2019-08-08 11:55 ` [PATCH v2 1/8] lua: fix decimal comparison with nil Serge Petrenko
                   ` (7 more replies)
  0 siblings, 8 replies; 35+ messages in thread
From: Serge Petrenko @ 2019-08-08 11:55 UTC (permalink / raw)
  To: vdavydov.dev; +Cc: tarantool-patches, kostja, Serge Petrenko

https://github.com/tarantool/tarantool/issues/4333
https://github.com/tarantool/tarantool/tree/sp/gh-4333-decimal-index

This patchset adds the ability to store decimals in spaces and to build indices
over them. As a prerequisite, the ability to encode and decode decimals as
msgpack is also added to both C and Lua modules.

First three patches contain various bugfixes found during the work on the issue.

The fourth and fifth patches are preparational, they introduce a new enum -
mp_field_type, with values MP_FIELD_* corresponding directly to Messagepack
types - MP_INT, MP_STR and so on. MP_FIELD_* is intended to be used with various
extension types we plan on adding: Instead of having MP_INT, ... MP_STR  and so
on together with MP_EXT and its various subtypes, we will have a single enum
with all tarantool-supported types, including decimal and everything we might
come up with later.
This allows to make all the switch cases over types plain and hide the MP_EXT
decoding logic into a single function - msgpack_to_field_type().

The sixth patch is the first one to make use of the preparatory work done up to
this point. It adds the methods to encode and decode decimals as msgpack, and
expands lua msgpack and msgpackffi modules with the same abilities.
This allows to store decimal values in tuples, and in space unindexed fields.

The seventh patch adds methods to cast decimals to 64 bit integers. This
functionality is needed to calculate comparison hints from decimals in scope of
patch 8.

Patch 8 finally introduces decimal fields, adds comparators for decimal values
and defines field types appropriate for storing decimals.

Changes in v2:
  - Various minor fixes regarding a review by
    Vladimir Davydov
  - All the bugfixes are extracted into separate
    patches
  - More tests are added to cover space.format and
    index.alter with decimal fields
  - A single enum is introduced to cover both existent
    msgpack types and the ones with which we might
    come up later
  - The patches covering the ability to encode/decode
    decimals as msgpack in C and Lua are squashed.

Serge Petrenko (8):
  lua: fix decimal comparison with nil
  decimal: fix encoding numbers with positive exponent.
  lua/pickle: fix a typo
  lua: rework luaL_field types to support msgpack extensions
  box: rework field_def and tuple_compare to work with mp_field_type
    instead of mp_type
  decimal: allow to encode/decode decimals as MsgPack
  decimal: add conversions to (u)int64_t
  decimal: allow to index decimals

 extra/exports                        |   4 +
 src/box/field_def.c                  |  50 ++--
 src/box/field_def.h                  |  13 +-
 src/box/key_def.h                    |   2 +-
 src/box/lua/call.c                   |  16 +-
 src/box/lua/execute.c                |  24 +-
 src/box/lua/tuple.c                  |  12 +-
 src/box/tuple_compare.cc             | 330 ++++++++++++++++---------
 src/box/tuple_format.c               |   2 +-
 src/lib/core/CMakeLists.txt          |   1 +
 src/lib/core/decimal.c               |  67 ++++-
 src/lib/core/decimal.h               |  27 ++
 src/lib/core/mp_decimal.c            |  72 ++++++
 src/lib/core/mp_decimal.h            |  70 ++++++
 src/lib/core/mp_user_types.h         | 104 ++++++++
 src/lib/core/mpstream.c              |  11 +
 src/lib/core/mpstream.h              |   4 +
 src/lua/decimal.c                    |   8 +-
 src/lua/decimal.h                    |   7 +
 src/lua/msgpack.c                    | 111 +++++----
 src/lua/msgpack.h                    |   6 +-
 src/lua/msgpackffi.lua               |  36 +++
 src/lua/pickle.c                     |  14 +-
 src/lua/utils.c                      |  73 +++---
 src/lua/utils.h                      |   7 +-
 test/app-tap/lua/serializer_test.lua |  14 ++
 test/app-tap/msgpackffi.test.lua     |   3 +-
 test/app/decimal.result              | 154 +++++++-----
 test/app/decimal.test.lua            |   8 +
 test/app/msgpack.result              |  41 +++
 test/app/msgpack.test.lua            |  15 ++
 test/box/tuple.result                |  85 +++++++
 test/box/tuple.test.lua              |  23 ++
 test/engine/ddl.result               |  85 ++++++-
 test/engine/ddl.test.lua             |  40 ++-
 test/engine/decimal.result           | 356 +++++++++++++++++++++++++++
 test/engine/decimal.test.lua         | 104 ++++++++
 test/unit/decimal.c                  | 139 ++++++++++-
 test/unit/decimal.result             | 283 ++++++++++++++++++++-
 third_party/decNumber                |   2 +-
 third_party/lua-cjson/lua_cjson.c    |  33 +--
 third_party/lua-yaml/lyaml.cc        |  27 +-
 42 files changed, 2112 insertions(+), 371 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)

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2019-08-16  8:06 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 11:55 [PATCH v2 0/8] Decimal indices Serge Petrenko
2019-08-08 11:55 ` [PATCH v2 1/8] lua: fix decimal comparison with nil Serge Petrenko
2019-08-12 21:16   ` Konstantin Osipov
2019-08-14 11:00   ` Vladimir Davydov
2019-08-14 22:17     ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 2/8] decimal: fix encoding numbers with positive exponent Serge Petrenko
2019-08-12 21:18   ` Konstantin Osipov
2019-08-13  9:00     ` [tarantool-patches] " Serge Petrenko
2019-08-14 22:21       ` Konstantin Osipov
2019-08-14 11:56   ` Vladimir Davydov
2019-08-08 11:55 ` [PATCH v2 3/8] lua/pickle: fix a typo Serge Petrenko
2019-08-12 21:18   ` Konstantin Osipov
2019-08-14 11:12   ` Vladimir Davydov
2019-08-14 11:15     ` Serge Petrenko
2019-08-08 11:55 ` [PATCH v2 4/8] lua: rework luaL_field types to support msgpack extensions Serge Petrenko
2019-08-12 21:23   ` Konstantin Osipov
2019-08-13 13:15     ` [tarantool-patches] " Serge Petrenko
2019-08-14 22:23       ` Konstantin Osipov
2019-08-15  8:27         ` Serge Petrenko
2019-08-16  8:06           ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 5/8] box: rework field_def and tuple_compare to work with mp_field_type instead of mp_type Serge Petrenko
2019-08-12 21:28   ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 6/8] decimal: allow to encode/decode decimals as MsgPack Serge Petrenko
2019-08-12 21:29   ` Konstantin Osipov
2019-08-12 21:34   ` Konstantin Osipov
2019-08-13 14:01     ` Serge Petrenko
2019-08-14 22:25       ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 7/8] decimal: add conversions to (u)int64_t Serge Petrenko
2019-08-12 21:39   ` Konstantin Osipov
2019-08-13 14:18     ` Serge Petrenko
2019-08-14 22:26       ` Konstantin Osipov
2019-08-14 22:29         ` Konstantin Osipov
2019-08-08 11:55 ` [PATCH v2 8/8] decimal: allow to index decimals Serge Petrenko
2019-08-08 13:42   ` Serge Petrenko
2019-08-12 21:41   ` Konstantin Osipov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox