Skip to content
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

Support splice update operation for varbinary fields #9997

Closed
alyapunov opened this issue May 8, 2024 · 0 comments · Fixed by #9998
Closed

Support splice update operation for varbinary fields #9997

alyapunov opened this issue May 8, 2024 · 0 comments · Fixed by #9998
Assignees
Labels
feature A new functionality

Comments

@alyapunov
Copy link
Contributor

It would be nice to have that:

tarantool> varbinary = require('varbinary')
---
...

tarantool> s:replace{1, varbinary.new('abc')}
---
- [1, !!binary YWJj]
...

tarantool> s:update({1}, {{':', 2, 2, 1, varbinary.new('d')}})
---
- [1, !!binary YWRj]
...

tarantool> tostring(s:get{1}[2])
---
- adc
...
@alyapunov alyapunov added the feature A new functionality label May 8, 2024
@alyapunov alyapunov self-assigned this May 13, 2024
@alyapunov alyapunov changed the title Suppory splice update operation for varbinary fields Support splice update operation for varbinary fields May 15, 2024
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 15, 2024
@TarantoolBot document
Title: splice update operation now supports varbinary

Just in case splice is an update operaion 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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 15, 2024
@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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 20, 2024
@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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 20, 2024
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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 21, 2024
@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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 21, 2024
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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 21, 2024
@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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 21, 2024
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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 21, 2024
…inary.md

Co-authored-by: Kseniia Antonova <73473519+xuniq@users.noreply.github.com>
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 22, 2024
@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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 22, 2024
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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 24, 2024
@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
alyapunov added a commit to alyapunov/tarantool that referenced this issue May 24, 2024
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
alyapunov added a commit that referenced this issue May 24, 2024
@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 #9997
alyapunov added a commit that referenced this issue May 24, 2024
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 #9997
Closes #10032

NO_DOC=tests
NO_CHANGELOG=tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant