Skip to content

Commit

Permalink
do not use protobuf, use rust type instead
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Dec 26, 2024
1 parent 59c20f0 commit 2d02e3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/frontend/src/handler/create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ use fixedbitset::FixedBitSet;
use itertools::Itertools;
use pgwire::pg_response::{PgResponse, StatementType};
use risingwave_common::catalog::{
CdcTableDesc, ColumnCatalog, ColumnDesc, Engine, FieldLike, TableId, TableVersionId,
DEFAULT_SCHEMA_NAME, INITIAL_TABLE_VERSION_ID, RISINGWAVE_ICEBERG_ROW_ID, ROWID_PREFIX,
CdcTableDesc, ColumnCatalog, ColumnDesc, ConflictBehavior, Engine, FieldLike, TableId,
TableVersionId, DEFAULT_SCHEMA_NAME, INITIAL_TABLE_VERSION_ID, RISINGWAVE_ICEBERG_ROW_ID,
ROWID_PREFIX,
};
use risingwave_common::config::MetaBackend;
use risingwave_common::license::Feature;
Expand All @@ -43,9 +44,7 @@ use risingwave_connector::source::cdc::external::{
};
use risingwave_connector::{source, WithOptionsSecResolved};
use risingwave_pb::catalog::source::OptionalAssociatedTableId;
use risingwave_pb::catalog::{
PbHandleConflictBehavior, PbSource, PbTable, PbWebhookSourceInfo, Table, WatermarkDesc,
};
use risingwave_pb::catalog::{PbSource, PbTable, PbWebhookSourceInfo, Table, WatermarkDesc};
use risingwave_pb::ddl_service::TableJobType;
use risingwave_pb::plan_common::column_desc::GeneratedOrDefaultColumn;
use risingwave_pb::plan_common::{
Expand Down Expand Up @@ -673,13 +672,7 @@ fn gen_table_plan_with_source(
#[derive(Clone, Copy)]
pub enum EitherOnConflict {
Ast(Option<OnConflict>),
Pb(PbHandleConflictBehavior),
}

impl From<PbHandleConflictBehavior> for EitherOnConflict {
fn from(v: PbHandleConflictBehavior) -> Self {
Self::Pb(v)
}
Resolved(ConflictBehavior),
}

impl From<Option<OnConflict>> for EitherOnConflict {
Expand All @@ -688,6 +681,12 @@ impl From<Option<OnConflict>> for EitherOnConflict {
}
}

impl From<ConflictBehavior> for EitherOnConflict {
fn from(v: ConflictBehavior) -> Self {
Self::Resolved(v)
}
}

/// Arguments of the functions that generate a table plan, part 1.
///
/// Compared to [`CreateTableProps`], this struct contains fields that need some work of binding
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/optimizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ impl PlanRoot {
}
}
}
EitherOnConflict::Pb(b) => ConflictBehavior::from_protobuf(&b),
EitherOnConflict::Resolved(b) => b,
};

if let ConflictBehavior::IgnoreConflict = conflict_behavior
Expand Down

0 comments on commit 2d02e3e

Please sign in to comment.