mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-07 05:42:57 +00:00
feat: fix panic in TimeSeriesParquetReader
This commit is contained in:
@@ -243,32 +243,35 @@ impl TimeSeriesParquetReader {
|
||||
|
||||
if let Some(array) = &self.array {
|
||||
if self.row_index >= array.len() {
|
||||
let Some(record_batch) = self
|
||||
.stream
|
||||
.next()
|
||||
.await
|
||||
.transpose()
|
||||
.context(ReadParquetSnafu { path: &self.path })
|
||||
.context(MitoSnafu)?
|
||||
else {
|
||||
self.eof = true;
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
self.row_index = 0;
|
||||
self.array = Some(
|
||||
record_batch
|
||||
.column(0)
|
||||
.as_any()
|
||||
.downcast_ref::<StringArray>()
|
||||
.context(MissingColumnSnafu {
|
||||
column_name: "remote write json column",
|
||||
})?
|
||||
.clone(),
|
||||
);
|
||||
self.array = None;
|
||||
}
|
||||
}
|
||||
|
||||
if self.array.is_none() {
|
||||
let Some(record_batch) = self
|
||||
.stream
|
||||
.next()
|
||||
.await
|
||||
.transpose()
|
||||
.context(ReadParquetSnafu { path: &self.path })
|
||||
.context(MitoSnafu)?
|
||||
else {
|
||||
self.eof = true;
|
||||
return Ok(None);
|
||||
};
|
||||
self.array = Some(
|
||||
record_batch
|
||||
.column(0)
|
||||
.as_any()
|
||||
.downcast_ref::<StringArray>()
|
||||
.context(MissingColumnSnafu {
|
||||
column_name: "remote write json column",
|
||||
})?
|
||||
.clone(),
|
||||
);
|
||||
}
|
||||
|
||||
let array = self.array.as_ref().unwrap();
|
||||
let value = array.value(self.row_index);
|
||||
let time_series = serde_json::from_str(value).context(JsonSnafu)?;
|
||||
|
||||
Reference in New Issue
Block a user