bug: virtual table has tuple with wrong type
Consider arithmetic_space from integration tests. The values are as in insert:
sbroad.execute(
[[
insert into "arithmetic_space"
("id", "a", "b", "c", "d", "e", "f", "boolean_col", "string_col", "number_col")
values (?,?,?,?,?,?,?,?,?,?),
(?,?,?,?,?,?,?,?,?,?),
(?,?,?,?,?,?,?,?,?,?),
(?,?,?,?,?,?,?,?,?,?)
]],
{
1, 1, 1, 1, 1, 2, 2, true, "a", 3.14,
2, 1, 2, 1, 2, 2, 2, true, "a", 3,
3, 2, 3, 1, 2, 2, 2, true, "c", 3.14,
4, 2, 3, 1, 1, 2, 2, true, "c", 3.1475
})
Then the following query fails:
sbroad.execute([[select * from "arithmetic_space" where "b" in (select cast("number_col" as double) from "arithmetic_space")]], {})
---
- null
- 'Sbroad Error: Lua error (dispatch IR): LuaError(ExecutionError("Sbroad Error: Failed
to execute the query: failed to insert tuple: tuple Tuple(Array([Integer(PosInt(3)),
Integer(PosInt(1))])) into TMP_ace50b197d654b8d90232961bcf78c46_50: Tarantool error:
FieldType: Tuple field 1 (COLUMN_1) type does not match one required by operation:
expected double, got unsigned"))'
...
If you print virtual table, you will get this:
test_app.router-1 | got vtable: Column { name: "COLUMN_1", type: Double, role: User },
test_app.router-1 | [Double(Double { value: 3.14 })]
test_app.router-1 | [Integer(3)]
test_app.router-1 | [Double(Double { value: 3.14 })]
test_app.router-1 | [Double(Double { value: 3.1475 })]
So tuple (3) must have Double type, but somehow it is an integer
Edited by Arseniy Volynets