Skip to content

Commit

Permalink
add RecordType::ops method to get Ops corresponding to the record…
Browse files Browse the repository at this point in the history
… type

Signed-off-by: Richard Chien <[email protected]>
  • Loading branch information
stdrc committed Dec 11, 2024
1 parent 753e867 commit 28490e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/common/src/array/stream_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ impl Op {
}
}

pub type Ops<'a> = &'a [Op];

/// `StreamChunk` is used to pass data over the streaming pathway.
#[derive(Clone, PartialEq)]
pub struct StreamChunk {
Expand Down
11 changes: 11 additions & 0 deletions src/common/src/array/stream_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ pub enum RecordType {
Update,
}

impl RecordType {
/// Get the corresponding `Op`s for this record type.
pub fn ops(self) -> &'static [Op] {
match self {
RecordType::Insert => &[Op::Insert],
RecordType::Delete => &[Op::Delete],
RecordType::Update => &[Op::UpdateDelete, Op::UpdateInsert],
}
}
}

/// Generic type to represent a row change.
#[derive(Debug, Clone, Copy)]
pub enum Record<R: Row> {
Expand Down
3 changes: 1 addition & 2 deletions src/stream/src/executor/row_id_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use risingwave_common::array::stream_chunk::Ops;
use risingwave_common::array::{Array, ArrayBuilder, ArrayRef, Op, SerialArrayBuilder};
use risingwave_common::bitmap::Bitmap;
use risingwave_common::hash::VnodeBitmapExt;
Expand Down Expand Up @@ -57,7 +56,7 @@ impl RowIdGenExecutor {
fn gen_row_id_column_by_op(
&mut self,
column: &ArrayRef,
ops: Ops<'_>,
ops: &'_ [Op],
vis: &Bitmap,
) -> ArrayRef {
let len = column.len();
Expand Down

0 comments on commit 28490e4

Please sign in to comment.