Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KeXiangWang committed Aug 19, 2024
1 parent 019e288 commit 7a2db04
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/connector/src/source/cdc/external/sql_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl SqlServerExternalTable {
column_descs.push(ColumnDesc::named(
col_name,
ColumnId::placeholder(),
type_to_rw_type(col_type)?,
type_to_rw_type(col_type, col_name)?,
));
}
}
Expand Down Expand Up @@ -171,7 +171,7 @@ impl SqlServerExternalTable {
}
}

fn type_to_rw_type(col_type: &str) -> ConnectorResult<DataType> {
fn type_to_rw_type(col_type: &str, col_name: &str) -> ConnectorResult<DataType> {
let dtype = match col_type.to_lowercase().as_str() {
"bit" => DataType::Boolean,
"binary" | "varbinary" => DataType::Bytea,
Expand All @@ -188,14 +188,10 @@ fn type_to_rw_type(col_type: &str) -> ConnectorResult<DataType> {
"char" | "nchar" | "varchar" | "nvarchar" | "text" | "ntext" | "xml"
| "uniqueidentifier" => DataType::Varchar,
mssql_type => {
// NOTES: user-defined enum type is classified as `Unknown`
tracing::warn!(
"Unknown Sql Server data type: {:?}, map to varchar",
mssql_type
);
return Err(anyhow!(
"Unknown Sql Server data type: {:?}, map to varchar",
mssql_type
"Unsupported Sql Server data type: {:?}, column name: {}",
mssql_type,
col_name
)
.into());
}
Expand Down

0 comments on commit 7a2db04

Please sign in to comment.