alamb commented on code in PR #5110:
URL: https://github.com/apache/arrow-datafusion/pull/5110#discussion_r1091050609


##########
datafusion/core/tests/sqllogictests/README.md:
##########
@@ -97,17 +97,27 @@ Query records follow the format:
 
 ```sql
 # <test_name>
-query <type_string> <sort_mode> <label>
+query <type_string> <sort_mode>
 <sql_query>
 ----
 <expected_result>
 ```
 
 - `test_name`: Uniquely identify the test name (arrow-datafusion only)
-- `type_string`: A short string that specifies the number of result columns 
and the expected datatype of each result column. There is one character in the 
<type_string> for each result column. The characters codes are "T" for a text 
result, "I" for an integer result, and "R" for a floating-point result.
-- (Optional) `label`: sqllogictest stores a hash of the results of this query 
under the given label. If the label is reused, then sqllogictest verifies that 
the results are the same. This can be used to verify that two or more queries 
in the same test script that are logically equivalent always generate the same 
output.
-- `expected_result`: In the results section, integer values are rendered as if 
by printf("%d"). Floating point values are rendered as if by printf("%.3f"). 
NULL values are rendered as "NULL". Empty strings are rendered as "(empty)". 
Within non-empty strings, all control characters and unprintable characters are 
rendered as "@".
-- `sort_mode`: If included, it must be one of "nosort", "rowsort", or 
"valuesort". The default is "nosort". In nosort mode, the results appear in 
exactly the order in which they were received from the database engine. The 
nosort mode should only be used on queries that have an ORDER BY clause or 
which only have a single row of result, since otherwise the order of results is 
undefined and might vary from one database engine to another. The "rowsort" 
mode gathers all output from the database engine then sorts it by rows on the 
client side. Sort comparisons use strcmp() on the rendered ASCII text 
representation of the values. Hence, "9" sorts after "10", not before. The 
"valuesort" mode works like rowsort except that it does not honor row 
groupings. Each individual result value is sorted on its own.
+- `type_string`: A short string that specifies the number of result columns 
and the expected datatype of each result column. There is one character in the 
<type_string> for each result column. The characters codes are:
+  - "T" for a text result,
+  - "I" for an integer result,
+  - "R" for a floating-point result,
+  - "?" for any other type.
+- `expected_result`: In the results section, some values are converted 
according to some rules:
+  - floating point values are rounded to the scale of "12",
+  - NULL values are rendered as `NULL`,
+  - empty strings are rendered as `(empty)`,
+  - boolean values are rendered as `true`/`false`,
+  - this list can be not exhaustive, check the 
`datafusion/core/tests/sqllogictests/src/engines/conversion.rs` for details.
+- `sort_mode`: If included, it must be one of `nosort`, `rowsort` (default), 
or `valuesort`. In `nosort` mode, the results appear in exactly the order in 
which they were received from the database engine. The `nosort` mode should 
only be used on queries that have an `ORDER BY` clause or which only have a 
single row of result, since otherwise the order of results is undefined and 
might vary from one database engine to another. The `rowsort` mode gathers all 
output from the database engine then sorts it by rows on the client side. Sort 
comparisons use 
[sort_unstable](https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable)
 on the rendered text representation of the values. Hence, "9" sorts after 
"10", not before. The `valuesort` mode works like `rowsort` except that it does 
not honor row groupings. Each individual result value is sorted on its own.

Review Comment:
   I like this idea to default to `rowsort` as it is less of a foot gun



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to