jecsand838 commented on code in PR #8402:
URL: https://github.com/apache/arrow-rs/pull/8402#discussion_r2370382713


##########
arrow-avro/src/reader/mod.rs:
##########
@@ -128,47 +136,311 @@
 //! }
 //! ```
 //!
-//! ### Building a `Decoder` for **single‑object encoding** (Rabin 
fingerprints)
+//! ### Building and using a `Decoder` for **single‑object encoding** (Rabin 
fingerprints)
+//!
+//! The doctest below constructs a single‑object frame for a simple writer 
schema
+//! (`{"type":"record","name":"User","fields":[{"name":"id","type":"long"}]}`) 
and then
+//! decodes it into a `RecordBatch`. The Avro body encodes the long value `42` 
using
+//! standard zig‑zag varint encoding.
 //!
-//! ```no_run
-//! use arrow_avro::schema::{AvroSchema, SchemaStore};
+//! ```
+//! use arrow_avro::schema::{AvroSchema, SchemaStore, Fingerprint, 
SINGLE_OBJECT_MAGIC};
 //! use arrow_avro::reader::ReaderBuilder;
 //!
-//! // Build a SchemaStore and register known writer schemas
-//! let mut store = SchemaStore::new(); // Rabin by default
-//! let user_schema = 
AvroSchema::new(r#"{"type":"record","name":"User","fields":[
-//!     
{"name":"id","type":"long"},{"name":"name","type":"string"}]}"#.to_string());
-//! let _fp = store.register(user_schema).unwrap(); // computes Rabin 
CRC-64-AVRO
-//!
-//! // Build a Decoder that expects single-object encoding (0xC3 0x01 + 
fingerprint and body)
-//! let decoder = ReaderBuilder::new()
-//!     .with_writer_schema_store(store)
-//!     .with_batch_size(1024)
-//!     .build_decoder()
-//!     .unwrap();
-//! // Feed decoder with framed bytes (not shown; see `decode_stream` above).
+//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
+//! // Register the writer schema (Rabin fingerprint by default).
+//! let mut store = SchemaStore::new();
+//! let avro_schema = 
AvroSchema::new(r#"{"type":"record","name":"User","fields":[
+//!   {"name":"id","type":"long"}]}"#.to_string());
+//! let fp = store.register(avro_schema)?;
+//!
+//! // Minimal Avro long encoder (zig-zag + varint).

Review Comment:
   Absolutely. I made sure to hide the input `body` code as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to