@@ -273,155 +273,51 @@ impl<T: Store + Send + Sync + 'static> KafkaConsumer<T> {
273273 Err ( "Binary input format with precompute not implemented" . into ( ) )
274274 }
275275 InputFormat :: Json => {
276- // Handle streaming engine specific logic
277- match self . config . streaming_engine {
278- StreamingEngine :: Flink => {
279- // debug!("Received message of length: {}", payload.len());
280-
281- // let json_data = if self.config.decompress_json {
282- // // Decompress using gzip
283- // let mut decoder = GzDecoder::new(payload);
284- // let mut decompressed = Vec::new();
285- // match decoder.read_to_end(&mut decompressed) {
286- // Ok(_) => {
287- // debug!(
288- // "Decompressed JSON message of length: {}",
289- // decompressed.len()
290- // );
291- // decompressed
292- // }
293- // Err(e) => {
294- // error!("Error decompressing gzip data: {}", e);
295- // return Err(format!("Gzip decompression error: {e}").into());
296- // }
297- // }
298- // } else {
299- // payload.to_vec()
300- // };
301-
302- // let json_str = match String::from_utf8(json_data) {
303- // Ok(s) => s,
304- // Err(e) => {
305- // error!("Error converting bytes to UTF-8: {}", e);
306- // return Err(format!("UTF-8 conversion error: {e}").into());
307- // }
308- // };
309-
310- // let json_parse_start_time = Instant::now();
311-
312- // let json_dict: serde_json::Value = match serde_json::from_str(&json_str) {
313- // Ok(dict) => {
314- // let json_parse_duration = json_parse_start_time.elapsed();
315- // debug!(
316- // "JSON parsing took: {:.2}ms",
317- // json_parse_duration.as_secs_f64() * 1000.0
318- // );
319- // dict
320- // }
321- // Err(e) => {
322- // error!("Error parsing JSON: {}", e);
323- // debug!("JSON content: {}", json_str);
324- // return Err(format!("JSON parsing error: {e}").into());
325- // }
326- // };
327-
328- // debug!(
329- // "Deserializing JSON message: {}, {}, {}",
330- // json_dict
331- // .get("aggregation_id")
332- // .and_then(|v| v.as_u64())
333- // .unwrap_or(0),
334- // json_dict
335- // .get("start_timestamp")
336- // .and_then(|v| v.as_u64())
337- // .unwrap_or(0),
338- // json_dict
339- // .get("end_timestamp")
340- // .and_then(|v| v.as_u64())
341- // .unwrap_or(0)
342- // );
343-
344- // let deserialize_start_time = Instant::now();
345-
346- // match PrecomputedOutput::deserialize_from_json_with_precompute(&json_dict) {
347- // Ok((output, precompute)) => {
348- // let deserialize_duration = deserialize_start_time.elapsed();
349- // debug!(
350- // "Deserialization took: {:.2}ms",
351- // deserialize_duration.as_secs_f64() * 1000.0
352- // );
353- // debug!(
354- // "Deserialized item: {}, {}, {}",
355- // output.config.aggregation_id,
356- // output.start_timestamp,
357- // output.end_timestamp
358- // );
359- // debug!("Successfully deserialized Flink JSON message with precompute data");
360- // let total_message_duration = message_start_time.elapsed();
361- // debug!(
362- // "Total message processing took: {:.2}ms",
363- // total_message_duration.as_secs_f64() * 1000.0
364- // );
365- // Ok(Some((output, precompute)))
366- // }
367- // Err(e) => {
368- // error!(
369- // "Error deserializing Flink PrecomputedOutput from JSON with precompute: {}",
370- // e
371- // );
372- // debug!("JSON content: {}", json_str);
373- // Err(e)
374- // }
375- // }
376- error ! ( "Flink input format with precompute not implemented" ) ;
377- Err ( "Flink input format with precompute not implemented" . into ( ) )
276+ // Arroyo messages - gzip decompression is applied at precompute level, not message level
277+ let json_str = match String :: from_utf8 ( payload. to_vec ( ) ) {
278+ Ok ( s) => s,
279+ Err ( e) => {
280+ error ! ( "Error converting bytes to UTF-8: {}" , e) ;
281+ return Err ( format ! ( "UTF-8 conversion error: {e}" ) . into ( ) ) ;
378282 }
379- StreamingEngine :: Arroyo => {
380- // Arroyo messages - gzip decompression is applied at precompute level, not message level
381- let json_str = match String :: from_utf8 ( payload. to_vec ( ) ) {
382- Ok ( s) => s,
383- Err ( e) => {
384- error ! ( "Error converting bytes to UTF-8: {}" , e) ;
385- return Err ( format ! ( "UTF-8 conversion error: {e}" ) . into ( ) ) ;
386- }
387- } ;
388-
389- let json_dict: serde_json:: Value = match serde_json:: from_str ( & json_str) {
390- Ok ( dict) => dict,
391- Err ( e) => {
392- error ! ( "Error parsing Arroyo JSON: {}" , e) ;
393- debug ! ( "JSON content: {}" , json_str) ;
394- return Err ( format ! ( "JSON parsing error: {e}" ) . into ( ) ) ;
395- }
396- } ;
283+ } ;
397284
398- let deserialize_start_time = Instant :: now ( ) ;
399- match PrecomputedOutput :: deserialize_from_json_arroyo (
400- & json_dict,
401- & self . streaming_config ,
402- ) {
403- Ok ( ( output, precompute) ) => {
404- let deserialize_duration = deserialize_start_time. elapsed ( ) ;
405- debug ! (
406- "Arroyo deserialization took: {:.2}ms" ,
407- deserialize_duration. as_secs_f64( ) * 1000.0
408- ) ;
409- debug ! ( "Successfully deserialized Arroyo JSON message with precompute data" ) ;
410- let total_message_duration = message_start_time. elapsed ( ) ;
411- debug ! (
412- "Total Arroyo message processing took: {:.2}ms" ,
413- total_message_duration. as_secs_f64( ) * 1000.0
414- ) ;
415- Ok ( Some ( ( output, precompute) ) )
416- }
417- Err ( e) => {
418- error ! (
419- "Error deserializing Arroyo PrecomputedOutput from JSON with precompute: {e}"
420- ) ;
421- debug ! ( "JSON content: {}" , json_str) ;
422- Err ( e)
423- }
424- }
285+ let json_dict: serde_json:: Value = match serde_json:: from_str ( & json_str) {
286+ Ok ( dict) => dict,
287+ Err ( e) => {
288+ error ! ( "Error parsing Arroyo JSON: {}" , e) ;
289+ debug ! ( "JSON content: {}" , json_str) ;
290+ return Err ( format ! ( "JSON parsing error: {e}" ) . into ( ) ) ;
291+ }
292+ } ;
293+
294+ let deserialize_start_time = Instant :: now ( ) ;
295+ match PrecomputedOutput :: deserialize_from_json_arroyo (
296+ & json_dict,
297+ & self . streaming_config ,
298+ ) {
299+ Ok ( ( output, precompute) ) => {
300+ let deserialize_duration = deserialize_start_time. elapsed ( ) ;
301+ debug ! (
302+ "Arroyo deserialization took: {:.2}ms" ,
303+ deserialize_duration. as_secs_f64( ) * 1000.0
304+ ) ;
305+ debug ! (
306+ "Successfully deserialized Arroyo JSON message with precompute data"
307+ ) ;
308+ let total_message_duration = message_start_time. elapsed ( ) ;
309+ debug ! (
310+ "Total Arroyo message processing took: {:.2}ms" ,
311+ total_message_duration. as_secs_f64( ) * 1000.0
312+ ) ;
313+ Ok ( Some ( ( output, precompute) ) )
314+ }
315+ Err ( e) => {
316+ error ! (
317+ "Error deserializing Arroyo PrecomputedOutput from JSON with precompute: {e}"
318+ ) ;
319+ debug ! ( "JSON content: {}" , json_str) ;
320+ Err ( e)
425321 }
426322 }
427323 }
0 commit comments