jhorstmann commented on a change in pull request #8092:
URL: https://github.com/apache/arrow/pull/8092#discussion_r483965365
##########
File path: rust/datafusion/src/physical_plan/sort.rs
##########
@@ -223,4 +223,51 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_lex_sort_by_float() -> Result<()> {
+ let schema = test::aggr_test_schema();
+ let partitions = 4;
+ let path = test::create_partitioned_csv("aggregate_test_100.csv",
partitions)?;
+ let csv =
+ CsvExec::try_new(&path, CsvReadOptions::new().schema(&schema),
None, 1024)?;
+
+ let sort_exec = Arc::new(SortExec::try_new(
+ vec![
+ // c11 float32 column
+ PhysicalSortExpr {
+ expr: col("c11"),
+ options: SortOptions::default(),
+ },
+ // c12 float64 column
+ PhysicalSortExpr {
+ expr: col("c12"),
+ options: SortOptions::default(),
+ },
+ ],
+ Arc::new(MergeExec::new(Arc::new(csv), 2)),
+ 2,
+ )?);
+
+ assert_eq!(DataType::Float32,
*sort_exec.schema().field(10).data_type());
+ assert_eq!(DataType::Float64,
*sort_exec.schema().field(11).data_type());
+
+ let result: Vec<RecordBatch> = test::execute(sort_exec)?;
+ assert_eq!(result.len(), 1);
+
+ let columns = result[0].columns();
+
+ assert_eq!(DataType::Float32, *columns[10].data_type());
+ assert_eq!(DataType::Float64, *columns[11].data_type());
+
+ let c11 = as_primitive_array::<Float32Type>(&columns[10]);
+ assert_eq!(c11.value(0), 0.028003037_f32);
Review comment:
Changed to an in-memory test which also tests the null and nan handling
a little
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]