ShayanGho commented on code in PR #26020:
URL: https://github.com/apache/datafusion/pull/26020#discussion_r4372946845
##########
datafusion/proto/tests/cases/plans/windows.rs:
##########
@@ -306,3 +306,82 @@ fn roundtrip_lead_with_default_value() -> Result<()> {
true,
)?))
}
+
+/// Raw [a, b] ordering is insufficient after signed-zero groups merge. Verify
+/// planning adds the required ordering and that it survives serialization.
+#[tokio::test]
+async fn roundtrip_signed_zero_window() -> Result<()> {
+ use datafusion::arrow::array::{Float64Array, Int64Array, RecordBatch,
UInt64Array};
+ use datafusion::datasource::MemTable;
+ use datafusion::physical_plan::collect;
+ use datafusion::prelude::{SessionConfig, SessionContext, col};
+ use datafusion_proto::physical_plan::{
+ DefaultPhysicalExtensionCodec, DefaultPhysicalProtoConverter,
+ };
+
+ let ctx =
+
SessionContext::new_with_config(SessionConfig::new().with_target_partitions(1));
+ let schema = Arc::new(Schema::new(vec![
+ Field::new("a", DataType::Float64, false),
+ Field::new("b", DataType::Int64, false),
+ ]));
+ let batch = RecordBatch::try_new(
+ Arc::clone(&schema),
+ vec![
+ Arc::new(Float64Array::from(vec![-0.0, 0.0])),
+ Arc::new(Int64Array::from(vec![2, 1])),
+ ],
+ )?;
+ let table = MemTable::try_new(schema,
vec![vec![batch]])?.with_sort_order(vec![
Review Comment:
Added in `negative_zero.slt`: a pre-sorted single float key with `count(*)
OVER (PARTITION BY a)` whose plan shows no second `SortExec`, and raw list keys
`[-0.0, 2.0]`, `[0.0, 1.0]`, `[0.0, 2.0]` where the plan shows the sort on the
normalized key being inserted and the counts come out 2, 1, 2.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]