@@ -170,6 +170,9 @@ enum class ExchangeInputKind {
170170 kDeep10K ,
171171 kDeep50 ,
172172 kStruct1K ,
173+ kNested1_1K ,
174+ kNested2_1K ,
175+ kNested3_1K ,
173176};
174177
175178struct ExchangeInputSpec {
@@ -242,6 +245,17 @@ RowTypePtr makeDeepType() {
242245 ROW ({{" s2_int" , INTEGER ()}, {" s2_string" , VARCHAR ()}})))}});
243246}
244247
248+ // N levels of single-field ROW wrapping a BIGINT leaf, behind a BIGINT "c0"
249+ // partition key. Exercises the nested-ROW serialization path; combined with
250+ // nullPct it produces independent nulls at every ROW level and the leaf.
251+ RowTypePtr makeNestedType (int level) {
252+ TypePtr inner = BIGINT ();
253+ for (int i = 0 ; i < level; ++i) {
254+ inner = ROW ({" r" }, {inner});
255+ }
256+ return ROW ({" c0" , " v" }, {BIGINT (), inner});
257+ }
258+
245259ExchangeInputSpec makeInputSpec (ExchangeInputKind kind) {
246260 switch (kind) {
247261 case ExchangeInputKind::kDeep10K :
@@ -250,6 +264,12 @@ ExchangeInputSpec makeInputSpec(ExchangeInputKind kind) {
250264 return {" Deep50" , makeDeepType (), 2000 , 50 };
251265 case ExchangeInputKind::kStruct1K :
252266 return {" Struct1K" , makeStructType (), 100 , 1000 };
267+ case ExchangeInputKind::kNested1_1K :
268+ return {" Nested1_1K" , makeNestedType (1 ), 100 , 1000 };
269+ case ExchangeInputKind::kNested2_1K :
270+ return {" Nested2_1K" , makeNestedType (2 ), 100 , 1000 };
271+ case ExchangeInputKind::kNested3_1K :
272+ return {" Nested3_1K" , makeNestedType (3 ), 100 , 1000 };
253273 }
254274
255275 VELOX_UNREACHABLE ();
@@ -401,6 +421,21 @@ class ExchangeBenchmark : public VectorTestBase {
401421 [](auto row) { return static_cast <int128_t >(row); },
402422 isNull,
403423 type);
424+ case TypeKind::ROW : {
425+ // Build each child independently and apply row-level nulls so a ROW
426+ // column carries nulls at this level and, recursively, at every nested
427+ // ROW level and the leaf.
428+ const auto & rowType = type->asRow ();
429+ std::vector<std::string> names;
430+ std::vector<VectorPtr> children;
431+ names.reserve (rowType.size ());
432+ children.reserve (rowType.size ());
433+ for (auto i = 0 ; i < rowType.size (); ++i) {
434+ names.push_back (rowType.nameOf (i));
435+ children.push_back (makeColumn (rowType.childAt (i), numRows, nullPct));
436+ }
437+ return makeRowVector (names, children, isNull);
438+ }
404439 default :
405440 VELOX_NYI (
406441 " makeColumn does not support complex type {} yet" ,
@@ -718,12 +753,24 @@ EXCHANGE_BENCHMARK_CASE(
718753 Simple10K_Double_col16,
719754 makeInputSpec (SimpleColType::kDouble , 16 ));
720755
721- // The complex type benchmarks are temporarily disabled.
756+ // The ARRAY/MAP complex type benchmarks are temporarily disabled because
757+ // makeColumn does not generate ARRAY/MAP yet.
722758// EXCHANGE_BENCHMARK_CASE(Deep10K, makeInputSpec(ExchangeInputKind::kDeep10K));
723759// EXCHANGE_BENCHMARK_CASE(Deep50, makeInputSpec(ExchangeInputKind::kDeep50));
724760// EXCHANGE_BENCHMARK_CASE(Struct1K,
725761// makeInputSpec(ExchangeInputKind::kStruct1K));
726762
763+ // Nested ROW columns (makeColumn supports ROW recursively).
764+ EXCHANGE_BENCHMARK_CASE (
765+ Nested1_1K,
766+ makeInputSpec (ExchangeInputKind::kNested1_1K ));
767+ EXCHANGE_BENCHMARK_CASE (
768+ Nested2_1K,
769+ makeInputSpec (ExchangeInputKind::kNested2_1K ));
770+ EXCHANGE_BENCHMARK_CASE (
771+ Nested3_1K,
772+ makeInputSpec (ExchangeInputKind::kNested3_1K ));
773+
727774#undef EXCHANGE_BENCHMARK_CASE
728775#undef EXCHANGE_BENCHMARK_MODES
729776#undef EXCHANGE_BENCHMARK_INPUT
0 commit comments