fix: convert timestamp unit too

This commit is contained in:
discord9
2025-03-13 16:30:03 +08:00
parent f04f16cec3
commit 9fcb0874e2
2 changed files with 17 additions and 2 deletions

View File

@@ -591,7 +591,22 @@ fn eval_ts_to_ts(
df_schema: &DFSchema,
input_value: Timestamp,
) -> Result<Timestamp, Error> {
let ts_vector = match input_value.unit() {
let schema_ty = df_schema.field(0).data_type();
let schema_cdt = ConcreteDataType::from_arrow_type(schema_ty);
let schema_unit = if let ConcreteDataType::Timestamp(ts) = schema_cdt {
ts.unit()
} else {
return UnexpectedSnafu {
reason: format!("Expect Timestamp, found {:?}", schema_cdt),
}
.fail();
};
let input_value = input_value
.convert_to(schema_unit)
.with_context(|| UnexpectedSnafu {
reason: format!("Failed to convert timestamp {input_value:?} to {schema_unit}"),
})?;
let ts_vector = match schema_unit {
TimeUnit::Second => {
TimestampSecondVector::from_vec(vec![input_value.value()]).to_arrow_array()
}

View File

@@ -447,7 +447,7 @@ impl RecordingRuleTask {
.gen_filter_exprs(&col_name, Some(l), window_size, self)?
}
_ => {
warn!(
debug!(
"Flow id = {:?}, can't get window size: precise_lower_bound={expire_time_window_bound:?}, using the same query", self.flow_id
);
// since no time window lower/upper bound is found, just return the original query