11/* *
22 * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3- * reserved. SPDX-License-Identifier: Apache-2.0
3+ * SPDX-License-Identifier: Apache-2.0
44 */
55
66#include < cudf_test/cudf_gtest.hpp>
@@ -50,6 +50,11 @@ TEST_F(StreamingChannelMetadata, OrderSchemeCtorRejectsNullBoundaries)
5050 std::invalid_argument);
5151}
5252
53+ TEST_F (StreamingChannelMetadata, OrderSchemeCtorRejectsEmptyOrderings)
54+ {
55+ EXPECT_THROW (static_cast <void >(order_scheme (std::vector<ordering>{})), std::invalid_argument);
56+ }
57+
5358TEST_F (StreamingChannelMetadata, PartitioningSpec)
5459{
5560 // None
@@ -173,14 +178,14 @@ class StreamingChannelMetadataGPU : public ::testing::Test {
173178 }
174179};
175180
176- TEST_F (StreamingChannelMetadataGPU, OrderSchemeReplaceKeys )
181+ TEST_F (StreamingChannelMetadataGPU, OrderingReplaceKeys )
177182{
178183 order_key k0{0 , cudf::order::ASCENDING , cudf::null_order::BEFORE };
179184 order_key k5{5 , cudf::order::DESCENDING , cudf::null_order::AFTER };
180185
181- auto b = make_chunk ({100 , 200 });
182- order_scheme o1 ({k0}, b);
183- auto o2 = o1.with_keys ({k5});
186+ auto b = make_chunk ({100 , 200 });
187+ ordering o1 = ordering ({k0}, b);
188+ auto o2 = o1.with_keys ({k5});
184189
185190 EXPECT_EQ (o2.keys [0 ].column_index , 5 );
186191 EXPECT_EQ (o2.keys [0 ].order , cudf::order::DESCENDING );
@@ -192,22 +197,40 @@ TEST_F(StreamingChannelMetadataGPU, OrderSchemeReplaceKeys)
192197 EXPECT_THROW (static_cast <void >(o1.with_keys ({k0, k5})), std::invalid_argument);
193198}
194199
195- TEST_F (StreamingChannelMetadataGPU, OrderSchemeBoundariesAlignedWith)
200+ TEST_F (StreamingChannelMetadataGPU, OrderSchemeMultipleOrderings)
201+ {
202+ order_key k0{0 , cudf::order::ASCENDING , cudf::null_order::BEFORE };
203+ order_key k2{2 , cudf::order::DESCENDING , cudf::null_order::AFTER };
204+
205+ auto b0 = make_chunk ({100 , 200 });
206+ auto b1 = make_chunk ({300 , 400 });
207+ order_scheme o ({ordering{{k0}, b0, true }, ordering{{k2}, b1, false }});
208+
209+ ASSERT_EQ (o.orderings .size (), 2 );
210+ EXPECT_EQ (o.orderings [0 ].keys [0 ], k0);
211+ EXPECT_EQ (o.orderings [0 ].boundaries .get (), b0.get ());
212+ EXPECT_TRUE (o.orderings [0 ].strict_boundaries );
213+ EXPECT_EQ (o.orderings [1 ].keys [0 ], k2);
214+ EXPECT_EQ (o.orderings [1 ].boundaries .get (), b1.get ());
215+ EXPECT_FALSE (o.orderings [1 ].strict_boundaries );
216+ }
217+
218+ TEST_F (StreamingChannelMetadataGPU, OrderingBoundariesAlignedWith)
196219{
197220 order_key k0{0 , cudf::order::ASCENDING , cudf::null_order::BEFORE };
198221 order_key k3{3 , cudf::order::ASCENDING , cudf::null_order::BEFORE };
199222
200- order_scheme o1 ({k0}, make_chunk ({100 , 200 }));
201- order_scheme o2 ({k0}, make_chunk ({100 , 200 }));
223+ ordering o1 ({k0}, make_chunk ({100 , 200 }));
224+ ordering o2 ({k0}, make_chunk ({100 , 200 }));
202225 EXPECT_TRUE (o1.boundaries_aligned_with (o2, *br));
203226
204- order_scheme o_shifted ({k3}, make_chunk ({100 , 200 }));
227+ ordering o_shifted ({k3}, make_chunk ({100 , 200 }));
205228 EXPECT_TRUE (o1.boundaries_aligned_with (o_shifted, *br));
206229
207- order_scheme o_strict ({k0}, make_chunk ({100 , 200 }), /* strict =*/ true );
230+ ordering o_strict ({k0}, make_chunk ({100 , 200 }), /* strict_boundaries =*/ true );
208231 EXPECT_FALSE (o1.boundaries_aligned_with (o_strict, *br));
209232
210- order_scheme o_diff ({k0}, make_chunk ({100 , 300 }));
233+ ordering o_diff ({k0}, make_chunk ({100 , 300 }));
211234 EXPECT_FALSE (o1.boundaries_aligned_with (o_diff, *br));
212235}
213236
@@ -219,10 +242,10 @@ TEST_F(StreamingChannelMetadataGPU, PartitioningSpecOrder)
219242 auto spec = partitioning_spec::from_order (o);
220243 EXPECT_EQ (spec.type , partitioning_spec::type::ORDER );
221244 EXPECT_TRUE (spec.order .has_value ());
222- EXPECT_EQ (spec.order ->keys [0 ].column_index , 0 );
245+ EXPECT_EQ (spec.order ->orderings [ 0 ]. keys [0 ].column_index , 0 );
223246
224247 // Type checks only (partitioning_spec::operator== removed; ORDER value comparison
225- // requires boundaries_aligned_with on the order_scheme directly)
248+ // requires boundaries_aligned_with on the ordering directly)
226249 EXPECT_EQ (spec.type , partitioning_spec::type::ORDER );
227250 EXPECT_NE (spec.type , partitioning_spec::from_hash (hash_scheme{{0 }, 16 }).type );
228251 EXPECT_NE (spec.type , partitioning_spec::none ().type );
0 commit comments