(
scx: &StatementContext,
format: &Format<Aug>,
)
| 2313 | } |
| 2314 | |
| 2315 | fn get_encoding_inner( |
| 2316 | scx: &StatementContext, |
| 2317 | format: &Format<Aug>, |
| 2318 | ) -> Result<SourceDataEncoding<ReferencedConnection>, PlanError> { |
| 2319 | let value = match format { |
| 2320 | Format::Bytes => DataEncoding::Bytes, |
| 2321 | Format::Avro(schema) => { |
| 2322 | let Schema { |
| 2323 | key_schema, |
| 2324 | value_schema, |
| 2325 | key_reference_schemas, |
| 2326 | value_reference_schemas, |
| 2327 | wire_format, |
| 2328 | } = match schema { |
| 2329 | // TODO(jldlaughlin): we need a way to pass in primary key information |
| 2330 | // when building a source from a string or file. |
| 2331 | AvroSchema::InlineSchema { |
| 2332 | schema: ast::Schema { schema }, |
| 2333 | with_options, |
| 2334 | } => { |
| 2335 | let AvroSchemaOptionExtracted { |
| 2336 | confluent_wire_format, |
| 2337 | .. |
| 2338 | } = with_options.clone().try_into()?; |
| 2339 | let wire_format = if confluent_wire_format { |
| 2340 | WireFormat::Confluent { registry: None } |
| 2341 | } else { |
| 2342 | WireFormat::None |
| 2343 | }; |
| 2344 | Schema { |
| 2345 | key_schema: None, |
| 2346 | value_schema: schema.clone(), |
| 2347 | key_reference_schemas: vec![], |
| 2348 | value_reference_schemas: vec![], |
| 2349 | wire_format, |
| 2350 | } |
| 2351 | } |
| 2352 | AvroSchema::Csr { |
| 2353 | csr_connection: |
| 2354 | CsrConnectionAvro { |
| 2355 | connection, |
| 2356 | seed, |
| 2357 | key_strategy: _, |
| 2358 | value_strategy: _, |
| 2359 | }, |
| 2360 | } => { |
| 2361 | let item = scx.get_item_by_resolved_name(&connection.connection)?; |
| 2362 | let csr_connection = match item.connection()? { |
| 2363 | Connection::Csr(_) => item.id(), |
| 2364 | _ => { |
| 2365 | sql_bail!( |
| 2366 | "{} is not a Confluent Schema Registry connection", |
| 2367 | scx.catalog |
| 2368 | .resolve_full_name(item.name()) |
| 2369 | .to_string() |
| 2370 | .quoted() |
| 2371 | ) |
| 2372 | } |
no test coverage detected