mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-05 21:02:58 +00:00
fix: expose unsupported datatype error on mysql protocol (#3121)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -38,6 +38,12 @@ pub enum Error {
|
||||
#[snafu(display("Internal error: {}", err_msg))]
|
||||
Internal { err_msg: String },
|
||||
|
||||
#[snafu(display("Unsupported data type: {}, reason: {}", data_type, reason))]
|
||||
UnsupportedDataType {
|
||||
data_type: ConcreteDataType,
|
||||
reason: String,
|
||||
},
|
||||
|
||||
#[snafu(display("Internal IO error"))]
|
||||
InternalIo {
|
||||
#[snafu(source)]
|
||||
@@ -446,6 +452,8 @@ impl ErrorExt for Error {
|
||||
| GrpcReflectionService { .. }
|
||||
| BuildHttpResponse { .. } => StatusCode::Internal,
|
||||
|
||||
UnsupportedDataType { .. } => StatusCode::Unsupported,
|
||||
|
||||
#[cfg(not(windows))]
|
||||
UpdateJemallocMetrics { .. } => StatusCode::Internal,
|
||||
|
||||
|
||||
@@ -265,8 +265,9 @@ pub(crate) fn create_mysql_column(
|
||||
ConcreteDataType::Interval(_) => Ok(ColumnType::MYSQL_TYPE_VARCHAR),
|
||||
ConcreteDataType::Duration(_) => Ok(ColumnType::MYSQL_TYPE_TIME),
|
||||
ConcreteDataType::Decimal128(_) => Ok(ColumnType::MYSQL_TYPE_DECIMAL),
|
||||
_ => error::InternalSnafu {
|
||||
err_msg: format!("not implemented for column datatype {:?}", data_type),
|
||||
_ => error::UnsupportedDataTypeSnafu {
|
||||
data_type,
|
||||
reason: "not implemented",
|
||||
}
|
||||
.fail(),
|
||||
};
|
||||
|
||||
@@ -135,8 +135,9 @@ pub(super) fn type_gt_to_pg(origin: &ConcreteDataType) -> Result<Type> {
|
||||
&ConcreteDataType::Decimal128(_) => Ok(Type::NUMERIC),
|
||||
&ConcreteDataType::Duration(_)
|
||||
| &ConcreteDataType::List(_)
|
||||
| &ConcreteDataType::Dictionary(_) => error::InternalSnafu {
|
||||
err_msg: format!("not implemented for column datatype {origin:?}"),
|
||||
| &ConcreteDataType::Dictionary(_) => error::UnsupportedDataTypeSnafu {
|
||||
data_type: origin,
|
||||
reason: "not implemented",
|
||||
}
|
||||
.fail(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user