mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-06-02 05:10:40 +00:00
fix: panic and interval when do not have keyword interval (#5339)
* fix: panic and interval when do not have keyword Signed-off-by: yihong0618 <zouzou0208@gmail.com> * fix: wrong pos... Signed-off-by: yihong0618 <zouzou0208@gmail.com> * fix: address comments drop the unreachable Signed-off-by: yihong0618 <zouzou0208@gmail.com> * fix: address comments and add sqlness tests Signed-off-by: yihong0618 <zouzou0208@gmail.com> --------- Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
@@ -132,6 +132,12 @@ pub enum Error {
|
||||
#[snafu(implicit)]
|
||||
location: Location,
|
||||
},
|
||||
#[snafu(display("ConcreteDataType not supported yet: {:?}", t))]
|
||||
ConcreteTypeNotSupported {
|
||||
t: ConcreteDataType,
|
||||
#[snafu(implicit)]
|
||||
location: Location,
|
||||
},
|
||||
|
||||
#[snafu(display("Failed to parse value: {}", msg))]
|
||||
ParseSqlValue {
|
||||
@@ -355,6 +361,7 @@ impl ErrorExt for Error {
|
||||
| InvalidSql { .. }
|
||||
| ParseSqlValue { .. }
|
||||
| SqlTypeNotSupported { .. }
|
||||
| ConcreteTypeNotSupported { .. }
|
||||
| UnexpectedToken { .. }
|
||||
| InvalidDefault { .. } => StatusCode::InvalidSyntax,
|
||||
|
||||
|
||||
@@ -136,9 +136,10 @@ fn parse_string_to_value(
|
||||
let v = parse_string_to_vector_type_value(&s, Some(d.dim)).context(DatatypeSnafu)?;
|
||||
Ok(Value::Binary(v.into()))
|
||||
}
|
||||
_ => {
|
||||
unreachable!()
|
||||
_ => ParseSqlValueSnafu {
|
||||
msg: format!("Failed to parse {s} to {data_type} value"),
|
||||
}
|
||||
.fail(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +431,13 @@ fn parse_column_default_constraint(
|
||||
}
|
||||
.fail();
|
||||
}
|
||||
_ => unreachable!(),
|
||||
_ => {
|
||||
return UnsupportedDefaultValueSnafu {
|
||||
column_name,
|
||||
expr: Expr::Value(SqlValue::Null),
|
||||
}
|
||||
.fail();
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Some(default_constraint))
|
||||
@@ -680,9 +687,10 @@ pub fn concrete_data_type_to_sql_data_type(data_type: &ConcreteDataType) -> Resu
|
||||
ConcreteDataType::Duration(_)
|
||||
| ConcreteDataType::Null(_)
|
||||
| ConcreteDataType::List(_)
|
||||
| ConcreteDataType::Dictionary(_) => {
|
||||
unreachable!()
|
||||
| ConcreteDataType::Dictionary(_) => error::ConcreteTypeNotSupportedSnafu {
|
||||
t: data_type.clone(),
|
||||
}
|
||||
.fail(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user