(
scx: &StatementContext,
stmt: CreateSinkStatement<Aug>,
)
| 3191 | ); |
| 3192 | |
| 3193 | pub fn plan_create_sink( |
| 3194 | scx: &StatementContext, |
| 3195 | stmt: CreateSinkStatement<Aug>, |
| 3196 | ) -> Result<Plan, PlanError> { |
| 3197 | // Check for an object in the catalog with this same name |
| 3198 | let Some(name) = stmt.name.clone() else { |
| 3199 | return Err(PlanError::MissingName(CatalogItemType::Sink)); |
| 3200 | }; |
| 3201 | let name = scx.allocate_qualified_name(normalize::unresolved_item_name(name)?)?; |
| 3202 | let full_name = scx.catalog.resolve_full_name(&name); |
| 3203 | let partial_name = PartialItemName::from(full_name.clone()); |
| 3204 | if let (false, Ok(item)) = (stmt.if_not_exists, scx.catalog.resolve_item(&partial_name)) { |
| 3205 | return Err(PlanError::ItemAlreadyExists { |
| 3206 | name: full_name.to_string(), |
| 3207 | item_type: item.item_type(), |
| 3208 | }); |
| 3209 | } |
| 3210 | |
| 3211 | plan_sink(scx, stmt) |
| 3212 | } |
| 3213 | |
| 3214 | /// This function will plan a sink as if it does not exist in the catalog. This is so the planning |
| 3215 | /// logic is reused by both CREATE SINK and ALTER SINK planning. It is the responsibility of the |
no test coverage detected