Skip to content

Commit

Permalink
fix(query): fix variant function with invalid jsonb panic (databendla…
Browse files Browse the repository at this point in the history
  • Loading branch information
b41sh authored Jan 30, 2024
1 parent 2c474ce commit d2a0aee
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ members = [

[workspace.dependencies]
# databend maintains
jsonb = { git = "https://github.com/datafuselabs/jsonb", rev = "e21b273" }
jsonb = { git = "https://github.com/datafuselabs/jsonb", rev = "0247ffc" }

opendal = { version = "0.44.2", features = [
"layers-minitrace",
Expand Down
1 change: 0 additions & 1 deletion src/query/formats/src/field_decoder/fast_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ impl FastFieldDecoderValues {
}
Err(_) => {
if self.common_settings().disable_variant_check {
column.put_slice(&buf);
column.commit_row();
} else {
return Err(ErrorCode::BadBytes(format!(
Expand Down
1 change: 0 additions & 1 deletion src/query/formats/src/field_decoder/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ impl NestedValues {
}
Err(e) => {
if self.common_settings().disable_variant_check {
column.put_slice(&buf);
column.commit_row();
} else {
return Err(ErrorCode::BadBytes(e.to_string()));
Expand Down
1 change: 0 additions & 1 deletion src/query/formats/src/field_decoder/separated_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ impl SeparatedTextDecoder {
}
Err(e) => {
if self.common_settings().disable_variant_check {
column.put_slice(data);
column.commit_row();
} else {
return Err(ErrorCode::BadBytes(e.to_string()));
Expand Down
4 changes: 2 additions & 2 deletions src/query/functions/src/scalars/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn register(registry: &mut FunctionRegistry) {
}
Err(err) => {
if ctx.func_ctx.disable_variant_check {
output.put_str(&val);
output.put_str("");
} else {
ctx.set_error(output.len(), err.to_string());
}
Expand All @@ -147,7 +147,7 @@ pub fn register(registry: &mut FunctionRegistry) {
}
Err(err) => {
if ctx.func_ctx.disable_variant_check {
output.put_str(s);
output.put_str("");
} else {
ctx.set_error(output.len(), err.to_string());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ csv/invalid_variant.csv 2 0 NULL NULL
query IT
select * from iv
----
1 invalidvariant
1 null
2 {"k":"v"}

statement ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ select * from t2 order by a
3 [1,2,3]
4 ["a","b"]
5 {"k":"v"}
6 [1,
6 null

0 comments on commit d2a0aee

Please sign in to comment.