[
https://issues.apache.org/jira/browse/IGNITE-23022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksim Zhuravkov updated IGNITE-23022:
--------------------------------------
Description:
In order to simplify tests in the SQLLogic test suite, we can add
parameterisation support via for loops with multiple values (iteration over
sequence of values).
{noformat}
for (a, b, r) in [ (1, 2, 3) , (2, 3, 5) , (3, 4, 7), (4, 6, 10) ]
query T
SELECT ${a} + ${b}
----
${r}
endfor
{noformat}
We can use this construction to update tests that use some value and a type
(see tests in test_cast_*.test):
{noformat}
statement error: Cast function cannot convert value of type DATE to type INT
SELECT CAST('2000-01-01'::DATE AS INT);
statement error: Cast function cannot convert value of type BINARY(1) to type
INT
SELECT CAST(x'00' AS INT);
for (type, val) in [ ('2000-01-01'::DATE, DATE), (x'00', BINARY(1))
statement error: Cast function cannot convert value of type ${type} to type INT
SELECT CAST(${val} AS INT);
endfor
{noformat}
was:
In order to simplify tests in the SQLLogic test suite, we can add
parameterisation support via for loops with multiple values (iteration over
sequence of values).
{noformat}
for (a, b, r) in [ (1, 2, 3) , (2, 3, 5) , (3, 4, 7), (4, 6, 10) ]
query T
SELECT ${a} + ${b}
----
${r}
endfor
{noformat}
We can use this construction to update tests that use some value and a type:
{noformat}
statement error: Cast function cannot convert value of type DATE to type INT
SELECT CAST('2000-01-01'::DATE AS INT);
statement error: Cast function cannot convert value of type BINARY(1) to type
INT
SELECT CAST(x'00' AS INT);
for (type, val) in [ ('2000-01-01'::DATE, DATE), (x'00', BINARY(1))
statement error: Cast function cannot convert value of type ${type} to type INT
SELECT CAST(${val} AS INT);
endfor
{noformat}
> Sql. Add for-loop with multiple values to SQL logic tests
> ---------------------------------------------------------
>
> Key: IGNITE-23022
> URL: https://issues.apache.org/jira/browse/IGNITE-23022
> Project: Ignite
> Issue Type: Improvement
> Components: sql
> Reporter: Maksim Zhuravkov
> Priority: Minor
> Labels: ignite-3
>
> In order to simplify tests in the SQLLogic test suite, we can add
> parameterisation support via for loops with multiple values (iteration over
> sequence of values).
> {noformat}
> for (a, b, r) in [ (1, 2, 3) , (2, 3, 5) , (3, 4, 7), (4, 6, 10) ]
> query T
> SELECT ${a} + ${b}
> ----
> ${r}
> endfor
> {noformat}
> We can use this construction to update tests that use some value and a type
> (see tests in test_cast_*.test):
> {noformat}
> statement error: Cast function cannot convert value of type DATE to type INT
> SELECT CAST('2000-01-01'::DATE AS INT);
> statement error: Cast function cannot convert value of type BINARY(1) to type
> INT
> SELECT CAST(x'00' AS INT);
> for (type, val) in [ ('2000-01-01'::DATE, DATE), (x'00', BINARY(1))
> statement error: Cast function cannot convert value of type ${type} to type
> INT
> SELECT CAST(${val} AS INT);
> endfor
> {noformat}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)