Skip to content

Commit 54db5ef

Browse files
committed
fix: the issue with caching data
1 parent a88356c commit 54db5ef

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/src/querycache.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,17 @@ impl QueryCacheManager {
332332
let time_partition = STREAM_INFO.get_time_partition(table_name)?;
333333
let props = parquet_writer_props(time_partition.clone(), 0, HashMap::new()).build();
334334

335+
let sch = if let Some(record) = records.first() {
336+
record.schema()
337+
} else {
338+
// the record batch is empty, do not cache and return early
339+
return Ok(());
340+
};
341+
342+
335343
let mut arrow_writer = AsyncArrowWriter::try_new(
336344
parquet_file,
337-
STREAM_INFO.schema(table_name).expect("schema present"),
345+
sch,
338346
Some(props),
339347
)?;
340348

0 commit comments

Comments
 (0)