Move tests from expr.rs to sqllogictests. Part1#8773
Conversation
| -- out of bounds | ||
| ([5,4,3,2,1])[0], | ||
| ([5,4,3,2,1])[6], | ||
| -- ([5,4,3,2,1])[-1], -- TODO: wrong answer |
There was a problem hiding this comment.
seem like we can return the correct answer
DataFusion CLI v34.0.0
❯ select [1,2,3,4][-1];
+------------------------------------------------------------+
| make_array(Int64(1),Int64(2),Int64(3),Int64(4))[Int64(-1)] |
+------------------------------------------------------------+
| 4 |
+------------------------------------------------------------+
1 row in set. Query took 0.019 seconds.
❯ select [1,2,3,4][-4];
+------------------------------------------------------------+
| make_array(Int64(1),Int64(2),Int64(3),Int64(4))[Int64(-4)] |
+------------------------------------------------------------+
| 1 |
+------------------------------------------------------------+
1 row in set. Query took 0.001 seconds.
❯ select [1,2,3,4][-5] is null;
+--------------------------------------------------------------------+
| make_array(Int64(1),Int64(2),Int64(3),Int64(4))[Int64(-5)] IS NULL |
+--------------------------------------------------------------------+
| true |
+--------------------------------------------------------------------+
1 row in set. Query took 0.001 seconds.
There was a problem hiding this comment.
I have checked with PG
select (array[1,2,3,4])[-1]
null
There was a problem hiding this comment.
I'll create a followup issue to be in sync with PG
alamb
left a comment
There was a problem hiding this comment.
Epic work @comphead -- and thank you for the review @haohuaijin
There was one test I couldn't find ported but otherwise things look great here
| [true, false], | ||
| ['str1', 'str2'], | ||
| [[1,2], [3,4]], | ||
| [] |
There was a problem hiding this comment.
💯 for adding the test that was commented out in the rs test
| 0 years 12 mons 1 days 1 hours 1 mins 1.000000000 secs | ||
|
|
||
| query I | ||
| SELECT ascii('') |
There was a problem hiding this comment.
I actually prefer this style (one query per expression) rather than the style earlier in the PR of one query with all the expressions as I find the output easier to understand
| query T | ||
| SELECT chr(CAST(128175 AS int)) | ||
| ---- | ||
| 💯 |
| Ok(()) | ||
| } | ||
|
|
||
| /// Test string expressions test split into two batches |
There was a problem hiding this comment.
it is sweet that that this is no longer a problem with sqllogictest (though to be fair this code should probably have been using functions rather than macros)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Which issue does this PR close?
Closes partially #8201.
Rationale for this change
Move tests from
expr.rsto sqllogictests. Moved most of tests, other tests need more per-test attenttionWhat changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?