[Tarantool-patches] [PATCH resend v2 06/11] box, datetime: datetime comparison for indices

Timur Safin tsafin at tarantool.org
Sat Jul 31 12:31:27 MSK 2021


: > : From: Oleg Babin<olegrok at tarantool.org>
: > : Subject: Re: [Tarantool-patches] [PATCH resend v2 06/11] box, datetime:
: > : datetime comparison for indices
: > :
: > : Thanks for your patch. One question below.
: > :
: > :
: > : Also update with arithmetic operations doesn't work.
: > :
: > :
: > : ```
: > :
: > : tarantool> box.space.dt:update({v}, {{'+', 2, 3}})
: > : ---
: > : - error: 'Argument type in operation ''+'' on field 2 does not match
: > : field type: expected
: > :      a number'
: > : ...
: > :
: > : tarantool> box.space.dt:update({v}, {{'+', 2, dt.week(1)}})
: > : ---
: > : - error: unsupported Lua type 'cdata'
: > : ...
: > :
: > : ```
: >
: > Oh, shit, I didn't take those operations into considerations.
: > Do they work similarly with decimal?
: 
: Looks like so. Moreover it seems we should support intervals as separate
: type.
: 
: Currently the single way to update is get + sum + put/update (with =).
: 
: But I suppose native update will be needed anyway. At lest for SQL.
: 
: Will be it able to perform some operations with intervals and timestamps?


The original plan was to not persist intervals in the 1st iteration
of implementation and store only full datetime values. Even for 
SQL I did not plan to allow schemas with interval as field type. 
INTERVALs in SQL expected to be present at run-time only at the 
Expressions, but then persisted as calculated datetime values.

But, those box updates with intervals looks interesting, and we have
to support, eventually. I don't know though whether it would
require full interval support or the current partial will
be enough? 

In any case - smells like we need to open ticket for that. Could
you please do that with more details?

Thanks,
Timur



More information about the Tarantool-patches mailing list