MCPcopy Create free account
hub / github.com/apache/arrow-rs / decode_with_resolution

Method decode_with_resolution

arrow-avro/src/reader/record.rs:1436–1473  ·  view source on GitHub ↗
(
        &'d mut self,
        buf: &mut AvroCursor<'_>,
        resolution: &'d ResolutionPlan,
    )

Source from the content-addressed store, hash-verified

1434 }
1435
1436 fn decode_with_resolution<'d>(
1437 &'d mut self,
1438 buf: &mut AvroCursor<'_>,
1439 resolution: &'d ResolutionPlan,
1440 ) -> Result<(), AvroError> {
1441 #[cfg(feature = "avro_custom_types")]
1442 if let Self::RunEndEncoded(_, len, inner) = self {
1443 *len += 1;
1444 return inner.decode_with_resolution(buf, resolution);
1445 }
1446
1447 match resolution {
1448 ResolutionPlan::Promotion(promotion) => {
1449 let promotion = *promotion;
1450 self.decode_with_promotion(buf, promotion)
1451 }
1452 ResolutionPlan::DefaultValue(lit) => self.append_default(lit),
1453 ResolutionPlan::EnumMapping(res) => {
1454 let Self::Enum(indices, _, _) = self else {
1455 return Err(AvroError::SchemaError(
1456 "enum mapping resolution provided for non-enum decoder".into(),
1457 ));
1458 };
1459 let raw = buf.get_int()?;
1460 let resolved = res.resolve(raw)?;
1461 indices.push(resolved);
1462 Ok(())
1463 }
1464 ResolutionPlan::Record(proj) => {
1465 let Self::Record(_, encodings, _, _) = self else {
1466 return Err(AvroError::SchemaError(
1467 "record projection provided for non-record decoder".into(),
1468 ));
1469 };
1470 proj.project_record(buf, encodings)
1471 }
1472 }
1473 }
1474
1475 /// Flush decoded records to an [`ArrayRef`]
1476 fn flush(&mut self, nulls: Option<NullBuffer>) -> Result<ArrayRef, AvroError> {

Callers 1

decodeMethod · 0.80

Calls 6

decode_with_promotionMethod · 0.80
append_defaultMethod · 0.80
get_intMethod · 0.80
project_recordMethod · 0.80
resolveMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected