in datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs [1449:1722]
fn new() -> Self {
// Intern batch 1
let col1 = Int64Array::from(vec![
// Repeated rows in batch
Some(42), // all not nulls + repeated rows + exist in map case
None, // mixed + repeated rows + exist in map case
None, // mixed + repeated rows + not exist in map case
Some(1142), // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some(42),
None,
None,
Some(1142),
None,
// Unique rows in batch
Some(4211), // all not nulls + unique rows + exist in map case
None, // mixed + unique rows + exist in map case
None, // mixed + unique rows + not exist in map case
Some(4212), // mixed + unique rows + not exist in map case
]);
let col2 = StringArray::from(vec![
// Repeated rows in batch
Some("string1"), // all not nulls + repeated rows + exist in map case
None, // mixed + repeated rows + exist in map case
Some("string2"), // mixed + repeated rows + not exist in map case
None, // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some("string1"),
None,
Some("string2"),
None,
None,
// Unique rows in batch
Some("string3"), // all not nulls + unique rows + exist in map case
None, // mixed + unique rows + exist in map case
Some("string4"), // mixed + unique rows + not exist in map case
None, // mixed + unique rows + not exist in map case
]);
let col3 = StringViewArray::from(vec![
// Repeated rows in batch
Some("stringview1"), // all not nulls + repeated rows + exist in map case
Some("stringview2"), // mixed + repeated rows + exist in map case
None, // mixed + repeated rows + not exist in map case
None, // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some("stringview1"),
Some("stringview2"),
None,
None,
None,
// Unique rows in batch
Some("stringview3"), // all not nulls + unique rows + exist in map case
Some("stringview4"), // mixed + unique rows + exist in map case
None, // mixed + unique rows + not exist in map case
None, // mixed + unique rows + not exist in map case
]);
let batch1 = vec![
Arc::new(col1) as _,
Arc::new(col2) as _,
Arc::new(col3) as _,
];
// Intern batch 2
let col1 = Int64Array::from(vec![
// Repeated rows in batch
Some(42), // all not nulls + repeated rows + exist in map case
None, // mixed + repeated rows + exist in map case
None, // mixed + repeated rows + not exist in map case
Some(21142), // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some(42),
None,
None,
Some(21142),
None,
// Unique rows in batch
Some(4211), // all not nulls + unique rows + exist in map case
None, // mixed + unique rows + exist in map case
None, // mixed + unique rows + not exist in map case
Some(24212), // mixed + unique rows + not exist in map case
]);
let col2 = StringArray::from(vec![
// Repeated rows in batch
Some("string1"), // all not nulls + repeated rows + exist in map case
None, // mixed + repeated rows + exist in map case
Some("2string2"), // mixed + repeated rows + not exist in map case
None, // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some("string1"),
None,
Some("2string2"),
None,
None,
// Unique rows in batch
Some("string3"), // all not nulls + unique rows + exist in map case
None, // mixed + unique rows + exist in map case
Some("2string4"), // mixed + unique rows + not exist in map case
None, // mixed + unique rows + not exist in map case
]);
let col3 = StringViewArray::from(vec![
// Repeated rows in batch
Some("stringview1"), // all not nulls + repeated rows + exist in map case
Some("stringview2"), // mixed + repeated rows + exist in map case
None, // mixed + repeated rows + not exist in map case
None, // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some("stringview1"),
Some("stringview2"),
None,
None,
None,
// Unique rows in batch
Some("stringview3"), // all not nulls + unique rows + exist in map case
Some("stringview4"), // mixed + unique rows + exist in map case
None, // mixed + unique rows + not exist in map case
None, // mixed + unique rows + not exist in map case
]);
let batch2 = vec![
Arc::new(col1) as _,
Arc::new(col2) as _,
Arc::new(col3) as _,
];
// Intern batch 3
let col1 = Int64Array::from(vec![
// Repeated rows in batch
Some(42), // all not nulls + repeated rows + exist in map case
None, // mixed + repeated rows + exist in map case
None, // mixed + repeated rows + not exist in map case
Some(31142), // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some(42),
None,
None,
Some(31142),
None,
// Unique rows in batch
Some(4211), // all not nulls + unique rows + exist in map case
None, // mixed + unique rows + exist in map case
None, // mixed + unique rows + not exist in map case
Some(34212), // mixed + unique rows + not exist in map case
]);
let col2 = StringArray::from(vec![
// Repeated rows in batch
Some("string1"), // all not nulls + repeated rows + exist in map case
None, // mixed + repeated rows + exist in map case
Some("3string2"), // mixed + repeated rows + not exist in map case
None, // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some("string1"),
None,
Some("3string2"),
None,
None,
// Unique rows in batch
Some("string3"), // all not nulls + unique rows + exist in map case
None, // mixed + unique rows + exist in map case
Some("3string4"), // mixed + unique rows + not exist in map case
None, // mixed + unique rows + not exist in map case
]);
let col3 = StringViewArray::from(vec![
// Repeated rows in batch
Some("stringview1"), // all not nulls + repeated rows + exist in map case
Some("stringview2"), // mixed + repeated rows + exist in map case
None, // mixed + repeated rows + not exist in map case
None, // mixed + repeated rows + not exist in map case
None, // all nulls + repeated rows + exist in map case
Some("stringview1"),
Some("stringview2"),
None,
None,
None,
// Unique rows in batch
Some("stringview3"), // all not nulls + unique rows + exist in map case
Some("stringview4"), // mixed + unique rows + exist in map case
None, // mixed + unique rows + not exist in map case
None, // mixed + unique rows + not exist in map case
]);
let batch3 = vec![
Arc::new(col1) as _,
Arc::new(col2) as _,
Arc::new(col3) as _,
];
// Expected batch
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Int64, true),
Field::new("b", DataType::Utf8, true),
Field::new("c", DataType::Utf8View, true),
]));
let col1 = Int64Array::from(vec![
// Repeated rows in batch
Some(42),
None,
None,
Some(1142),
None,
Some(21142),
None,
Some(31142),
None,
// Unique rows in batch
Some(4211),
None,
None,
Some(4212),
None,
Some(24212),
None,
Some(34212),
]);
let col2 = StringArray::from(vec![
// Repeated rows in batch
Some("string1"),
None,
Some("string2"),
None,
Some("2string2"),
None,
Some("3string2"),
None,
None,
// Unique rows in batch
Some("string3"),
None,
Some("string4"),
None,
Some("2string4"),
None,
Some("3string4"),
None,
]);
let col3 = StringViewArray::from(vec![
// Repeated rows in batch
Some("stringview1"),
Some("stringview2"),
None,
None,
None,
None,
None,
None,
None,
// Unique rows in batch
Some("stringview3"),
Some("stringview4"),
None,
None,
None,
None,
None,
None,
]);
let expected_batch = vec![
Arc::new(col1) as _,
Arc::new(col2) as _,
Arc::new(col3) as _,
];
let expected_batch = RecordBatch::try_new(schema, expected_batch).unwrap();
Self {
test_batches: vec![batch1, batch2, batch3],
expected_batch,
}
}