-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
box: support varbinary in splice update operation #9998
box: support varbinary in splice update operation #9998
Conversation
99beff2
to
82f3cfa
Compare
82f3cfa
to
648d5e6
Compare
648d5e6
to
4686b36
Compare
4686b36
to
403d699
Compare
403d699
to
22721d5
Compare
5c07c45
to
fd967c8
Compare
@TarantoolBot document Title: splice update operation now supports varbinary Just in case splice is an update operation that can modify string field, deleting a part of it and inserting something instead. ``` tarantool> box.tuple.new{'1234567'}:update{{':', 1, 2, 3, '!'}} --- - ['1!567'] ... ``` In the this example splice operation ':' takes field 1 of tuple, takes position 2 in string, removes 3 symbols and inserts '!' to that position. Both deletion and insertion can naturally degrade to no-op. Before this patch a splice operation required both field and inserting argument to be strings. This patch allows the field and the argument to be varbinary. ``` tarantool> varb = require('varbinary') tarantool> t = box.tuple.new{varb.new('1234567')} tarantool> t:update{{':', 1, 2, 3, varb.new('!')}} --- - [!!binary MSE1Njc=] ... ``` That also allows to insert strings into varbinary fields and insert varbinary data into string. The actual field type after update such operation remains the same, so updated string will be string, while updated varbinary will be varbinary. Closes tarantool#9997
This patch tests update splice operation more thoroughly: * All variants of splice: delete/insert/replace/noop. * All variants of position: negative/positive/zero/OOB. * One operation and several sequential operations. * Tuple update, space update, space upsert. * String of varbinary field/arg. Follow up tarantool#9997 Closes tarantool#10032 NO_DOC=tests NO_CHANGELOG=tests
fd967c8
to
f1777cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great that you managed to reduce that patch to just changing the input and output points of the slice operation!
This is out of the scope of this patch series, however, regarding the slice operation testing: would be great to have fuzzing tests for xrow_update_execute
or some lower level xrow_update_*
functions just like we already have test/fuzz/xrow_decode_*
tests — see, for instance, #9022.
Just in case splice is an update operation that can modify string
field, deleting a part of it and inserting something instead.
In the this example splice operation ':' takes field 1 of tuple,
takes position 2 in string, removes 3 symbols and inserts '!' to
that position.
Both deletion and insertion can naturally degrade to no-op.
Before this patch a splice operation required both field and
inserting argument to be strings.
This patch allows the field and the argument to be varbinary.
That also allows to insert strings into varbinary fields and
insert varbinary data into string. The actual field type after
update such operation remains the same, so updated string will
be string, while updated varbinary will be varbinary.
Closes #9997