forked from tarantool/tarantool
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
box, datetime: datetime comparison for indices
* storage hints implemented for datetime_t values; * proper comparison for indices of datetime type. Part of tarantool#5941 Part of tarantool#5946
- Loading branch information
Showing
7 changed files
with
165 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
-- test-run result file version 2 | ||
env = require('test_run') | ||
| --- | ||
| ... | ||
test_run = env.new() | ||
| --- | ||
| ... | ||
engine = test_run:get_cfg('engine') | ||
| --- | ||
| ... | ||
|
||
date = require('datetime') | ||
| --- | ||
| ... | ||
|
||
_ = box.schema.space.create('T', {engine = engine}) | ||
| --- | ||
| ... | ||
_ = box.space.T:create_index('pk', {parts={1,'datetime'}}) | ||
| --- | ||
| ... | ||
|
||
box.space.T:insert{date('1970-01-01')}\ | ||
box.space.T:insert{date('1970-01-02')}\ | ||
box.space.T:insert{date('1970-01-03')}\ | ||
box.space.T:insert{date('2000-01-01')} | ||
| --- | ||
| ... | ||
|
||
o = box.space.T:select{} | ||
| --- | ||
| ... | ||
assert(tostring(o[1][1]) == '1970-01-01T00:00Z') | ||
| --- | ||
| - true | ||
| ... | ||
assert(tostring(o[2][1]) == '1970-01-02T00:00Z') | ||
| --- | ||
| - true | ||
| ... | ||
assert(tostring(o[3][1]) == '1970-01-03T00:00Z') | ||
| --- | ||
| - true | ||
| ... | ||
assert(tostring(o[4][1]) == '2000-01-01T00:00Z') | ||
| --- | ||
| - true | ||
| ... | ||
|
||
for i = 1,16 do\ | ||
box.space.T:insert{date.now()}\ | ||
end | ||
| --- | ||
| ... | ||
|
||
a = box.space.T:select{} | ||
| --- | ||
| ... | ||
err = nil | ||
| --- | ||
| ... | ||
for i = 1, #a - 1 do\ | ||
if tostring(a[i][1]) >= tostring(a[i+1][1]) then\ | ||
err = {a[i][1], a[i+1][1]}\ | ||
break\ | ||
end\ | ||
end | ||
| --- | ||
| ... | ||
|
||
err | ||
| --- | ||
| - null | ||
| ... | ||
box.space.T:drop() | ||
| --- | ||
| ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
env = require('test_run') | ||
test_run = env.new() | ||
engine = test_run:get_cfg('engine') | ||
|
||
date = require('datetime') | ||
|
||
_ = box.schema.space.create('T', {engine = engine}) | ||
_ = box.space.T:create_index('pk', {parts={1,'datetime'}}) | ||
|
||
box.space.T:insert{date('1970-01-01')}\ | ||
box.space.T:insert{date('1970-01-02')}\ | ||
box.space.T:insert{date('1970-01-03')}\ | ||
box.space.T:insert{date('2000-01-01')} | ||
|
||
o = box.space.T:select{} | ||
assert(tostring(o[1][1]) == '1970-01-01T00:00Z') | ||
assert(tostring(o[2][1]) == '1970-01-02T00:00Z') | ||
assert(tostring(o[3][1]) == '1970-01-03T00:00Z') | ||
assert(tostring(o[4][1]) == '2000-01-01T00:00Z') | ||
|
||
for i = 1,16 do\ | ||
box.space.T:insert{date.now()}\ | ||
end | ||
|
||
a = box.space.T:select{} | ||
err = nil | ||
for i = 1, #a - 1 do\ | ||
if tostring(a[i][1]) >= tostring(a[i+1][1]) then\ | ||
err = {a[i][1], a[i+1][1]}\ | ||
break\ | ||
end\ | ||
end | ||
|
||
err | ||
box.space.T:drop() |