Skip to content

Commit

Permalink
chore(deps): Bump apache-avro to 0.16.0 (#13523)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangjinwu authored Nov 20, 2023
1 parent a126c05 commit 8e5477a
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 79 deletions.
142 changes: 93 additions & 49 deletions Cargo.lock

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

Binary file modified scripts/source/test_data/avro_bin.1
Binary file not shown.
2 changes: 1 addition & 1 deletion src/connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ normal = ["workspace-hack"]

[dependencies]
anyhow = "1"
apache-avro = { git = "https://github.com/risingwavelabs/avro", rev = "3c257c1f65e63a80ac44f1cffaf083cdaeab431a", features = [
apache-avro = { git = "https://github.com/risingwavelabs/avro", rev = "b251943586e7fe7dd52319fc84f8be47921434aa", features = [
"snappy",
"zstandard",
"bzip",
Expand Down
17 changes: 11 additions & 6 deletions src/connector/src/parser/avro/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ mod test {
use std::ops::Sub;
use std::path::PathBuf;

use apache_avro::schema::RecordSchema;
use apache_avro::types::{Record, Value};
use apache_avro::{Codec, Days, Duration, Millis, Months, Reader, Schema, Writer};
use itertools::Itertools;
Expand Down Expand Up @@ -471,12 +472,17 @@ mod test {

match build_field(inner_schema) {
None => {
let index_of_union =
union_schema.find_schema(&Value::Null).unwrap().0 as u32;
let index_of_union = union_schema
.find_schema_with_known_schemata::<&Schema>(&Value::Null, None, &None)
.unwrap()
.0 as u32;
Some(Value::Union(index_of_union, Box::new(Value::Null)))
}
Some(value) => {
let index_of_union = union_schema.find_schema(&value).unwrap().0 as u32;
let index_of_union = union_schema
.find_schema_with_known_schemata::<&Schema>(&value, None, &None)
.unwrap()
.0 as u32;
Some(Value::Union(index_of_union, Box::new(value)))
}
}
Expand All @@ -487,9 +493,9 @@ mod test {

fn build_avro_data(schema: &Schema) -> Record<'_> {
let mut record = Record::new(schema).unwrap();
if let Schema::Record {
if let Schema::Record(RecordSchema {
name: _, fields, ..
} = schema.clone()
}) = schema.clone()
{
for field in &fields {
let value = build_field(&field.schema)
Expand All @@ -513,7 +519,6 @@ mod test {
#[tokio::test]
async fn test_new_avro_parser() {
let avro_parser_rs = new_avro_parser_from_local("simple-schema.avsc").await;
assert!(avro_parser_rs.is_ok());
let avro_parser = avro_parser_rs.unwrap();
println!("avro_parser = {:?}", avro_parser);
}
Expand Down
Loading

0 comments on commit 8e5477a

Please sign in to comment.