@@ -23,6 +23,7 @@ use std::fmt::Debug;
2323use std:: io:: { BufReader , Read } ;
2424use std:: sync:: Arc ;
2525
26+ pub use crate :: recovery:: RawJsonOptions ;
2627use crate :: recovery:: { JsonRecordHandler , JsonRecordHandlerFactory } ;
2728use crate :: source:: JsonSource ;
2829
@@ -153,6 +154,7 @@ impl Debug for JsonFormatFactory {
153154pub struct JsonFormat {
154155 options : JsonOptions ,
155156 raw_records : bool ,
157+ raw_options : RawJsonOptions ,
156158 record_handler : Option < Arc < dyn JsonRecordHandler > > ,
157159 record_handler_factory : Option < Arc < dyn JsonRecordHandlerFactory > > ,
158160}
@@ -215,6 +217,12 @@ impl JsonFormat {
215217 self
216218 }
217219
220+ /// Configure byte-level handling for opt-in raw records.
221+ pub fn with_raw_record_options ( mut self , options : RawJsonOptions ) -> Self {
222+ self . raw_options = options;
223+ self
224+ }
225+
218226 /// Observe raw NDJSON records with one shared handler. Requires `with_raw_records(true)`.
219227 pub fn with_record_handler ( mut self , handler : Arc < dyn JsonRecordHandler > ) -> Self {
220228 self . record_handler = Some ( handler) ;
@@ -409,7 +417,8 @@ impl FileFormat for JsonFormat {
409417 fn file_source ( & self , table_schema : TableSchema ) -> Arc < dyn FileSource > {
410418 let mut source = JsonSource :: new ( table_schema)
411419 . with_newline_delimited ( self . options . newline_delimited )
412- . with_raw_records ( self . raw_records ) ;
420+ . with_raw_records ( self . raw_records )
421+ . with_raw_record_options ( self . raw_options ) ;
413422 if let Some ( handler) = & self . record_handler {
414423 source = source. with_record_handler ( Arc :: clone ( handler) ) ;
415424 } else if let Some ( factory) = & self . record_handler_factory {
0 commit comments