Skip to content

chore: handle error returned from resolve_data_source() #14076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/query/sharing/src/share_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,13 @@ impl ShareEndpointManager {
match resp {
Ok(resp) => {
let bs = resp.into_body().bytes().await?;
let table_info_map: TableInfoMap = serde_json::from_slice(&bs)?;

Ok(table_info_map)
match serde_json::from_slice(&bs) {
Ok(table_info_map) => Ok(table_info_map),
Err(e) => Err(ErrorCode::UnknownShareTable(format!(
"Fail to get TableInfoMap from share {:?}: {:?}",
share_name, e
))),
}
}
Err(err) => Err(err.into()),
}
Expand Down
13 changes: 8 additions & 5 deletions src/query/sql/src/planner/binder/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Binder {
.await
{
Ok(table) => table,
Err(_) => {
Err(e) => {
let mut parent = bind_context.parent.as_mut();
loop {
if parent.is_none() {
Expand All @@ -260,10 +260,13 @@ impl Binder {
}
parent = bind_context.parent.as_mut();
}
return Err(ErrorCode::UnknownTable(format!(
"Unknown table `{database}`.`{table_name}` in catalog '{catalog}'"
))
.set_span(*span));
if e.code() == 1025 {
return Err(ErrorCode::UnknownTable(format!(
"Unknown table `{database}`.`{table_name}` in catalog '{catalog}'"
))
.set_span(*span));
}
return Err(e);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ drop shared database and query data from share
4
5
6
ERROR 1105 (HY000) at line 1: UnknownTable. Code: 1025, Text = error:
--> SQL:1:15
|
1 | SELECT * FROM shared_db.t2
| ^^^^^^^^^^^^ Unknown table `shared_db`.`t2` in catalog 'default'

.
ERROR 1105 (HY000) at line 1: UnknownTable. Code: 1025, Text = error:
--> SQL:1:15
|
1 | SELECT * FROM shared_db.t2
| ^^^^^^^^^^^^ Unknown table `shared_db`.`t2` in catalog 'default'

.
ERROR 1105 (HY000) at line 1: UnknownShareTable. Code: 2717, Text = Fail to get TableInfoMap from share "test_share": Error("expected value", line: 1, column: 1).
ERROR 1105 (HY000) at line 1: UnknownShareTable. Code: 2717, Text = Fail to get TableInfoMap from share "test_share": Error("expected value", line: 1, column: 1).
all is good