From 5d6e0f2e9ad72851aea0cb339907aa27815716b4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:07:09 +0800 Subject: [PATCH] fix(connector): improve mysql error message (#20135) (#20143) Co-authored-by: Noel Kwan <47273164+kwannoel@users.noreply.github.com> --- src/connector/src/parser/mysql.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/connector/src/parser/mysql.rs b/src/connector/src/parser/mysql.rs index 8be9f736281c9..fbe2b7306ef99 100644 --- a/src/connector/src/parser/mysql.rs +++ b/src/connector/src/parser/mysql.rs @@ -32,8 +32,8 @@ use risingwave_common::types::{ use rust_decimal::Decimal as RustDecimal; macro_rules! handle_data_type { - ($row:expr, $i:expr, $name:expr, $type:ty) => {{ - match $row.take_opt::, _>($i) { + ($row:expr, $i:expr, $name:expr, $typ:ty) => {{ + match $row.take_opt::, _>($i) { None => bail!("no value found at column: {}, index: {}", $name, $i), Some(Ok(val)) => Ok(val.map(|v| ScalarImpl::from(v))), Some(Err(e)) => Err(anyhow::Error::new(e.clone()) @@ -42,21 +42,21 @@ macro_rules! handle_data_type { "column: {}, index: {}, rust_type: {}", $name, $i, - stringify!($type), + stringify!($typ), ))), } }}; - ($row:expr, $i:expr, $name:expr, $type:ty, $rw_type:ty) => {{ - match $row.take_opt::, _>($i) { + ($row:expr, $i:expr, $name:expr, $typ:ty, $rw_type:ty) => {{ + match $row.take_opt::, _>($i) { None => bail!("no value found at column: {}, index: {}", $name, $i), Some(Ok(val)) => Ok(val.map(|v| ScalarImpl::from(<$rw_type>::from(v)))), Some(Err(e)) => Err(anyhow::Error::new(e.clone()) - .context("failed to deserialize MySQL value into rust value") + .context("failed to deserialize MySQL value into rw value") .context(format!( - "column: {}, index: {}, rust_type: {}", + "column: {}, index: {}, rw_type: {}", $name, $i, - stringify!($ty), + stringify!($rw_type), ))), } }};