pub(crate) async fn make_one_partition_with_tombstones(
    exec: &iox_query::exec::Executor,
    loc: DataLocation,
    sequencer_id: SequencerId,
    table_id: TableId,
    table_name: &str,
) -> BTreeMap<String, PartitionData> {
    // In-memory data includes these rows but split between 4 groups go into
    // different batches of parittion 1 or partittion 2  as requeted
    // let expected = vec![
    //         "+------------+-----+------+--------------------------------+",
    //         "| city       | day | temp | time                           |",
    //         "+------------+-----+------+--------------------------------+",
    //         "| Andover    | tue | 56   | 1970-01-01T00:00:00.000000030Z |", // in group 1 - seq_num: 2
    //         "| Andover    | mon |      | 1970-01-01T00:00:00.000000046Z |", // in group 2 - seq_num: 3
    //         "| Boston     | sun | 60   | 1970-01-01T00:00:00.000000036Z |", // in group 1 - seq_num: 1  --> will get deleted
    //         "| Boston     | mon |      | 1970-01-01T00:00:00.000000038Z |", // in group 3 - seq_num: 5  --> will get deleted
    //         "| Medford    | sun | 55   | 1970-01-01T00:00:00.000000022Z |", // in group 4 - seq_num: 8  (after the tombstone's seq num)
    //         "| Medford    | wed |      | 1970-01-01T00:00:00.000000026Z |", // in group 2 - seq_num: 4
    //         "| Reading    | mon | 58   | 1970-01-01T00:00:00.000000040Z |", // in group 4 - seq_num: 9
    //         "| Wilmington | mon |      | 1970-01-01T00:00:00.000000035Z |", // in group 3 - seq_num: 6
    //         "+------------+-----+------+--------------------------------+",
    //     ];

    let partition_id = PartitionId::new(1);
    let (mut p1, seq_num) =
        make_first_partition_data(partition_id, loc, sequencer_id, table_id, table_name);

    // Add tombtones
    // Depending on where the existing data is, they (buffer & snapshot) will be either moved to a new sanpshot after
    // appying the tombstone or (persisting) stay where they are and the tomstobes is kept to get applied later
    // ------------------------------------------
    // Delete
    let mut seq_num = seq_num.get();
    seq_num += 1;
    let ts = create_tombstone(
        2,                  // tombstone id
        table_id.get(),     // table id
        sequencer_id.get(), // sequencer id
        seq_num,            // delete's seq_number
        10,                 // min time of data to get deleted
        50,                 // max time of data to get deleted
        "city=Boston",      // delete predicate
    );
    p1.buffer_tombstone(exec, table_name, ts).await;

    // Group 4: in buffer of p1 after the tombstone
    // Fill `buffer`
    seq_num += 1;
    let (_, mb) = mutable_batch_lp::test_helpers::lp_to_mutable_batch(
        r#"test_table,city=Medford day="sun",temp=55 22"#,
    );
    p1.buffer_write(SequenceNumber::new(seq_num), mb).unwrap();
    seq_num += 1;
    let (_, mb) = mutable_batch_lp::test_helpers::lp_to_mutable_batch(
        r#"test_table,city=Reading day="mon",temp=58 40"#,
    );
    p1.buffer_write(SequenceNumber::new(seq_num), mb).unwrap();

    let mut partitions = BTreeMap::new();
    partitions.insert(TEST_PARTITION_1.to_string(), p1);

    partitions
}
/// Make data for one partition with tombstones
Make data for one partition with tombstones
Make data for one partition with tombstones
pub(crate) async fn make_one_partition_with_tombstones(
    exec: &iox_query::exec::Executor,
    loc: DataLocation,
    sequencer_id: SequencerId,
    table_id: TableId,
    table_name: &str,
) -> BTreeMap<String, PartitionData> {
    // In-memory data includes these rows but split between 4 groups go into
    // different batches of parittion 1 or partittion 2  as requeted
    // let expected = vec![
    //         "+------------+-----+------+--------------------------------+",
    //         "| city       | day | temp | time                           |",
    //         "+------------+-----+------+--------------------------------+",
    //         "| Andover    | tue | 56   | 1970-01-01T00:00:00.000000030Z |", // in group 1 - seq_num: 2
    //         "| Andover    | mon |      | 1970-01-01T00:00:00.000000046Z |", // in group 2 - seq_num: 3
    //         "| Boston     | sun | 60   | 1970-01-01T00:00:00.000000036Z |", // in group 1 - seq_num: 1  --> will get deleted
    //         "| Boston     | mon |      | 1970-01-01T00:00:00.000000038Z |", // in group 3 - seq_num: 5  --> will get deleted
    //         "| Medford    | sun | 55   | 1970-01-01T00:00:00.000000022Z |", // in group 4 - seq_num: 8  (after the tombstone's seq num)
    //         "| Medford    | wed |      | 1970-01-01T00:00:00.000000026Z |", // in group 2 - seq_num: 4
    //         "| Reading    | mon | 58   | 1970-01-01T00:00:00.000000040Z |", // in group 4 - seq_num: 9
    //         "| Wilmington | mon |      | 1970-01-01T00:00:00.000000035Z |", // in group 3 - seq_num: 6
    //         "+------------+-----+------+--------------------------------+",
    //     ];
    let partition_id = PartitionId::new(1);
    let (mut p1, seq_num) =
        make_first_partition_data(partition_id, loc, sequencer_id, table_id, table_name);
    // Add tombtones
    // Depending on where the existing data is, they (buffer & snapshot) will be either moved to a new sanpshot after
    // appying the tombstone or (persisting) stay where they are and the tomstobes is kept to get applied later
    // ------------------------------------------
    // Delete
    let mut seq_num = seq_num.get();
    seq_num += 1;
    let ts = create_tombstone(
        2,                  // tombstone id
        table_id.get(),     // table id
        sequencer_id.get(), // sequencer id
        seq_num,            // delete's seq_number
        10,                 // min time of data to get deleted
        50,                 // max time of data to get deleted
        "city=Boston",      // delete predicate
    );
    p1.buffer_tombstone(exec, table_name, ts).await;
    // Group 4: in buffer of p1 after the tombstone
    // Fill `buffer`
    seq_num += 1;
    let (_, mb) = mutable_batch_lp::test_helpers::lp_to_mutable_batch(
        r#"test_table,city=Medford day="sun",temp=55 22"#,
    );
    p1.buffer_write(SequenceNumber::new(seq_num), mb).unwrap();
    seq_num += 1;
    let (_, mb) = mutable_batch_lp::test_helpers::lp_to_mutable_batch(
        r#"test_table,city=Reading day="mon",temp=58 40"#,
    );
    p1.buffer_write(SequenceNumber::new(seq_num), mb).unwrap();
    let mut partitions = BTreeMap::new();
    partitions.insert(TEST_PARTITION_1.to_string(), p1);
    partitions
}
pub ( crate ) async fn make_one_partition_with_tombstones ( exec : & iox_query :: exec :: Executor , loc : DataLocation , sequencer_id : SequencerId , table_id : TableId , table_name : & str , ) -> BTreeMap < String , PartitionData > { // In-memory data includes these rows but split between 4 groups go into // different batches of parittion 1 or partittion 2  as requeted // let expected = vec![ //         "+------------+-----+------+--------------------------------+", //         "| city       | day | temp | time                           |", //         "+------------+-----+------+--------------------------------+", //         "| Andover    | tue | 56   | 1970-01-01T00:00:00.000000030Z |", // in group 1 - seq_num: 2 //         "| Andover    | mon |      | 1970-01-01T00:00:00.000000046Z |", // in group 2 - seq_num: 3 //         "| Boston     | sun | 60   | 1970-01-01T00:00:00.000000036Z |", // in group 1 - seq_num: 1  --> will get deleted //         "| Boston     | mon |      | 1970-01-01T00:00:00.000000038Z |", // in group 3 - seq_num: 5  --> will get deleted //         "| Medford    | sun | 55   | 1970-01-01T00:00:00.000000022Z |", // in group 4 - seq_num: 8  (after the tombstone's seq num) //         "| Medford    | wed |      | 1970-01-01T00:00:00.000000026Z |", // in group 2 - seq_num: 4 //         "| Reading    | mon | 58   | 1970-01-01T00:00:00.000000040Z |", // in group 4 - seq_num: 9 //         "| Wilmington | mon |      | 1970-01-01T00:00:00.000000035Z |", // in group 3 - seq_num: 6 //         "+------------+-----+------+--------------------------------+", //     ]; let partition_id = PartitionId :: new ( 1 ) ; let ( mut p1 , seq_num ) = make_first_partition_data ( partition_id , loc , sequencer_id , table_id , table_name ) ; // Add tombtones // Depending on where the existing data is, they (buffer & snapshot) will be either moved to a new sanpshot after // appying the tombstone or (persisting) stay where they are and the tomstobes is kept to get applied later // ------------------------------------------ // Delete let mut seq_num = seq_num . get ( ) ; seq_num += 1 ; let ts = create_tombstone ( 2 , // tombstone id table_id . get ( ) , // table id sequencer_id . get ( ) , // sequencer id seq_num , // delete's seq_number 10 , // min time of data to get deleted 50 , // max time of data to get deleted " " , // delete predicate ) ; p1 . buffer_tombstone ( exec , table_name , ts ) . await ; // Group 4: in buffer of p1 after the tombstone // Fill `buffer` seq_num += 1 ; let ( _ , mb ) = mutable_batch_lp :: test_helpers :: lp_to_mutable_batch ( r#"test_table,city=Medford day="sun",temp=55 22"# , ) ; p1 . buffer_write ( SequenceNumber :: new ( seq_num ) , mb ) . unwrap ( ) ; seq_num += 1 ; let ( _ , mb ) = mutable_batch_lp :: test_helpers :: lp_to_mutable_batch ( r#"test_table,city=Reading day="mon",temp=58 40"# , ) ; p1 . buffer_write ( SequenceNumber :: new ( seq_num ) , mb ) . unwrap ( ) ; let mut partitions = BTreeMap :: new ( ) ; partitions . insert ( TEST_PARTITION_1 . to_string ( ) , p1 ) ; partitions }
Make data for one partition with tombstones
Make data for one partition with tombstones
exec
&iox_query::exec::Executor
loc
DataLocation
sequencer_id
SequencerId
table_id
TableId
table_name
&str
exec
&iox_query::exec::Executor
loc
DataLocation
sequencer_id
SequencerId
table_id
TableId
table_name
&str