File: hints.test.lua

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 85,412 kB
  • sloc: ansic: 513,775; cpp: 69,493; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,178; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (62 lines) | stat: -rw-r--r-- 1,612 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--
-- gh-3961: Introduce tuple comparison hints
-- We must to enshure that hints don't broke
-- tuple comparison.
--
ffi = require('ffi')

test_run = require('test_run')
inspector = test_run.new()
engine = inspector:get_cfg('engine')

inspector:cmd("setopt delimiter ';'");
function insert_values(type)
        local x = 54
        while (x < 64) do
                local val = ffi.new(type, (2LLU^x)-1)
                s:replace({val})
                x = x + 1
        end
end;
inspector:cmd("setopt delimiter ''");

-- Test that hints does not violate the correct order of
-- big numeric fields.
s = box.schema.space.create('test', {engine = engine})
i1 = s:create_index('i1', {parts = {1, 'unsigned'}})
insert_values('uint64_t')
s:select()
i1:alter{parts = {1, 'integer'}}
insert_values('int64_t')
s:select()
i1:alter{parts = {1, 'number'}}
insert_values('double')
s:select()
s:drop()

-- Test that the use of hint(s) does not violate alter between
-- scalar and string.
s = box.schema.space.create('test', {engine = engine})
i1 = s:create_index('i1', {parts = {1, 'string'}})
s:insert({"bbb"})
s:insert({"ccc"})
i1:alter{parts = {1, 'scalar'}}
s:insert({"aaa"})
s:insert({"ddd"})
s:select()
s:drop()

-- Test that hints does not violate the correct order of
-- numeric fields (on alter).
s = box.schema.space.create('test', {engine = engine})
i1 = s:create_index('i1', {parts = {1, 'unsigned'}})
s:insert({11})
i1:alter{parts = {1, 'integer'}}
s:insert({-22})
i1:alter{parts = {1, 'number'}}
s:insert({-33.33})
i1:alter{parts = {1, 'scalar'}}
s:insert({44.44})
s:insert({"Hello world"})
s:select()
s:drop()